% Copyright (c) 2013-26 Stephane GALLAND <galland@arakhne.org>
%
% UTBM logo and name are registered and owned by the
% "Universite de Technologie de Belfort-Montbeliard".
%
% UBE logo and name are registered and owned by the
% "Universite Bourgogne Europe".
%
% CIAD logo and name are registered and owned by the
% "Laboratoire Connaissance et Intelligence Artificielle Distribuées".
% 
% This program is free library; you can redistribute it and/or modify
% it under the terms of the GNU Lesser General Public License as
% published by the Free Software Foundation; either version 3 of the
% License, or any later version.
%
% This library is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
% Lesser General Public License for more details.
%
% You should have received a copy of the GNU Lesser General Public
% License along with this library; see the file COPYING.  If not,
% write to the Free Software Foundation, Inc., 59 Temple Place - Suite
% 330, Boston, MA 02111-1307, USA.
%
\ProvidesPackage{beamerthemeCIAD}[2026/04/20]

\RequirePackage{ifthen}

\newboolean{beamer@theme@ciad@hascovers}
\setboolean{beamer@theme@ciad@hascovers}{true}

\newif\ifbeamer@theme@ciad@oraldefensetitlepage
\beamer@theme@ciad@oraldefensetitlepagefalse

\newif\ifbeamer@theme@ciad@conferencepresentationtitlepage
\beamer@theme@ciad@conferencepresentationtitlepagefalse

\gdef\beamer@theme@ciad@lang{Java}

\DeclareOptionBeamer{language}{\gdef\beamer@theme@ciad@lang{#1}}
\DeclareOptionBeamer{nocover}{\setboolean{beamer@theme@ciad@hascovers}{false}}
\DeclareOptionBeamer{oraldefense}{\global\beamer@theme@ciad@oraldefensetitlepagetrue}
\DeclareOptionBeamer{conferencepresentation}{\global\beamer@theme@ciad@conferencepresentationtitlepagetrue}
%\ExecuteOptionsBeamer{left}
\ProcessOptionsBeamer

\RequirePackage{beamerbasethemeCIAD}

\mode<presentation>

\usefonttheme{CIAD}
\usecolortheme{CIAD}
\useinnertheme[language=\beamer@theme@ciad@lang]{CIAD}
\useinnertheme{default}
\useoutertheme{CIAD}

\ifbeamer@theme@ciad@oraldefensetitlepage%
	\message{Loading the "Oral Defense" title page}
	\RequirePackage{beamerodtpthemeCIAD}
\fi

\ifbeamer@theme@ciad@conferencepresentationtitlepage%
	\message{Loading the "Conference Presentation" title page}
	\RequirePackage{beamercptpthemeCIAD}
\fi

\setbeamercovered{dynamic}

\AtBeginDocument{
	\ifthenelse{\boolean{beamer@theme@ciad@hascovers}}{%
		\usebackgroundtemplate{} % do not put a background here because of a rendering bug of beamer. See "title page" template insteed.
		\frame{\maketitle}
	}{}
	\usebackgroundtemplate{\ifbeamer@plainframe\else%
		\providecommand{\beamer@theme@ciad@outer@background}{}%
		\beamer@theme@ciad@outer@background%
	\fi}%
	\setbeamertemplate{footline}{%
		\providecommand{\beamer@theme@ciad@outer@footline}{}%
		\beamer@theme@ciad@outer@footline}%
}

\AtEndDocument{%
	\ifthenelse{\boolean{beamer@theme@ciad@hascovers}}{%
		\providecommand{\beamer@theme@ciad@thanksslide}{}%
		\beamer@theme@ciad@thanksslide%
	}{}
}


\mode
<all>
