Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 01b1d8ff

Von Marei (peiTeX) vor etwa 4 Jahren hinzugefügt

  • ID 01b1d8ff18f2089bd97c360fdf708a7d712f38d7
  • Vorgänger 04ad5930
  • Nachfolger c05124af

marei: reimplement PricingTabular with tcolorbox

Unterschiede anzeigen:

templates/print/marei/kiviletter.sty
59 59
\bool_new:N \l_kivi_tmp_bool
60 60
\bool_new:N  \g_kivi_TableFoot_bool
61 61
\dim_new:N \g_kivi_orig@textheight_dim
62
\int_new:N \g_PricingTabular_firstpage_int
63 62
\ExplSyntaxOff
64 63

  
65 64
\newsavebox{\shippingAddressBox}
......
74 73

  
75 74

  
76 75
\ExplSyntaxOn
77
\DeclareNewLayer[
78
foreground,
79
mode=picture,
80
hoffset=\g_kivi_margin_dim,
81
voffset=\g_kivi_margin_dim,
82
align=tl,
83
height=\box_ht:N \g_kivi_LT@head_box,
84
contents={\box_use:N \g_kivi_LT@head_box},
85
]{kivitendo.TableHead}
86

  
87

  
88
\DeclareNewLayer[
89
foreground,
90
textarea,
91
mode=picture,
92
voffset=\dim_eval:n {\paperheight-\g_kivi_margin_dim},
93
height=\box_ht:N \g_kivi_LT@foot_box,
94
contents=\bool_if:NT \g_kivi_TableFoot_bool {\box_use:N \g_kivi_LT@foot_box},
95
align=bl,
96
]{kivitendo.TableFoot}
97

  
98 76
\AtBeginLetter{\dim_gset:Nn \g_kivi_orig@textheight_dim {\textheight}}
99 77
\ExplSyntaxOff
100 78

  
......
143 121

  
144 122
\newcolumntype{P}{>{\raggedleft\arraybackslash}p{\g_kivi_tab_price_dim}<{\,\currency}}
145 123

  
146
%\if@kivi@faketable
147 124
\RequirePackage{tcolorbox}
148 125
\tcbuselibrary{breakable, skins}
126

  
127
\tcb@new@skin{kivi@LT}{base@unbroken,%
128
	frame~engine=empty,interior~titled~engine=empty,interior~engine=empty,segmentation~engine=empty,title~engine=empty,%
129
	skin~first=kivi@LT@first,skin~middle=kivi@LT@middle,skin~last=kivi@LT@last,
130
	underlay~first~and~middle={
131
		\node[anchor=north]  at (interior.north)  {\csname box_use:c\endcsname  {g_kivi_LT@head_box}};
132
		\node[anchor=south]  at (interior.south)  {\csname box_use:c\endcsname  {g_kivi_LT@foot_box}};
133
	},
134
	underlay~unbroken~and~last={
135
	\node[anchor=north]  at (interior.north)  {\csname box_use:c\endcsname  {g_kivi_LT@head_box}};
136
	},
137
	boxsep=0pt,
138
	boxrule=0pt,
139
	left=0pt,
140
	right=0pt,
141
	bottom=\box_ht:N  \g_kivi_LT@foot_box+\box_dp:N  \g_kivi_LT@foot_box,
142
	top=\box_ht:N  \g_kivi_LT@head_box+\box_dp:N  \g_kivi_LT@head_box,
143
	parbox=false,
144
}
145

  
146
\tcb@new@skin{kivi@LT@first}{base@first,%
147
	frame~engine=empty,interior~titled~engine=empty,interior~engine=empty,segmentation~engine=empty,title~engine=empty,%
148
	skin~first=kivi@LT@first,skin~middle=kivi@LT@middle,skin~last=kivi@LT@middle,
149
}
150

  
151
\tcb@new@skin{kivi@LT@middle}{base@middle,%
152
	frame~engine=empty,interior~titled~engine=empty,interior~engine=empty,segmentation~engine=empty,title~engine=empty,%
153
	skin~first=kivi@LT@middle,skin~middle=kivi@LT@middle,skin~last=kivi@LT@middle,
154
}
155

  
156
\tcb@new@skin{kivi@LT@last}{base@last,%
157
	frame~engine=empty,interior~titled~engine=empty,interior~engine=empty,segmentation~engine=empty,title~engine=empty,%
158
	skin~first=kivi@LT@middle,skin~middle=kivi@LT@middle,skin~last=kivi@LT@last,
159
}
160

  
161
\tcbset{kivi@LT/.style={skin=kivi@LT}}%
162

  
163

  
164

  
149 165
\seq_new:N \l_kivi_PricingTable_seq
150 166
\seq_new:N \g_kivi_extraDescription_seq
151 167
\newcommand{\FakeTable}[1]{
......
187 203
	\box_new:c {g_kivi_LT@#1_box}
188 204
}
189 205

  
190
\AtBeginDocument{
191
	\csname kivi_setup_LT_boxes:\endcsname
192
	\geometry{a4paper,
193
		hmargin=\g_kivi_margin_dim,
194
		top=\dim_eval:n {\g_kivi_margin_dim + \box_ht:N \g_kivi_LT@head_box},
195
		bottom=\dim_eval:n {\g_kivi_margin_dim + \box_ht:N \g_kivi_LT@foot_box},
196
		heightrounded}
197
	\savegeometry{kivi.letter@table}
198
	\loadgeometry{kivi.letter@default}
199
}
200 206

  
201 207
\cs_new:Nn \kivi_setup_LT_boxes: {
202 208
	\CalcTabCols
......
268 274
	\endxltabular
269 275
}
270 276

  
271

  
272
\usepackage{afterpage}
273

  
274
\cs_new:cpn {PricingTabular*}{
277
\newenvironment{PricingTabular*}[1][]{
275 278
	\bool_gset_true:N \g_kivi_inTable_bool
276
	\endgroup
277
	\@nameuse{Gm@restore@@kivi.letter@table}%
278
	\Gm@changelayout
279
	\begingroup
280
	\def \@currenvir {PricingTabular*}\edef \@currenvline {\on@line }
281
	\int_gset:Nn \g_PricingTabular_firstpage_int {\c@page}
282
	\addtolength{\vsize}{-\box_ht:N \g_kivi_LT@foot_box}
283
	\pagegoal\vsize
284
	\widowpenalty0
285
	\clubpenalty0
286
	\bool_gset_true:N \g_kivi_TableFoot_bool
287
	\pagestyle{kivitendo.letter.PricingTable}
288
	\leavevmode\box_use:N \g_kivi_LT@head_box
289
	\par\nointerlineskip\ignorespaces
290
}
279
	\tl_if_empty:nF {#1} {\keys_set:nn {kivi/PricingTable} {#1}}
280
	\__kivi_setup_LT_boxes:
281
	\__kivi_setup_FakeTable:
282
	\PricingTabularBox\ignorespaces
283
}{\endPricingTabularBox}
291 284

  
292
\cs_new:cpn {endPricingTabular*} {
293
	\int_compare:nNnF \g_PricingTabular_firstpage_int = \c@page {\thispagestyle{kivitendo.letter.PricingTable}}
294
	\bool_gset_false:N \g_kivi_TableFoot_bool
295
	\@nameuse{Gm@restore@@kivi.letter@default}
296
	\Gm@changelayout
297
	\bool_gset_true:N \g_kivi_restore_geometry_bool
298
	\afterpage{
299
		\kivi_conditional_restore_geometry:
300
	}
301
}
302

  
303
\cs_new:Nn \kivi_conditional_restore_geometry: {
304
	\bool_if:NT \g_kivi_restore_geometry_bool
305
	{
306
	\@nameuse{Gm@restore@@kivi.letter@default}
307
	\Gm@changelayout
308
	}
309
	\bool_gset_false:N \g_kivi_restore_geometry_bool
310
}
285
\newtcolorbox{PricingTabularBox}{breakable,skin=kivi@LT}
311 286

  
312 287

  
313 288

  

Auch abrufbar als: Unified diff