Introducing table templates

The idea is simple: we insert a pre-formatted table (with a given border
style currently, but other attributes are possible as well) via file-insert
and scale it then to the requested size.

We need three sizes (1x1, 1x2 and 1x3) to generate all sizes properly (due
to border specifications).

Currently, these styles can only be accessed via lfun tabular-style-insert
and the Tabular Create dialog.

My plan is to add a buffer param to set a default style (#9901) which then
also is respected by the toolbar button and probably a layout tag to let
classes specify a default style (#8360).
This commit is contained in:
Juergen Spitzmueller 2019-03-26 13:43:33 +01:00
parent 2ed3b22a06
commit 683b3a05e2
21 changed files with 1603 additions and 7 deletions

View File

@ -2637,6 +2637,21 @@ dist_ui_DATA = \
ui/stdmenus.inc \
ui/stdtoolbars.inc
tabletemplatesdir = $(pkgdatadir)/tabletemplates
dist_tabletemplates_DATA = \
tabletemplates/Formal.lyx \
tabletemplates/Formal_1x1.lyx \
tabletemplates/Formal_1x2.lyx \
tabletemplates/Grid_with_Head.lyx \
tabletemplates/Grid_with_Head_1x1.lyx \
tabletemplates/Grid_with_Head_1x2.lyx \
tabletemplates/No_Borders.lyx \
tabletemplates/No_Borders_1x1.lyx \
tabletemplates/No_Borders_1x2.lyx \
tabletemplates/Simple_Grid.lyx \
tabletemplates/Simple_Grid_1x1.lyx \
tabletemplates/Simple_Grid_1x2.lyx
xtemplatesdir = $(pkgdatadir)/xtemplates
dist_xtemplates_DATA = \
xtemplates/chess.xtemplate \
@ -2751,6 +2766,7 @@ exampleandtemplate_files = \
$(dist_srexamples_DATA) \
$(dist_srmoduleexamples_DATA) \
$(dist_svexamples_DATA) \
$(dist_tabletemplates_DATA) \
$(dist_thesistemplates_DATA) \
$(dist_ukexamples_DATA) \
$(dist_examples_DATA) \

View File

@ -0,0 +1,126 @@
#LyX 2.3 created this file. For more info see http://www.lyx.org/
\lyxformat 544
\begin_document
\begin_header
\save_transient_properties true
\origin /systemlyxdir/tablestyles/
\textclass article
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures true
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\use_minted 0
\index Stichwortverzeichnis
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style danish
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="1">
<features booktabs="true" tabularvalignment="middle">
<column alignment="center" valignment="top" width="0pt">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
</row>
</lyxtabular>
\end_inset
\end_layout
\end_body
\end_document

View File

@ -0,0 +1,104 @@
#LyX 2.4 created this file. For more info see https://www.lyx.org/
\lyxformat 568
\begin_document
\begin_header
\save_transient_properties true
\origin /systemlyxdir/tablestyles/
\textclass article
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding auto
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures true
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\use_minted 0
\index Stichwortverzeichnis
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style danish
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="1" columns="1">
<features booktabs="true" tabularvalignment="middle">
<column alignment="center" valignment="top" width="0pt">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
</row>
</lyxtabular>
\end_inset
\end_layout
\end_body
\end_document

View File

@ -0,0 +1,115 @@
#LyX 2.4 created this file. For more info see https://www.lyx.org/
\lyxformat 568
\begin_document
\begin_header
\save_transient_properties true
\origin /systemlyxdir/tablestyles/
\textclass article
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding auto
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures true
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\use_minted 0
\index Stichwortverzeichnis
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style danish
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="2" columns="1">
<features booktabs="true" tabularvalignment="middle">
<column alignment="center" valignment="top" width="0pt">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
</row>
</lyxtabular>
\end_inset
\end_layout
\end_body
\end_document

View File

@ -0,0 +1,126 @@
#LyX 2.4 created this file. For more info see https://www.lyx.org/
\lyxformat 568
\begin_document
\begin_header
\save_transient_properties true
\origin /systemlyxdir/tablestyles/
\textclass article
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding auto
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures true
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\use_minted 0
\index Stichwortverzeichnis
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style danish
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="1">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0pt">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
</row>
</lyxtabular>
\end_inset
\end_layout
\end_body
\end_document

View File

@ -0,0 +1,104 @@
#LyX 2.4 created this file. For more info see https://www.lyx.org/
\lyxformat 568
\begin_document
\begin_header
\save_transient_properties true
\origin /systemlyxdir/tablestyles/
\textclass article
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding auto
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures true
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\use_minted 0
\index Stichwortverzeichnis
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style danish
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="1" columns="1">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0pt">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
</row>
</lyxtabular>
\end_inset
\end_layout
\end_body
\end_document

View File

@ -0,0 +1,115 @@
#LyX 2.4 created this file. For more info see https://www.lyx.org/
\lyxformat 568
\begin_document
\begin_header
\save_transient_properties true
\origin /systemlyxdir/tablestyles/
\textclass article
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding auto
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures true
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\use_minted 0
\index Stichwortverzeichnis
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style danish
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="2" columns="1">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0pt">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
</row>
</lyxtabular>
\end_inset
\end_layout
\end_body
\end_document

View File

@ -0,0 +1,126 @@
#LyX 2.3 created this file. For more info see http://www.lyx.org/
\lyxformat 544
\begin_document
\begin_header
\save_transient_properties true
\origin /systemlyxdir/tablestyles/
\textclass article
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures true
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\use_minted 0
\index Stichwortverzeichnis
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style danish
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="1">
<features tabularvalignment="middle">
<column alignment="center" valignment="top">
<row>
<cell alignment="center" valignment="top" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
</row>
</lyxtabular>
\end_inset
\end_layout
\end_body
\end_document

View File

@ -0,0 +1,104 @@
#LyX 2.4 created this file. For more info see https://www.lyx.org/
\lyxformat 568
\begin_document
\begin_header
\save_transient_properties true
\origin /systemlyxdir/tablestyles/
\textclass article
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding auto
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures true
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\use_minted 0
\index Stichwortverzeichnis
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style danish
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="1" columns="1">
<features tabularvalignment="middle">
<column alignment="center" valignment="top">
<row>
<cell alignment="center" valignment="top" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
</row>
</lyxtabular>
\end_inset
\end_layout
\end_body
\end_document

View File

@ -0,0 +1,115 @@
#LyX 2.4 created this file. For more info see https://www.lyx.org/
\lyxformat 568
\begin_document
\begin_header
\save_transient_properties true
\origin /systemlyxdir/tablestyles/
\textclass article
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding auto
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures true
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\use_minted 0
\index Stichwortverzeichnis
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style danish
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="2" columns="1">
<features tabularvalignment="middle">
<column alignment="center" valignment="top">
<row>
<cell alignment="center" valignment="top" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
</row>
</lyxtabular>
\end_inset
\end_layout
\end_body
\end_document

View File

@ -0,0 +1,126 @@
#LyX 2.3 created this file. For more info see http://www.lyx.org/
\lyxformat 544
\begin_document
\begin_header
\save_transient_properties true
\origin /systemlyxdir/tablestyles/
\textclass article
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures true
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\use_minted 0
\index Stichwortverzeichnis
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style danish
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="3" columns="1">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0pt">
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
</row>
</lyxtabular>
\end_inset
\end_layout
\end_body
\end_document

View File

@ -0,0 +1,104 @@
#LyX 2.4 created this file. For more info see https://www.lyx.org/
\lyxformat 568
\begin_document
\begin_header
\save_transient_properties true
\origin /systemlyxdir/tablestyles/
\textclass article
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding auto
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures true
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\use_minted 0
\index Stichwortverzeichnis
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style danish
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="1" columns="1">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0pt">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
</row>
</lyxtabular>
\end_inset
\end_layout
\end_body
\end_document

View File

@ -0,0 +1,115 @@
#LyX 2.4 created this file. For more info see https://www.lyx.org/
\lyxformat 568
\begin_document
\begin_header
\save_transient_properties true
\origin /systemlyxdir/tablestyles/
\textclass article
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding auto
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures true
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\use_minted 0
\index Stichwortverzeichnis
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style danish
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Standard
\begin_inset Tabular
<lyxtabular version="3" rows="2" columns="1">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0pt">
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
</row>
</lyxtabular>
\end_inset
\end_layout
\end_body
\end_document

View File

@ -16,7 +16,7 @@ ${srcdir}/POTFILES.in: $(POTFILE_IN_DEPS)
sort | uniq ) > $@-t \
&& mv $@-t $@
l10n_pots: qt4_l10n.pot layouts_l10n.pot languages_l10n.pot latexfonts_l10n.pot encodings_l10n.pot ui_l10n.pot external_l10n.pot formats_l10n.pot examples_templates_l10n.pot
l10n_pots: qt4_l10n.pot layouts_l10n.pot languages_l10n.pot latexfonts_l10n.pot encodings_l10n.pot ui_l10n.pot external_l10n.pot formats_l10n.pot examples_templates_l10n.pot tabletemplates_l10n.pot
cat $^ | msguniq -o $(DOMAIN).po
rm $^
@ -60,6 +60,9 @@ examples_templates_l10n.pot: $(top_srcdir)/lib/examples/* \
$(top_srcdir)/lib/templates/*
$(LYX_POT) -o $@ -t examples_templates $^
tabletemplates_l10n.pot: $(top_srcdir)/lib/tabletemplates/*.lyx
$(LYX_POT) -o $@ -t tabletemplates $^
# LyX specific code to generate l10n statistics for the web site
i18n.inc: $(POFILES) postats.py
$(PYTHON) $(srcdir)/postats.py "$(VERSION)" $(POFILES) >$@

View File

@ -653,6 +653,29 @@ def parseExamplesTemplates(file, seen, output):
(relativePath(input_files[0], base), 0, filename.replace('_', ' ').replace('%26', '&').replace('%28', '(').replace('%29', ')')), file=output)
def tabletemplates_l10n(input_files, output, base):
'''Generate pot file from lib/tabletemplates '''
output = io.open(output, 'w', encoding='utf_8', newline='\n')
# only record each item once
seen = []
for file in input_files:
filename = file.split(os.sep)[-1]
if os.path.isfile(file):
if filename[-4:] != ".lyx":
continue
filename = filename[:-4]
if filename[-4:-1] == "_1x":
continue
if seen.count(filename):
continue
seen.append(filename)
if filename != "":
print(u'#: %s:%d\nmsgid "%s"\nmsgstr ""\n' % \
(relativePath(input_files[0], base), 0, filename.replace('_', ' ')), file=output)
output.close()
Usage = '''
lyx_pot.py [-b|--base top_src_dir] [-o|--output output_file] [-h|--help] [-s|src_file filename] -t|--type input_type input_files
@ -675,6 +698,7 @@ where
external: external templates files
formats: formats predefined in lib/configure.py
examples_templates: example and template files
tabletemplates: table template files
'''
if __name__ == '__main__':
@ -698,7 +722,7 @@ if __name__ == '__main__':
elif opt in ['-s', '--src_file']:
input_files = [f.strip() for f in io.open(value, encoding='utf_8')]
if input_type not in ['ui', 'layouts', 'layouttranslations', 'qt4', 'languages', 'latexfonts', 'encodings', 'external', 'formats', 'examples_templates'] or output is None:
if input_type not in ['ui', 'layouts', 'layouttranslations', 'qt4', 'languages', 'latexfonts', 'encodings', 'external', 'formats', 'examples_templates', 'tabletemplates'] or output is None:
print('Wrong input type or output filename.')
sys.exit(1)
@ -729,5 +753,7 @@ if __name__ == '__main__':
encodings_l10n(input_files, output, base)
elif input_type == 'examples_templates':
examples_templates_l10n(input_files, output, base)
elif input_type == 'tabletemplates':
tabletemplates_l10n(input_files, output, base)
else:
languages_l10n(input_files, output, base)

View File

@ -483,6 +483,7 @@ enum FuncCode
// 375
LFUN_SEARCH_IGNORE, // kornel, 20181115
LFUN_BUFFER_WRITE_AS_TEMPLATE, // spitz, 20190323
LFUN_TABULAR_STYLE_INSERT, // spitz, 20190325
LFUN_LASTACTION // end of the table
};

View File

@ -3787,6 +3787,18 @@ void LyXAction::init()
*/
{ LFUN_TABULAR_INSERT, "tabular-insert", Noop, Edit },
/*!
* \var lyx::FuncCode lyx::LFUN_TABULAR_STYLE_INSERT
* \li Action: Inserts table of a given style into the document.
* \li Notion: See #LFUN_TABULAR_FEATURE for some more details
about tabular modifications.
* \li Syntax: tabular-style-insert <style> <ROWS> <COLUMNS>
* \li Params: Valid styles are the names of the files in lib/tabletemplates,
* minus _1x<n> and .lyx suffix.
* \li Origin: spitz, 25 Mar 2019
* \endvar
*/
{ LFUN_TABULAR_STYLE_INSERT, "tabular-style-insert", Noop, Edit },
/*!
* \var lyx::FuncCode lyx::LFUN_TAB_DELETE

View File

@ -70,6 +70,7 @@
#include "support/convert.h"
#include "support/debug.h"
#include "support/filetools.h"
#include "support/gettext.h"
#include "support/lassert.h"
#include "support/limited_stack.h"
@ -2085,6 +2086,56 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
break;
case LFUN_TABULAR_STYLE_INSERT: {
string const style = cmd.getArg(0);
string const rows = cmd.getArg(1);
string const cols = cmd.getArg(2);
if (cols.empty() || !isStrInt(cols)
|| rows.empty() || !isStrInt(rows))
break;
int const r = convert<int>(rows);
int const c = convert<int>(cols);
string suffix;
if (r == 1)
suffix = "_1x1";
else if (r == 2)
suffix = "_1x2";
FileName const tabstyle = libFileSearch("tabletemplates",
style + suffix + ".lyx", "lyx");
if (tabstyle.empty())
break;
UndoGroupHelper ugh(cur.buffer());
cur.recordUndo();
FuncRequest cmd2(LFUN_FILE_INSERT, tabstyle.absFileName() + " ignorelang");
lyx::dispatch(cmd2);
if (r > 2) {
// go into table
cur.backwardPos();
// move one cell up to middle cell
cur.up();
// now add the missing rows and columns
int const addrows = r - 3;
int const addcols = c - 1;
for (int i = 0 ; i < addrows ; ++i) {
FuncRequest fr(LFUN_TABULAR_FEATURE, "append-row");
lyx::dispatch(fr);
}
for (int i = 0 ; i < addcols ; ++i) {
FuncRequest fr(LFUN_TABULAR_FEATURE, "append-column");
lyx::dispatch(fr);
}
// go to first cell
cur.up();
} else {
// jump over table
cur.backwardChar();
// go to first cell
cur.forwardPos();
}
break;
}
case LFUN_FLOAT_INSERT:
case LFUN_FLOAT_WIDE_INSERT:
case LFUN_WRAP_INSERT: {
@ -2872,6 +2923,9 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
case LFUN_TABULAR_INSERT:
code = TABULAR_CODE;
break;
case LFUN_TABULAR_STYLE_INSERT:
code = TABULAR_CODE;
break;
case LFUN_MARGINALNOTE_INSERT:
code = MARGIN_CODE;
break;

View File

@ -15,16 +15,62 @@
#include "EmptyTable.h"
#include "FuncRequest.h"
#include "support/debug.h"
#include "support/convert.h"
#include "support/filetools.h"
#include "support/gettext.h"
#include "support/lstrings.h"
#include "support/qstring_helpers.h"
#include "support/Package.h"
#include <QDirIterator>
#include <QSpinBox>
#include <QPushButton>
using namespace std;
using namespace lyx::support;
namespace lyx {
namespace frontend {
void GuiTabularCreate::getFiles()
{
// We look for lyx files in the subdirectory dir of
// 1) user_lyxdir
// 2) build_lyxdir (if not empty)
// 3) system_lyxdir
// in this order. Files with a given sub-hierarchy will
// only be listed once.
// We also consider i18n subdirectories and store them separately.
QStringList dirs;
// The three locations to look at.
string const user = addPath(package().user_support().absFileName(), "tabletemplates");
string const build = addPath(package().build_support().absFileName(), "tabletemplates");
string const system = addPath(package().system_support().absFileName(), "tabletemplates");
dirs << toqstr(user)
<< toqstr(build)
<< toqstr(system);
for (int i = 0; i < dirs.size(); ++i) {
QString const dir = dirs.at(i);
QDirIterator it(dir, QDir::Files, QDirIterator::Subdirectories);
while (it.hasNext()) {
QString fn = QFileInfo(it.next()).fileName();
if (!fn.endsWith(".lyx") || fn.contains("_1x"))
continue;
QString data = fn.left(fn.lastIndexOf(".lyx"));
QString guiname = data;
guiname = toqstr(translateIfPossible(qstring_to_ucs4(guiname.replace('_', ' '))));
QString relpath = toqstr(makeRelPath(qstring_to_ucs4(fn),
qstring_to_ucs4(dir)));
if (styleCO->findData(data) == -1)
styleCO->addItem(guiname, data);
}
}
}
GuiTabularCreate::GuiTabularCreate(GuiView & lv)
: GuiDialog(lv, "tabularcreate", qt_("Insert Table"))
{
@ -56,6 +102,17 @@ GuiTabularCreate::GuiTabularCreate(GuiView & lv)
bc().setApply(buttonBox->button(QDialogButtonBox::Apply));
bc().setCancel(buttonBox->button(QDialogButtonBox::Cancel));
bc().setValid(isValid());
// Fill styles combo
styleCO->addItem(qt_("Default"), toqstr("default"));
getFiles();
}
void GuiTabularCreate::on_styleCO_activated(int i)
{
style_ = styleCO->itemData(i).toString();
changed();
}
@ -82,6 +139,7 @@ bool GuiTabularCreate::initialiseParams(string const &)
{
params_.first = 5;
params_.second = 5;
style_ = styleCO->itemData(styleCO->currentIndex()).toString();
return true;
}
@ -95,12 +153,23 @@ void GuiTabularCreate::clearParams()
void GuiTabularCreate::dispatchParams()
{
string const sdata =
convert<string>(params().first) + ' ' + convert<string>(params().second);
string sdata;
if (style_ != "default")
sdata = fromqstr(style_) + ' ';
sdata += convert<string>(params().first) + ' ' + convert<string>(params().second);
dispatch(FuncRequest(getLfun(), sdata));
}
FuncCode GuiTabularCreate::getLfun() const
{
if (style_.isEmpty() || style_ == "default")
return LFUN_TABULAR_INSERT;
return LFUN_TABULAR_STYLE_INSERT;
}
Dialog * createGuiTabularCreate(GuiView & lv)
{
return new GuiTabularCreate(lv);

View File

@ -31,6 +31,7 @@ public:
private Q_SLOTS:
void columnsChanged(int);
void rowsChanged(int);
void on_styleCO_activated(int);
private:
/// Apply changes
@ -44,16 +45,20 @@ private:
///
bool isBufferDependent() const { return true; }
///
FuncCode getLfun() const { return LFUN_TABULAR_INSERT; }
FuncCode getLfun() const;
///
typedef std::pair<size_t, size_t> rowsCols;
///
rowsCols & params() { return params_; }
///
void getFiles();
private:
/// rows, cols params
rowsCols params_;
///
QString style_;
};
} // namespace frontend

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>374</width>
<height>298</height>
<height>339</height>
</rect>
</property>
<property name="windowTitle">
@ -88,6 +88,12 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
@ -108,6 +114,30 @@
</widget>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="styleLA">
<property name="text">
<string>&amp;Style:</string>
</property>
<property name="buddy">
<cstring>styleCO</cstring>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="styleCO">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>