l = find_token(document.body, "\\begin_layout Plain Layout", start, end)
return l
-####################################################################
-
def get_option(document, m, option, default):
l = document.body[m].find(option)
val = default
document.body[m] = document.body[m][:-1] + ' ' + option + '="' + value + '">'
return l
+
+####################################################################
+
+def convert_ltcaption(document):
+ i = 0
+ while True:
+ i = find_token(document.body, "\\begin_inset Tabular", i)
+ if i == -1:
+ return
+ j = find_end_of_inset(document.body, i + 1)
+ if j == -1:
+ document.warning("Malformed LyX document: Could not find end of tabular.")
+ continue
+
+ nrows = int(document.body[i+1].split('"')[3])
+ ncols = int(document.body[i+1].split('"')[5])
+
+ m = i + 1
+ for k in range(nrows):
+ m = find_token(document.body, "<row", m)
+ r = m
+ caption = 'false'
+ for k in range(ncols):
+ m = find_token(document.body, "<cell", m)
+ if (k == 0):
+ mend = find_token(document.body, "</cell>", m + 1)
+ # first look for caption insets
+ mcap = find_token(document.body, "\\begin_inset Caption", m + 1, mend)
+ # then look for ERT captions
+ if mcap == -1:
+ mcap = find_token(document.body, "caption", m + 1, mend)
+ if mcap > -1:
+ mcap = find_token(document.body, "\\backslash", mcap - 1, mcap)
+ if mcap > -1:
+ caption = 'true'
+ if caption == 'true':
+ if (k == 0):
+ set_option(document, r, 'caption', 'true')
+ set_option(document, m, 'multicolumn', '1')
+ set_option(document, m, 'bottomline', 'false')
+ set_option(document, m, 'topline', 'false')
+ set_option(document, m, 'rightline', 'false')
+ set_option(document, m, 'leftline', 'false')
+ #j = find_end_of_inset(document.body, j + 1)
+ else:
+ set_option(document, m, 'multicolumn', '2')
+ m = m + 1
+ m = m + 1
+
+ i = j + 1
+
+def revert_ltcaption(document):
+ i = 0
+ while True:
+ i = find_token(document.body, "\\begin_inset Tabular", i)
+ if i == -1:
+ return
+ j = find_end_of_inset(document.body, i + 1)
+ if j == -1:
+ document.warning("Malformed LyX document: Could not find end of tabular.")
+ continue
+
+ m = i + 1
+ nrows = int(document.body[i+1].split('"')[3])
+ ncols = int(document.body[i+1].split('"')[5])
+
+ for k in range(nrows):
+ m = find_token(document.body, "<row", m)
+ caption = get_option(document, m, 'caption', 'false')
+ if caption == 'true':
+ remove_option(document, m, 'caption')
+ for k in range(ncols):
+ m = find_token(document.body, "<cell", m)
+ remove_option(document, m, 'multicolumn')
+ if k == 0:
+ m = find_token(document.body, "\\begin_inset Caption", m)
+ if m == -1:
+ return
+ m = find_end_of_inset(document.body, m + 1)
+ document.body[m] += wrap_into_ert("","","\\backslash\n\\backslash\n%")
+ m = m + 1
+ m = m + 1
+ i = j + 1
+
+
def convert_tablines(document):
i = 0
while True:
lines.append([top, bottom, left, right])
m = m + 1
+ # we will want to ignore longtable captions
+ m = i + 1
+ caption_info = []
+ for k in range(nrows):
+ m = find_token(document.body, "<row", m)
+ caption = get_option(document, m, 'caption', 'false')
+ caption_info.append([caption])
+ m = m + 1
+
m = i + 1
col_info = []
for k in range(ncols):
left = 'true'
for l in range(nrows):
left = lines[l*ncols + k][2]
- if left == 'false':
+ if left == 'false' and caption_info[l] == 'false':
break
set_option(document, m, 'leftline', left)
right = 'true'
for l in range(nrows):
right = lines[l*ncols + k][3]
- if right == 'false':
+ if right == 'false' and caption_info[l] == 'false':
break
set_option(document, m, 'rightline', right)
m = m + 1
top = lines[k*ncols + l][0]
if top == 'false':
break
+ if caption_info[k] == 'false':
+ top = 'false'
set_option(document, m, 'topline', top)
bottom = 'true'
for l in range(ncols):
bottom = lines[k*ncols + l][1]
if bottom == 'false':
break
+ if caption_info[k] == 'false':
+ bottom = 'false'
set_option(document, m, 'bottomline', bottom)
m = m + 1
[328, [remove_embedding, remove_extra_embedded_files, remove_inzip_options]],
[329, []],
[330, []],
+ [331, [convert_ltcaption]],
]
-revert = [[329, [revert_leftarrowfill, revert_rightarrowfill, revert_upbracefill, revert_downbracefill]],
+revert = [[330, [revert_ltcaption]],
+ [329, [revert_leftarrowfill, revert_rightarrowfill, revert_upbracefill, revert_downbracefill]],
[328, [revert_master]],
[327, []],
[326, [revert_mexican]],
<rect>
<x>0</x>
<y>0</y>
- <width>432</width>
- <height>351</height>
+ <width>390</width>
+ <height>336</height>
</rect>
</property>
<property name="windowTitle" >
</property>
<layout class="QGridLayout" >
<property name="margin" >
- <number>11</number>
+ <number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<layout class="QGridLayout" >
<property name="margin" >
- <number>11</number>
+ <number>9</number>
</property>
<property name="spacing" >
<number>6</number>
<widget class="QFrame" name="bordersF" >
<property name="sizePolicy" >
<sizepolicy>
- <hsizetype>5</hsizetype>
- <vsizetype>5</vsizetype>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<property name="palette" >
<palette>
<active>
- <color>
- <red>0</red>
- <green>0</green>
- <blue>0</blue>
- </color>
- <color>
- <red>230</red>
- <green>240</green>
- <blue>249</blue>
- </color>
- <color>
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- <color>
- <red>242</red>
- <green>247</green>
- <blue>252</blue>
- </color>
- <color>
- <red>115</red>
- <green>120</green>
- <blue>124</blue>
- </color>
- <color>
- <red>154</red>
- <green>160</green>
- <blue>166</blue>
- </color>
- <color>
- <red>0</red>
- <green>0</green>
- <blue>0</blue>
- </color>
- <color>
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- <color>
- <red>0</red>
- <green>0</green>
- <blue>0</blue>
- </color>
- <color>
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- <color>
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- <color>
- <red>0</red>
- <green>0</green>
- <blue>0</blue>
- </color>
- <color>
- <red>16</red>
- <green>145</green>
- <blue>210</blue>
- </color>
- <color>
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- <color>
- <red>0</red>
- <green>0</green>
- <blue>255</blue>
- </color>
- <color>
- <red>255</red>
- <green>0</green>
- <blue>255</blue>
- </color>
- <color>
- <red>232</red>
- <green>232</green>
- <blue>232</blue>
- </color>
+ <colorrole role="WindowText" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Button" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>230</red>
+ <green>240</green>
+ <blue>249</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Light" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Midlight" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>242</red>
+ <green>247</green>
+ <blue>252</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Dark" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>115</red>
+ <green>120</green>
+ <blue>124</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Mid" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>154</red>
+ <green>160</green>
+ <blue>166</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Text" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="BrightText" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ButtonText" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Base" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Window" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Shadow" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Highlight" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>16</red>
+ <green>145</green>
+ <blue>210</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="HighlightedText" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Link" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>0</red>
+ <green>0</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="LinkVisited" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>0</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="AlternateBase" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>232</red>
+ <green>232</green>
+ <blue>232</blue>
+ </color>
+ </brush>
+ </colorrole>
</active>
<inactive>
- <color>
- <red>0</red>
- <green>0</green>
- <blue>0</blue>
- </color>
- <color>
- <red>230</red>
- <green>240</green>
- <blue>249</blue>
- </color>
- <color>
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- <color>
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- <color>
- <red>115</red>
- <green>120</green>
- <blue>124</blue>
- </color>
- <color>
- <red>154</red>
- <green>160</green>
- <blue>166</blue>
- </color>
- <color>
- <red>0</red>
- <green>0</green>
- <blue>0</blue>
- </color>
- <color>
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- <color>
- <red>0</red>
- <green>0</green>
- <blue>0</blue>
- </color>
- <color>
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- <color>
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- <color>
- <red>0</red>
- <green>0</green>
- <blue>0</blue>
- </color>
- <color>
- <red>16</red>
- <green>145</green>
- <blue>210</blue>
- </color>
- <color>
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- <color>
- <red>0</red>
- <green>0</green>
- <blue>255</blue>
- </color>
- <color>
- <red>255</red>
- <green>0</green>
- <blue>255</blue>
- </color>
- <color>
- <red>232</red>
- <green>232</green>
- <blue>232</blue>
- </color>
+ <colorrole role="WindowText" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Button" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>230</red>
+ <green>240</green>
+ <blue>249</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Light" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Midlight" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Dark" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>115</red>
+ <green>120</green>
+ <blue>124</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Mid" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>154</red>
+ <green>160</green>
+ <blue>166</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Text" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="BrightText" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ButtonText" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Base" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Window" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Shadow" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Highlight" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>16</red>
+ <green>145</green>
+ <blue>210</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="HighlightedText" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Link" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>0</red>
+ <green>0</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="LinkVisited" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>0</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="AlternateBase" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>232</red>
+ <green>232</green>
+ <blue>232</blue>
+ </color>
+ </brush>
+ </colorrole>
</inactive>
<disabled>
- <color>
- <red>128</red>
- <green>128</green>
- <blue>128</blue>
- </color>
- <color>
- <red>230</red>
- <green>240</green>
- <blue>249</blue>
- </color>
- <color>
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- <color>
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- <color>
- <red>115</red>
- <green>120</green>
- <blue>124</blue>
- </color>
- <color>
- <red>154</red>
- <green>160</green>
- <blue>166</blue>
- </color>
- <color>
- <red>0</red>
- <green>0</green>
- <blue>0</blue>
- </color>
- <color>
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- <color>
- <red>128</red>
- <green>128</green>
- <blue>128</blue>
- </color>
- <color>
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- <color>
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- <color>
- <red>0</red>
- <green>0</green>
- <blue>0</blue>
- </color>
- <color>
- <red>16</red>
- <green>145</green>
- <blue>210</blue>
- </color>
- <color>
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- <color>
- <red>0</red>
- <green>0</green>
- <blue>255</blue>
- </color>
- <color>
- <red>255</red>
- <green>0</green>
- <blue>255</blue>
- </color>
- <color>
- <red>232</red>
- <green>232</green>
- <blue>232</blue>
- </color>
+ <colorrole role="WindowText" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Button" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>230</red>
+ <green>240</green>
+ <blue>249</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Light" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Midlight" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Dark" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>115</red>
+ <green>120</green>
+ <blue>124</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Mid" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>154</red>
+ <green>160</green>
+ <blue>166</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Text" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="BrightText" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ButtonText" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>128</red>
+ <green>128</green>
+ <blue>128</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Base" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Window" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Shadow" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Highlight" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>16</red>
+ <green>145</green>
+ <blue>210</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="HighlightedText" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Link" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>0</red>
+ <green>0</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="LinkVisited" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>255</red>
+ <green>0</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="AlternateBase" >
+ <brush brushstyle="SolidPattern" >
+ <color alpha="255" >
+ <red>232</red>
+ <green>232</green>
+ <blue>232</blue>
+ </color>
+ </brush>
+ </colorrole>
</disabled>
</palette>
</property>
</property>
<layout class="QGridLayout" >
<property name="margin" >
- <number>3</number>
+ <number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
- <widget class="GuiSetBorder" name="borders" >
+ <widget class="GuiSetBorder" native="1" name="borders" >
<property name="sizePolicy" >
<sizepolicy>
- <hsizetype>1</hsizetype>
- <vsizetype>1</vsizetype>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeHint" >
<size>
- <width>20</width>
- <height>40</height>
+ <width>91</width>
+ <height>31</height>
</size>
</property>
</spacer>
</property>
<layout class="QGridLayout" >
<property name="margin" >
- <number>11</number>
+ <number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
</widget>
</item>
- <item row="1" column="0" >
- <widget class="QLabel" name="HeaderLA" >
+ <item row="0" column="2" >
+ <widget class="QLabel" name="BorderAboveLA" >
<property name="text" >
- <string>Header:</string>
+ <string>Border above</string>
</property>
</widget>
</item>
- <item row="3" column="0" >
- <widget class="QLabel" name="FooterLA" >
+ <item row="0" column="3" >
+ <widget class="QLabel" name="BorderBelowLA" >
<property name="text" >
- <string>Footer:</string>
+ <string>Border below</string>
</property>
</widget>
</item>
- <item row="2" column="0" >
- <widget class="QLabel" name="FirstHeaderLA" >
+ <item row="0" column="4" >
+ <widget class="QLabel" name="ContentsLA" >
<property name="text" >
- <string>First header:</string>
+ <string>Contents</string>
</property>
</widget>
</item>
- <item row="4" column="0" >
- <widget class="QLabel" name="LastFooterLA" >
+ <item row="1" column="0" >
+ <widget class="QLabel" name="HeaderLA" >
<property name="text" >
- <string>Last footer:</string>
+ <string>Header:</string>
</property>
</widget>
</item>
- <item row="0" column="4" >
- <widget class="QLabel" name="ContentsLA" >
+ <item row="1" column="1" >
+ <widget class="QCheckBox" name="headerStatusCB" >
+ <property name="toolTip" >
+ <string>Repeat this row as header on every (except the first) page</string>
+ </property>
<property name="text" >
- <string>Contents</string>
+ <string>on</string>
</property>
</widget>
</item>
- <item row="0" column="2" >
- <widget class="QLabel" name="BorderAboveLA" >
+ <item row="1" column="2" >
+ <widget class="QCheckBox" name="headerBorderAboveCB" >
+ <property name="toolTip" >
+ <string/>
+ </property>
<property name="text" >
- <string>Border above</string>
+ <string>double</string>
</property>
</widget>
</item>
- <item row="0" column="3" >
- <widget class="QLabel" name="BorderBelowLA" >
+ <item row="1" column="3" >
+ <widget class="QCheckBox" name="headerBorderBelowCB" >
<property name="text" >
- <string>Border below</string>
+ <string>double</string>
</property>
</widget>
</item>
- <item row="1" column="1" >
- <widget class="QCheckBox" name="headerStatusCB" >
- <property name="toolTip" >
- <string>Repeat this row as header on every (except the first) page</string>
- </property>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="FirstHeaderLA" >
<property name="text" >
- <string>on</string>
+ <string>First header:</string>
</property>
</widget>
</item>
</property>
</widget>
</item>
- <item row="3" column="1" >
- <widget class="QCheckBox" name="footerStatusCB" >
- <property name="toolTip" >
- <string>Repeat this row as footer on every (except the last) page</string>
+ <item row="2" column="2" >
+ <widget class="QCheckBox" name="firstheaderBorderAboveCB" >
+ <property name="text" >
+ <string>double</string>
</property>
+ </widget>
+ </item>
+ <item row="2" column="3" >
+ <widget class="QCheckBox" name="firstheaderBorderBelowCB" >
<property name="text" >
- <string>on</string>
+ <string>double</string>
</property>
</widget>
</item>
- <item row="4" column="1" >
- <widget class="QCheckBox" name="lastfooterStatusCB" >
+ <item row="2" column="4" >
+ <widget class="QCheckBox" name="firstheaderNoContentsCB" >
<property name="toolTip" >
- <string>This row is the footer of the last page</string>
+ <string>Don't output the first header</string>
</property>
<property name="text" >
- <string>on</string>
+ <string>is empty</string>
</property>
</widget>
</item>
- <item row="1" column="2" >
- <widget class="QCheckBox" name="headerBorderAboveCB" >
- <property name="toolTip" >
- <string/>
- </property>
+ <item row="3" column="0" >
+ <widget class="QLabel" name="FooterLA" >
<property name="text" >
- <string>double</string>
+ <string>Footer:</string>
</property>
</widget>
</item>
- <item row="2" column="2" >
- <widget class="QCheckBox" name="firstheaderBorderAboveCB" >
+ <item row="3" column="1" >
+ <widget class="QCheckBox" name="footerStatusCB" >
+ <property name="toolTip" >
+ <string>Repeat this row as footer on every (except the last) page</string>
+ </property>
<property name="text" >
- <string>double</string>
+ <string>on</string>
</property>
</widget>
</item>
</property>
</widget>
</item>
- <item row="4" column="2" >
- <widget class="QCheckBox" name="lastfooterBorderAboveCB" >
+ <item row="3" column="3" >
+ <widget class="QCheckBox" name="footerBorderBelowCB" >
<property name="text" >
<string>double</string>
</property>
</widget>
</item>
- <item row="4" column="3" >
- <widget class="QCheckBox" name="lastfooterBorderBelowCB" >
+ <item row="4" column="0" >
+ <widget class="QLabel" name="LastFooterLA" >
<property name="text" >
- <string>double</string>
+ <string>Last footer:</string>
</property>
</widget>
</item>
- <item row="3" column="3" >
- <widget class="QCheckBox" name="footerBorderBelowCB" >
+ <item row="4" column="1" >
+ <widget class="QCheckBox" name="lastfooterStatusCB" >
+ <property name="toolTip" >
+ <string>This row is the footer of the last page</string>
+ </property>
<property name="text" >
- <string>double</string>
+ <string>on</string>
</property>
</widget>
</item>
- <item row="2" column="3" >
- <widget class="QCheckBox" name="firstheaderBorderBelowCB" >
+ <item row="4" column="2" >
+ <widget class="QCheckBox" name="lastfooterBorderAboveCB" >
<property name="text" >
<string>double</string>
</property>
</widget>
</item>
- <item row="1" column="3" >
- <widget class="QCheckBox" name="headerBorderBelowCB" >
+ <item row="4" column="3" >
+ <widget class="QCheckBox" name="lastfooterBorderBelowCB" >
<property name="text" >
<string>double</string>
</property>
</property>
</widget>
</item>
- <item row="2" column="4" >
- <widget class="QCheckBox" name="firstheaderNoContentsCB" >
- <property name="toolTip" >
- <string>Don't output the first header</string>
+ <item row="5" column="0" >
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Caption:</string>
</property>
+ </widget>
+ </item>
+ <item row="5" column="1" >
+ <widget class="QCheckBox" name="captionStatusCB" >
<property name="text" >
- <string>is empty</string>
+ <string>on</string>
</property>
</widget>
</item>
<widget class="QLineEdit" name="tabularRowED" >
<property name="sizePolicy" >
<sizepolicy>
- <hsizetype>1</hsizetype>
+ <hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
<widget class="QLineEdit" name="tabularColumnED" >
<property name="sizePolicy" >
<sizepolicy>
- <hsizetype>1</hsizetype>
+ <hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
<widget class="QPushButton" name="closePB" >
<property name="sizePolicy" >
<sizepolicy>
- <hsizetype>1</hsizetype>
+ <hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</item>
</layout>
</widget>
- <pixmapfunction></pixmapfunction>
- <includes>
- <include location="local" >qt_i18n.h</include>
- </includes>
<customwidgets>
<customwidget>
<class>LengthCombo</class>
<extends>QComboBox</extends>
<header>LengthCombo.h</header>
- <container>0</container>
- <pixmap></pixmap>
</customwidget>
<customwidget>
<class>GuiSetBorder</class>
<extends>QWidget</extends>
<header>GuiSetBorder.h</header>
- <container>0</container>
- <pixmap></pixmap>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>lastfooterNoContentsCB</tabstop>
<tabstop>newpageCB</tabstop>
</tabstops>
+ <includes>
+ <include location="local" >qt_i18n.h</include>
+ </includes>
<resources/>
<connections/>
</ui>
{ Tabular::SET_LTLASTFOOT, "set-ltlastfoot" },
{ Tabular::UNSET_LTLASTFOOT, "unset-ltlastfoot" },
{ Tabular::SET_LTNEWPAGE, "set-ltnewpage" },
+ { Tabular::TOGGLE_LTCAPTION, "toggle-ltcaption" },
{ Tabular::SET_SPECIAL_COLUMN, "set-special-column" },
{ Tabular::SET_SPECIAL_MULTI, "set-special-multi" },
{ Tabular::SET_BOOKTABS, "set-booktabs" },
endfirsthead(false),
endfoot(false),
endlastfoot(false),
- newpage(false)
+ newpage(false),
+ caption(false)
{}
<< write_attribute("endfoot", row_info[i].endfoot)
<< write_attribute("endlastfoot", row_info[i].endlastfoot)
<< write_attribute("newpage", row_info[i].newpage)
+ << write_attribute("caption", row_info[i].caption)
<< ">\n";
for (col_type j = 0; j < column_info.size(); ++j) {
os << "<cell"
getTokenValue(line, "endfoot", row_info[i].endfoot);
getTokenValue(line, "endlastfoot", row_info[i].endlastfoot);
getTokenValue(line, "newpage", row_info[i].newpage);
+ getTokenValue(line, "caption", row_info[i].caption);
for (col_type j = 0; j < column_info.size(); ++j) {
l_getline(is, line);
if (!prefixIs(line, "<cell")) {
}
+Tabular::idx_type Tabular::setLTCaption(row_type row, bool what)
+{
+ idx_type i = getFirstCellInRow(row);
+ if (what) {
+ setMultiColumn(i, column_info.size());
+ setTopLine(i, false);
+ setBottomLine(i, false);
+ setLeftLine(i, false);
+ setRightLine(i, false);
+ } else
+ unsetMultiColumn(i);
+ row_info[row].caption = what;
+ return i;
+}
+
+
+bool Tabular::ltCaption(row_type row) const
+{
+ return row_info[row].caption;
+}
+
+
// end longtable support functions
void Tabular::setRowAscent(row_type row, int height)
int Tabular::TeXCellPreamble(odocstream & os, idx_type cell, bool & ismulticol) const
{
int ret = 0;
+ row_type const r = cellRow(cell);
+ if (is_long_tabular && row_info[r].caption)
+ return ret;
Tabular::VAlignment valign = getVAlignment(cell, !isMultiColumn(cell));
LyXAlignment align = getAlignment(cell, !isMultiColumn(cell));
// figure out how to set the lines
// we always set double lines to the right of the cell
- row_type const r = cellRow(cell);
col_type const c = cellColumn(cell);
col_type const nextcol = c + columnSpan(cell);
bool colright = columnRightLine(c);
bool prevcellright = c > 0 && rightLine(cellIndex(r, c - 1));
ismulticol = isMultiColumn(cell)
|| (c == 0 && colleft != leftLine(cell))
- || (c > 0 && !(colleft || prevcellright) && leftLine(cell))
|| ((colright || nextcolleft) && !rightLine(cell) && !nextcellleft)
|| (!colright && !nextcolleft && (rightLine(cell) || nextcellleft))
|| (coldouble != celldouble);
int Tabular::TeXCellPostamble(odocstream & os, idx_type cell, bool ismulticol) const
{
int ret = 0;
+ row_type const r = cellRow(cell);
+ if (is_long_tabular && row_info[r].caption)
+ return ret;
// usual cells
if (getUsebox(cell) == BOX_PARBOX)
case Tabular::DELETE_COLUMN:
case Tabular::COPY_ROW:
case Tabular::COPY_COLUMN:
- case Tabular::SET_ALL_LINES:
- case Tabular::UNSET_ALL_LINES:
case Tabular::SET_TOP_SPACE:
case Tabular::SET_BOTTOM_SPACE:
case Tabular::SET_INTERLINE_SPACE:
- case Tabular::SET_BORDER_LINES:
status.clear();
return true;
status.setOnOff(tabular.isMultiColumn(cur.idx()));
break;
+ case Tabular::SET_ALL_LINES:
+ case Tabular::UNSET_ALL_LINES:
+ case Tabular::SET_BORDER_LINES:
+ status.enabled(!tabular.ltCaption(tabular.cellRow(cur.idx())));
+ break;
+
case Tabular::TOGGLE_LINE_TOP:
+ status.enabled(!tabular.ltCaption(tabular.cellRow(cur.idx())));
status.setOnOff(tabular.topLine(cur.idx()));
break;
case Tabular::TOGGLE_LINE_BOTTOM:
+ status.enabled(!tabular.ltCaption(tabular.cellRow(cur.idx())));
status.setOnOff(tabular.bottomLine(cur.idx()));
break;
case Tabular::TOGGLE_LINE_LEFT:
+ status.enabled(!tabular.ltCaption(tabular.cellRow(cur.idx())));
status.setOnOff(tabular.leftLine(cur.idx()));
break;
case Tabular::TOGGLE_LINE_RIGHT:
+ status.enabled(!tabular.ltCaption(tabular.cellRow(cur.idx())));
status.setOnOff(tabular.rightLine(cur.idx()));
break;
status.setOnOff(tabular.getLTNewPage(sel_row_start));
break;
+ case Tabular::TOGGLE_LTCAPTION:
+ status.enabled(sel_row_start == sel_row_end);
+ status.setOnOff(tabular.ltCaption(sel_row_start));
+ break;
+
case Tabular::SET_BOOKTABS:
status.setOnOff(tabular.use_booktabs);
break;
tabular.setLTNewPage(row, !tabular.getLTNewPage(row));
break;
+ case Tabular::TOGGLE_LTCAPTION:
+ cur.idx() = tabular.setLTCaption(row, !tabular.ltCaption(row));
+ cur.pit() = 0;
+ cur.pos() = 0;
+ cur.selection() = false;
+ break;
+
case Tabular::SET_BOOKTABS:
tabular.use_booktabs = true;
break;