%% This is file `beamerinnerthemeTUDa2023.sty' version 3.39 (2024-06-27),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
%%
%%  Copyright (C) 2018--2024 by Marei Peischl <marei@peitex.de>
%%
%% ============================================================================
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%% http://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2008/05/04 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%%
%% The Current Maintainers of this work are
%%   Marei Peischl <tuda-ci@peitex.de>
%%
%% The development respository can be found at
%% https://github.com/tudace/tuda_latex_templates
%% Please use the issue tracker for feedback!
%%
%% ============================================================================
%%
\NeedsTeXFormat{LaTeX2e}[2022/10/01]
\ProvidesExplPackage{beamerinnerthemeTUDa2023}{2024-04-21}{3.37}{Inner~beamer~theme~of~tuda-ci,~Design~of~2023}

\mode<presentation>

\RequirePackage{beamerinnerthemeTUDa}

\ExplSyntaxOff
\RequirePackage{multicol}
\ExplSyntaxOn

\AddToHook{begindocument}[ptxcd-titlegraphic]{
	\dim_set:Nn \l__ptxcd_titlegraphic_ht_dim {\paperheight}
	\dim_set:Nn \l__ptxcd_titlegraphic_wd_dim {\paperwidth}
}

\defbeamertemplate*{titlegraphic}{TUDa2023}{{
			\def\width{\l__ptxcd_titlegraphic_wd_dim}
			\def\height{\l__ptxcd_titlegraphic_ht_dim}
			\usebeamercolor[fg]{titlegraphic}\inserttitlegraphic\par
		}}

\def\ps@titlegraphic@titlepage{%
	\setbeamertemplate{background}{\usebeamertemplate{titlegraphic}}
	\@nameuse{ps@navigation}%
}

\defbeamertemplate*{title~page}{TUDa2023}[1][]
{
	\ifbeamer@plainframe
		\skip_vertical:n {\dimexpr\paperheight/38- \beamer@frametopskip}%
		\color{red}
		\hspace*{\fill}
		\raisebox{\dimexpr-\height+.33\c_ptxcd_logoheight_dim}{\includegraphics[height=\dim_use:N \c_ptxcd_logoheight_dim]{tuda_logo}}\hspace*{\dimexpr.7pt-\beamer@rightmargin}
		\par
		\vskip1.39\baselineskip
	\fi
	\vbox{}
	\thispagestyle{titlegraphic@titlepage}
	\vskip.185\paperheight
	\begingroup
	\centering
	\usebeamertemplate{title}
	%    \vskip1em\par
	\bool_if:NT \g_ptxcd_authorontitle_bool {
		\usebeamertemplate{author}
		\usebeamertemplate{institute}
	}
	\usebeamertemplate{date}
	\endgroup
	\vfill
}

\defbeamertemplate*{title}{TUDa2023}[1][]{%
	\begin{beamercolorbox}[sep=8pt,center,#1]{title}
		\usebeamerfont{title}\text_uppercase:n {\inserttitle}\par%
		\ifx\insertsubtitle\@empty%
		\else%
			\vskip.45em%
			{\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}%
		\fi%
	\end{beamercolorbox}%
}

\defbeamertemplate{author}{TUDa2023}[1][]{%
	\begin{beamercolorbox}[sep=8pt,center,#1]{author}
		\usebeamerfont{author}\insertauthor
	\end{beamercolorbox}
}

\defbeamertemplate{institute}{TUDa2023}[1][]{%
	\begin{beamercolorbox}[sep=8pt,center,#1]{institute}
		\usebeamerfont{institute}\insertinstitute
	\end{beamercolorbox}
}

\defbeamertemplate{date}{TUDa2023}[1][]{%
	\begin{beamercolorbox}[sep=8pt,center,#1]{date}
		\usebeamerfont{date}\insertdate
	\end{beamercolorbox}
}

% partner/sub logo
\box_new:N  \g__ptxcd_partnerlogo_box
\dim_new:N \l__ptxcd_partnerlogo_ht_dim
\dim_gset:Nn \l__ptxcd_partnerlogo_ht_dim {.6\c_ptxcd_logoheight_dim}
\dim_new:N \l__ptxcd_partnerlogo_wd_dim
\dim_gset:Nn \l__ptxcd_partnerlogo_wd_dim {1.6\c_ptxcd_logoheight_dim}

\box_new:N  \g__ptxcd_sublogo_box
\dim_new:N \l__ptxcd_sublogo_wd_dim
\dim_gset:Nn \l__ptxcd_sublogo_wd_dim {2.2\c_ptxcd_logoheight_dim}
\dim_new:N \l__ptxcd_sublogo_ht_dim
\dim_gset:Nn  \l__ptxcd_sublogo_ht_dim {.6\c_ptxcd_logoheight_dim}

\cs_new:Nn \__ptxcd_setup_logo_box:nnn {
	\begingroup
	\def\width{\use:c {l__ptxcd_#2_wd_dim}}
	\def\height{\use:c {l__ptxcd_#2_ht_dim}}
	\IfBooleanTF{#1}{
		\hbox_gset:cn {g__ptxcd_#2_box} {#3}
		\box_gautosize_to_wd_and_ht_plus_dp:cnn  {g__ptxcd_#2_box} {\width} {\height}
	} {
		\hbox_gset:cn {g__ptxcd_#2_box} {
			#3
		}
	}
	\endgroup
}

\NewDocumentCommand{\partnerlogo}{sm}{
	\__ptxcd_setup_logo_box:nnn {#1} {partnerlogo} {#2}
}

\NewDocumentCommand{\sublogo}{sms}{
	\__ptxcd_setup_logo_box:nnn {#1} {sublogo} {#2}
	\IfBooleanT{#3}{
		\hbox_gset:Nn \g__ptxcd_sublogo_box {
			\hbox_unpack_drop:N \g__ptxcd_sublogo_box
			\hskip.6\l__ptxcd_sublogo_ht_dim
		}
	}
}

% section page
\defbeamertemplate*{section~page}{TUDa2023}[1][]
{%
	\ifbeamer@inframe
		\begingroup
		\vbox{}
		\vspace{0pt plus 1 filll}
		\begin{beamercolorbox}[#1]{section title}
			\usebeamerfont{section~title}\text_uppercase:n {\secname}\par
		\end{beamercolorbox}
		{\usebeamerfont{section~name}\usebeamercolor[fg]{section~name}\sectionname{}~\insertsectionnumber}
		\par
		\skip_vertical:n {\c_ptxcd_logoheight_dim+\baselineskip}
		\endgroup
	\else
		\begin{frame}[b]
			\begin{beamercolorbox}[#1]{section title}
				\usebeamerfont{section~title}\text_uppercase:n {\secname}\par
			\end{beamercolorbox}
			{\usebeamerfont{section~name}\usebeamercolor[fg]{section~name}\sectionname{}~\insertsectionnumber}
			\skip_vertical:n {\c_ptxcd_logoheight_dim+\baselineskip}
		\end{frame}
	\fi
}

% toc
% original definition can be found in beamerbasetoc.sty which is part of the beamer package
% Copyright 2003--2007 by Till Tantau
% Copyright 2010 by Vedran Mileti\'c
% Copyright 2012,2013,2015 by Vedran Mileti\'c, Joseph Wright
% Copyright 2017,2018 by Louis Stuart, Joseph Wright
% Copyright 2021 by Joseph Wright, samcarter
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% See the file LICENSE.md for more details.
\ExplSyntaxOn
\cs_new:Nn \__ptxcd_toc_check: {
\int_compare:nNnT {\g__ptxcd_beamer_toc_col_int}  = {3} {
% if all subsections/subsubsections are hidden we can have two columns
\str_if_eq:eeTF	{
\beamer@toc@css
\beamer@toc@oss
\beamer@toc@ooss
\beamer@toc@csss
\beamer@toc@osss
\beamer@toc@oosss
\beamer@toc@ooosss
}{
\prg_replicate:nn {7} {hide}
}{
% if all subsections/subsubsections are hidden standard twocolumn layout will be choosen
\int_set:Nn \g__ptxcd_beamer_toc_col_int {2}
} {
% check if there are subsections/subsubsections
\int_gzero:N \g_tmpa_int
{\makeatletter%%
	\let\babel@toc\use_none:nn
	\let\beamer@sectionintoc \use_none:nnnnn
	\def\beamer@subsectionintoc##1##2##3##4##5##6{\int_gset:Nn  \g_tmpa_int {1}\endinput}
	\def\beamer@subsubsectionintoc##1##2##3##4##5##6##7{\int_gset:Nn  \g_tmpa_int  {1}\endinput}
	\@input{\jobname.toc}%
}
\int_compare:nNnT {\g_tmpa_int} = {1} {\int_set:Nn \g__ptxcd_beamer_toc_col_int {1}}
}
}
}

\def\beamer@twocoltableofcontents[#1]{%
	\begin{beamercolorbox}[wd=\paperwidth]{}%
		\def\beamer@toc@cs{show}%
		\def\beamer@toc@os{show}%
		\def\beamer@toc@css{show}%
		\def\beamer@toc@oss{show}%
		\def\beamer@toc@ooss{show}%
		\def\beamer@toc@csss{show}%
		\def\beamer@toc@osss{show}%
		\def\beamer@toc@oosss{show}%
		\def\beamer@toc@ooosss{show}%
		\beamer@showpartnumber=\c@part%
		\beamer@pausesectionsfalse%
		\beamer@pausesubsectionsfalse%
		\def\beamer@tocsections{<*>}%
		\setkeys{beamertoc}{firstsection=1}%
		\setkeys{beamertoc}{#1}%
		\UseName{__ptxcd_toc_check:}
		\int_compare:nNnT {\g__ptxcd_beamer_toc_col_int} > {1} {
				\setlength{\columnsep}{5ex}%
				\raggedcolumns
				\begin{multicols}{2}
					}
					{\makeatletter%
					\pause[0]%
					\@input{\jobname.toc}%
					}%
					\int_compare:nNnT {\g__ptxcd_beamer_toc_col_int} > {1} {
				\end{multicols}%
			}
	\end{beamercolorbox}%
	\vspace*{.68\baselineskip}%}
}

\define@key{beamertoc}{columns}{\keys_set:nn {ptxcd/beamer/inner} {toc-columns=#1}}

\def\beamer@tableofcontents[#1]{%
	\ifbeamer@inframe
		\beamer@twocoltableofcontents[#1]
	\else
		\begin{frame}[b]{\contentsname}
			\beamer@twocoltableofcontents[#1]
		\end{frame}
	\fi
}



\defbeamertemplate*{section~in~toc}{TUDa}{%
	\ifvmode\nointerlineskip\fi
	\leavevmode
	\ifnum\beamer@tempcount>\beamer@toclastsection
	\else
		\ifnum\beamer@tempcount>0\relax
			\usebeamertemplate***{toc~section~number}%
		\fi\fi%
	\usebeamertemplate***{section~entry}%
	\par
}


% (sub-)section in toc: default
\cs_new:Nn \__ptxcd_toc_sub_level_entry_numbered:n {
	\exp_args:Nc \tl_if_blank:nF {inserttoc#1subsectionnumber}
	{\hphantom{0}\llap{\use:c {inserttoc#1subsectionnumber}}\hspace{.5em}}
}

\cs_new:Nn \__ptxcd_toc_sub_level_entry_itemize:n {
	\strut
	\usebeamertemplate{itemize~#1item}\hspace{.5em}
}

\defbeamertemplate*{subsection~in~toc}{TUDa}[1][false]{\leavevmode
	\leftskip=12.4mm
	\use:c {__ptxcd_toc_sub_level_entry_#1:n} {}
	\inserttocsubsection\par}

\defbeamertemplate*{subsubsection~in~toc}{TUDa}[1][false]{\leavevmode
	\leftskip=\dimexpr12.4mm+.5em\relax
	\use:c {__ptxcd_toc_sub_level_entry_#1:n} {sub}
	\inserttocsubsubsection\par}


\defbeamertemplate*{toc~section~number}{TUDa}{
	\hphantom{00}\llap{\inserttocsectionnumber}\hspace{.5em}
}

\defbeamertemplate*{section~entry}{TUDa}{
	\strut\inserttocsection\strut
}


%Itemize Items
\defbeamertemplate*{itemize~item}{TUDa}{\raise.2\baselineskip\hbox{\vrule width .5ex height .5ex}}
\defbeamertemplate*{itemize~subitem}{TUDa}{\raise.2\baselineskip\hbox{\small\vrule width .5ex height .5ex}}
\defbeamertemplate*{itemize~subsubitem}{TUDa}{\raise.2\baselineskip\hbox{\small\vrule width .5ex height 1ex}}

\mode<all>

\endinput

