% Copyright 2021 by Jan Benda
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.

\ProvidesPackage{beamerthemelines}[2021/02/28 beamer theme with horizontal lines]

\RequirePackage{tikz}
\RequirePackage{pifont}

\newif\if@beamer@footline@author
\newif\if@beamer@footline@institute
\newif\if@beamer@footline@date
\newif\if@beamer@footline@title
\newif\if@beamer@footline@page
\newif\if@beamer@footline@logo

\DeclareOptionBeamer{author}{\@beamer@footline@authortrue}
\DeclareOptionBeamer{hideauthor}{\@beamer@footline@authorfalse}
\DeclareOptionBeamer{institute}{\@beamer@footline@institutetrue}
\DeclareOptionBeamer{hideinstitute}{\@beamer@footline@institutefalse}
\DeclareOptionBeamer{date}{\@beamer@footline@datetrue}
\DeclareOptionBeamer{hidedate}{\@beamer@footline@datefalse}
\DeclareOptionBeamer{title}{\@beamer@footline@titletrue}
\DeclareOptionBeamer{hidetitle}{\@beamer@footline@titlefalse}
\DeclareOptionBeamer{page}{\@beamer@footline@pagetrue}
\DeclareOptionBeamer{hidepage}{\@beamer@footline@pagefalse}
\DeclareOptionBeamer{logo}{\@beamer@footline@logotrue}
\DeclareOptionBeamer{hidelogo}{\@beamer@footline@logofalse}

\ExecuteOptionsBeamer{author}
\ExecuteOptionsBeamer{hideinstitute}
\ExecuteOptionsBeamer{hidedate}
\ExecuteOptionsBeamer{hidetitle}
\ExecuteOptionsBeamer{page}
\ExecuteOptionsBeamer{hidelogo}

\ProcessOptionsBeamer

%%%%% \titlelogo command:

\mode<all>{
  \newcommand\titlelogo[1]{\def\inserttitlelogo{#1}}
  \titlelogo{}
}


\mode<presentation>

% margins:
\setbeamersize{text margin left=1.5ex,text margin right=1.5ex}

% no navigation symbols:
\defbeamertemplate{navigation symbols}{empty}{}
\setbeamertemplate{navigation symbols}[empty]

% no side bars:
\setbeamertemplate{sidebar left}[default]

\defbeamertemplate{sidebar right}{empty}{}
\setbeamertemplate{sidebar right}[empty]

% no headline:
\setbeamertemplate{headline}[default]

%%%%% horizontal line %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% a horizontal line on top of a box over the whole linewidth
% arguments: name of color theme, width of line
\newcommand{\beamer@horizontal@line@top}[2]{%
  \ifbeamercolorempty[fg]{#1}{}{%
    \begin{beamercolorbox}[vmode]{#1}
      \rule{\linewidth}{#2}
    \end{beamercolorbox}%
    \par\nointerlineskip}%
}

% a horizontal line below a box over the whole linewidth
% arguments: name of color theme, width of line
\newcommand{\beamer@horizontal@line@bottom}[2]{%
  \ifbeamercolorempty[fg]{#1}{}{%
    \par\nointerlineskip%
    \begin{beamercolorbox}[vmode]{#1}
      \rule{\linewidth}{#2}
    \end{beamercolorbox}}%
}

%%%%% page numbers %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\defbeamertemplate{page number in head/foot}{frames}{%
  {\usebeamerfont{page number in head/foot}%
    \makebox[2.5ex][r]{\insertframenumber{}}}}
\defbeamertemplate{page number in head/foot}{framestotal}{%
  {\usebeamerfont{page number in head/foot}%
    \makebox[6ex][r]{\insertframenumber{} / \inserttotalframenumber{}}}}
\defbeamertemplate{page number in head/foot}{slides}{%
  {\usebeamerfont{page number in head/foot}%
    \makebox[2.5ex][r]{\insertframenumber{} } %
    \newcount{\c@tmp@numslides}%
    \c@tmp@numslides=\numexpr\beamer@endpageofframe-\beamer@startpageofframe\relax%
    \makebox[2.5ex][r]{\ifnum\c@tmp@numslides>0 -- \insertslidenumber{}\fi}}}

\setbeamertemplate{page number in head/foot}[frames]


%%%%% footline %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%% footline line:

\defbeamertemplate{footline line}{text}[1][1pt]%
{
  \ifbeamercolorempty[fg]{footline line}{}{%
    \begin{beamercolorbox}[wd=\paperwidth,dp=0pt,ht=#1,sep=0pt,%
      leftskip=\beamer@leftmargin,rightskip=\beamer@rightmargin]{footline line}%
      \rule{\columnwidth}{#1}%
    \end{beamercolorbox}%
    \nointerlineskip%
  }%
}
\defbeamertemplate{footline line}{page}[1][1pt]%
{
  \ifbeamercolorempty[fg]{footline line}{}{%
    \begin{beamercolorbox}[wd=\paperwidth,dp=0pt,ht=#1,sep=0pt,%
      leftskip=0pt,rightskip=0pt]{footline line}%
      \rule{\paperwidth}{#1}%
    \end{beamercolorbox}%
    \nointerlineskip%
  }%
}

\setbeamertemplate{footline line}[text][0.5pt]


%%%%% footline separator:

\defbeamertemplate{footline separator}{text}[1][1pt]{%
  {\usebeamercolor[fg]{footline separator}\enspace\rule[-0.55ex]{#1}{2.3ex}\thickspace}}
\defbeamertemplate{footline separator}{full}[1][1pt]{%
  {\usebeamercolor[fg]{footline separator}\enspace\rule[-1.2ex]{#1}{4ex}\thickspace}}
\defbeamertemplate{footline separator}{dash}{%
  {\usebeamercolor[fg]{footline separator}\thickspace{} ---\thickspace}}
\defbeamertemplate{footline separator}{space}{%
  {\usebeamercolor[fg]{footline separator}\enspace\thickspace}}

\setbeamertemplate{footline separator}[text][0.5pt]


%%%%% footline: linesleft

\defbeamertemplate{footline}{linesleft}{%
  \usebeamerfont{footline}%
  \usebeamertemplate{footline line}%
  \begin{beamercolorbox}[wd=1\paperwidth,dp=1.2ex,ht=2.8ex,sep=0pt,colsep=0pt,colsep*=0pt,%
    leftskip=1\beamer@leftmargin,rightskip=1\beamer@rightmargin]{footline}
    \hypersetup{linkcolor=}%
    \newif\if@tempsep%
    \@tempsepfalse%
    % author:
    \if@beamer@footline@author
      {\usebeamerfont{author in head/foot}%
        \insertshortauthor}%
      \@tempseptrue
    \fi
    % institute:
    \if@beamer@footline@institute
      \if@tempsep\usebeamertemplate{footline separator}\hskip0.6ex\fi
      {\usebeamerfont{institute in head/foot}%
        \insertshortinstitute}%
      \@tempseptrue
    \fi
    % date:
    \if@beamer@footline@date
      \if@tempsep\usebeamertemplate{footline separator}\hskip0.6ex\fi
      {\usebeamerfont{date in head/foot}%
        \insertshortdate}%
      \@tempseptrue
    \fi
    % title:
    \if@beamer@footline@title
      \if@tempsep\usebeamertemplate{footline separator}\hskip0.6ex\fi
      {\usebeamerfont{title in head/foot}%
        \insertshorttitle}%
      \@tempseptrue
    \fi
    \hfill
    % page:
    \if@beamer@footline@page
      \usebeamertemplate{footline separator}
      \usebeamertemplate{page number in head/foot}%
    \fi
    % logo:
    \if@beamer@footline@logo%
      \ifx\insertlogo\@empty\else\quad \raisebox{-1ex}{\insertlogo}\fi%
    \fi
  \end{beamercolorbox}
}


%%%%% footline: linesright

\defbeamertemplate{footline}{linesright}{%
  \usebeamerfont{footline}%
  \usebeamertemplate{footline line}%
  \begin{beamercolorbox}[wd=1\paperwidth,dp=1.2ex,ht=2.8ex,sep=0pt,colsep=0pt,colsep*=0pt,%
    leftskip=1\beamer@leftmargin,rightskip=1\beamer@rightmargin]{footline}
    \hypersetup{linkcolor=}%
    % page:
    \if@beamer@footline@page
      \usebeamertemplate{page number in head/foot}%
    \fi
    \hfill
    \newif\if@tempsep%
    \@tempsepfalse%
    % author:
    \if@beamer@footline@author
      {\usebeamerfont{author in head/foot}%
        \insertshortauthor}%
      \@tempseptrue
    \fi
    % institute:
    \if@beamer@footline@institute
      \if@tempsep\usebeamertemplate{footline separator}\hskip0.6ex\fi
      {\usebeamerfont{institute in head/foot}%
        \insertshortinstitute}%
      \@tempseptrue
    \fi
    % date:
    \if@beamer@footline@date
      \if@tempsep\usebeamertemplate{footline separator}\hskip0.6ex\fi
      {\usebeamerfont{date in head/foot}%
        \insertshortdate}%
      \@tempseptrue
    \fi
    % title:
    \if@beamer@footline@title
      \if@tempsep\usebeamertemplate{footline separator}\hskip0.6ex\fi
      {\usebeamerfont{title in head/foot}%
        \insertshorttitle}%
      \@tempseptrue
    \fi
    % logo:
    \if@beamer@footline@logo%
      \ifx\insertlogo\@empty\else\quad \raisebox{-1ex}{\insertlogo}\fi%
    \fi
  \end{beamercolorbox}
}

\setbeamertemplate{footline}[linesleft]


%%%%% frametitle %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%% frametitle line:

\defbeamertemplate{frametitle line}{text}[1][1pt]%
  {\beamer@horizontal@line@bottom{frametitle line}{#1}}
\defbeamertemplate{frametitle line}{page}[1][1pt]%
{
  \ifbeamercolorempty[fg]{frametitle line}{}{%
    \nointerlineskip%
    \begin{beamercolorbox}[wd=\paperwidth,dp=0pt,ht=#1,sep=0pt,%
      leftskip=0pt,rightskip=0pt]{frametitle line}%
      \rule{\paperwidth}{#1}%
    \end{beamercolorbox}%
  }%
}

\setbeamertemplate{frametitle line}[text][0.5pt]


%%%%% frametitle: boxline

\defbeamertemplate{frametitle}{boxline}%
{
  \ifbeamercolorempty[bg]{frametitle}{}{\nointerlineskip}%
  \usebeamerfont{frametitle}%
  \begin{beamercolorbox}[wd=1\paperwidth,dp=1.2ex,ht=3.2ex,sep=0pt,%
    leftskip=1\beamer@leftmargin,rightskip=1\beamer@rightmargin]{frametitle}
    \insertframetitle\strut
  \end{beamercolorbox}%
  \usebeamertemplate{frametitle line}%
  \ifx\insertframesubtitle\@empty\else%
    \vspace{-0.5ex}
    \begin{beamercolorbox}[wd=1\paperwidth,sep=0pt,%
      leftskip=1\beamer@leftmargin,rightskip=1\beamer@rightmargin]{framesubtitle}
      \usebeamerfont{framesubtitle}\insertframesubtitle\strut
    \end{beamercolorbox}%
  \fi%
  \vspace{-1ex}
}
\defbeamertemplate{frametitle}{boxlinelogo}%
{
  \ifbeamercolorempty[bg]{frametitle}{}{\nointerlineskip}%
  \usebeamerfont{frametitle}%
  \begin{beamercolorbox}[wd=1\paperwidth,dp=1.2ex,ht=3.2ex,sep=0pt,%
    leftskip=1\beamer@leftmargin,rightskip=1\beamer@rightmargin]{frametitle}
    \insertframetitle\strut%
    \ifx\insertlogo\@empty%
    \else%
    \hfill \raisebox{-0.7ex}{\insertlogo}%
    \fi%
  \end{beamercolorbox}%
  \usebeamertemplate{frametitle line}%
  \ifx\insertframesubtitle\@empty\else%
    \vspace{-0.5ex}
    \begin{beamercolorbox}[wd=1\paperwidth,sep=0pt,%
      leftskip=1\beamer@leftmargin,rightskip=1\beamer@rightmargin]{framesubtitle}
      \usebeamerfont{framesubtitle}\insertframesubtitle\strut
    \end{beamercolorbox}%
  \fi%
  \vspace{-1ex}
}

\setbeamertemplate{frametitle}[boxlinelogo]


%%%%% itemize and enumerate %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%% itemize symbols:

\newcommand{\itemarrow}{\tikz[baseline]{%
    \draw[line width=0.2ex] (0ex, 0.2ex) -- (0.45ex,0.7ex) -- (0ex, 1.2ex);}}
\newcommand{\itemfilledarrow}{\tikz[baseline]{%
    \filldraw[line width=0.2ex] (0ex, 0.2ex) -- (0.5ex,0.7ex) -- (0ex, 1.2ex) -- cycle;}}
\newcommand{\itemdash}{\tikz[baseline]{%
    \draw[line width=0.2ex] (0ex, 0.7ex) -- (0.9ex,0.7ex);}}
\newcommand{\checkit}{{\usebeamercolor[fg]{itemize item check}\ding{51}}} % or \checkmark
\newcommand{\uncheckit}{{\usebeamercolor[fg]{itemize item uncheck}\ding{55}}}

\defbeamertemplate{itemize item}{arrow}{\itemarrow}
\defbeamertemplate{itemize item}{filledarrow}{\itemfilledarrow}
\defbeamertemplate{itemize item}{dash}{\itemdash}
\defbeamertemplate{itemize item}{check}{\checkit}
\defbeamertemplate{itemize item}{uncheck}{\uncheckit}
\defbeamertemplatealias{itemize item}{emph}{filledarrow}
\defbeamertemplatealias{itemize item}{message}{arrow}

\defbeamertemplate{itemize subitem}{arrow}{\itemarrow}
\defbeamertemplate{itemize subitem}{dash}{\itemdash}
\defbeamertemplate{itemize subitem}{check}{\checkmark}

% default, triangle, circle, square, ball, arrow, dash, check, uncheck:
\setbeamertemplate{itemize item}[arrow]
\setbeamertemplate{itemize subitem}[dash]

%%%%% emph item:

\newenvironment{emphenv}{\only{\setbeamertemplate{itemize item}[emph]}}{}

%%%%% check item:

\newenvironment{checkenv}{\only{\setbeamertemplate{itemize item}[check]}}{}

%%%%% uncheck item:

\newenvironment{uncheckenv}{\only{\setbeamertemplate{itemize item}[uncheck]}}{}

%%%%% message like item:

\newenvironment{messageenv}{\only{\setbeamertemplate{itemize item}[message]\setbeamercolor{itemize item}{use={message item symbol},fg=message item symbol.fg}\usebeamerfont{message item}\usebeamercolor[fg]{message item}}}{}


%%%%% enumerate style:

\defbeamertemplate{enumerate item}{alph}{\alph{enumi})}
\defbeamertemplate{enumerate item}{Alph}{\Alph{enumi})}
\defbeamertemplate{enumerate item}{arabic}{\arabic{enumi}.}
\defbeamertemplate{enumerate item}{roman}{\roman{enumi}.}
\defbeamertemplate{enumerate item}{Roman}{\Roman{enumi}.}

\defbeamertemplate{enumerate subitem}{alph}{\alph{enumii})}
\defbeamertemplate{enumerate subitem}{arabic}{\arabic{enumii})}
\defbeamertemplate{enumerate subitem}{roman}{\roman{enumii})}

\setbeamertemplate{enumerate item}[arabic]  % default, circle, square, ball, alph, Alph, arabic, roman, Roman
\setbeamertemplate{enumerate subitem}[alph] % default, circle, square, ball, alph, arabic, roman


%%%%% block environments:

\newcommand{\block@lines@begin}[3]{%
  \par\vskip\medskipamount%
  \usebeamerfont{block title#1}%
  \setbox0=\hbox{\insertblocktitle\unskip}%   does not work for theorem?!
  \ifdim\wd0=0pt\else%
    \beamer@horizontal@line@top{block line#1 top}{#2}
    \begin{beamercolorbox}[wd=\linewidth,ht=2.4ex,dp=0.9ex,leftskip=2mm,rightskip=2mm]{block title#1}
      \strut\insertblocktitle
    \end{beamercolorbox}
  \fi
  \nointerlineskip
  \beamer@horizontal@line@top{block line#1 middle}{#3}
  \usebeamerfont{block body#1}%
  \begin{beamercolorbox}[wd=\linewidth,colsep=2mm]{block body#1}
 }

\newcommand{\block@lines@end}[2]{%
    \vspace{-0.4ex}%
  \end{beamercolorbox}%
  \beamer@horizontal@line@bottom{block line#1 bottom}{#2}
}

%%%%% block environment:

\defbeamertemplate{block begin}{lines}[2]{\block@lines@begin{}{#1}{#2}}
\defbeamertemplate{block end}{lines}[1]{\block@lines@end{}{#1}}

\setbeamertemplate{block begin}[lines]{0.5pt}{0.5pt}
\setbeamertemplate{block end}[lines]{0.5pt}


%%%%% block alerted environment:

\defbeamertemplate{block alerted begin}{lines}[2]{\block@lines@begin{ alerted}{#1}{#2}}
\defbeamertemplate{block alerted end}{lines}[1]{\block@lines@end{ alerted}{#1}}

\setbeamertemplate{block alerted begin}[lines]{0.5pt}{0.5pt}
\setbeamertemplate{block alerted end}[lines]{0.5pt}


%%%%% block example environment:

\defbeamertemplate{block example begin}{lines}[2]{\block@lines@begin{ example}{#1}{#2}}
\defbeamertemplate{block example end}{lines}[1]{\block@lines@end{ example}{#1}}

\setbeamertemplate{block example begin}[lines]{0.5pt}{0.5pt}
\setbeamertemplate{block example end}[lines]{0.5pt}


%%%%% theorem environments (theorem, corollary, fact, lemma, definition, example):

\newcommand{\theorem@lines@begin}[3]{%
  \par\vskip\medskipamount%
  \usebeamerfont{#1 title}%
  \beamer@horizontal@line@top{#1 line top}{#2}
  \begin{beamercolorbox}[wd=\linewidth,ht=2.4ex,dp=0.9ex,leftskip=2mm,rightskip=2mm]{#1 title}
    \strut \insertblocktitle
  \end{beamercolorbox}
  \nointerlineskip
  \beamer@horizontal@line@top{#1 line middle}{#3}
  \usebeamerfont{#1 body}%
  \begin{beamercolorbox}[wd=\linewidth,colsep=2mm]{#1 body}
 }

\newcommand{\theorem@lines@end}[2]{%
    \vspace{-0.4ex}%
  \end{beamercolorbox}%
  \beamer@horizontal@line@bottom{#1 line bottom}{#2}
}

\newenvironment<>{theoremblock}[1]{%
  \begin{actionenv}#2%
    \def\insertblocktitle{#1}%
    \par%
    \usebeamertemplate{block theorem begin}}
  {\par%
    \usebeamertemplate{block theorem end}%
  \end{actionenv}}

\renewcommand{\inserttheoremblockenv}{theoremblock}
\renewcommand{\inserttheoremheadfont}{}

\defbeamertemplate{block theorem begin}{lines}[2]{\theorem@lines@begin{theorem}{#1}{#2}}
\defbeamertemplate{block theorem end}{lines}[1]{\theorem@lines@end{theorem}{#1}}

\setbeamertemplate{block theorem begin}[lines]{0.5pt}{0.5pt}
\setbeamertemplate{block theorem end}[lines]{0.5pt}


%%%%% new message box command:

\defbeamertemplate{message symbol}{default}{}
\defbeamertemplate{message symbol}{circle}{\raisebox{0.1ex}{$\bullet$}}
\defbeamertemplate{message symbol}{arrow}{\itemarrow}

\setbeamertemplate{message symbol}[circle]

\newcommand{\message@box@body}{
  \begin{beamercolorbox}[vmode,colsep=1mm,leftskip=1mm,rightskip=1mm]{message}
    \setbox0=\hbox{\usebeamertemplate{message symbol}\unskip}%
    \ifdim\wd0=0pt%
      \strut\insertmessage
    \else
      \begin{list}
        {\usebeamercolor[fg]{message symbol}
          \usebeamertemplate{message symbol}}
        {\itemindent  0pt
          \labelwidth  1ex
          \labelsep    0.6ex
          \leftmargin  2.5ex
          \rightmargin 1mm}
      \item\relax\usebeamercolor[fg]{message}\relax
        \insertmessage
      \end{list}
      \vspace{-0.6ex}
    \fi
  \end{beamercolorbox}
}

\defbeamertemplate{message}{default}{%
  \par\vskip\medskipamount%
  \usebeamerfont{message}%
  \message@box@body
}

\defbeamertemplate{message}{lines}[2]{%
  \par\vskip\medskipamount%
  \usebeamerfont{message}%
  \beamer@horizontal@line@top{message line top}{#1}
  \message@box@body
  \beamer@horizontal@line@bottom{message line bottom}{#2}
}

\setbeamertemplate{message}[lines]{1pt}{1pt}

\newcommand<>{\messagebox}[1]{%
  \only#2{\def\insertmessage{#1}%
    \usebeamertemplate*{message}}
}


%%%%% verse, quotation, quote:

% font selection
% https://tex.stackexchange.com/questions/25249/how-do-i-use-a-particular-font-for-a-small-section-of-text-in-my-document
% pbk , phv, pnc, qcs
\newcommand{\openquote}[1][4]{\tikz[baseline]{%
    \useasboundingbox (0, 0) rectangle (1ex, 1.7ex);
    \node[scale=#1, xshift=-0.45ex, yshift=-0.73ex] at (current bounding box.north east) {\fontfamily{pbk}\selectfont\textquotedblleft};
}}

\def\insertquoteauthor{}
\newcommand{\quote@author@left}[1]{%
  \ifx\insertquoteauthor\@empty\else%
    \item[%
      \usebeamerfont{#1 author}%
      \usebeamercolor{#1 author}%
      \usebeamertemplate{#1 author separator}%
      \insertquoteauthor]%
  \fi}
\newcommand{\quote@author@right}[1]{%
  \ifx\insertquoteauthor\@empty\else%
    \par{}\hfill%
    \usebeamerfont{#1 author}%
    \usebeamercolor{#1 author}%
    \usebeamertemplate{#1 author separator}%
    \insertquoteauthor%
  \fi}
\newcommand{\quote@author@rightline}[1]{%
  \ifx\insertquoteauthor\@empty\else%
    \hfill%
    \usebeamerfont{#1 author}%
    \usebeamercolor{#1 author}%
    \usebeamertemplate{#1 author separator}%
    \insertquoteauthor%
  \fi}

% quotation environment

\defbeamertemplate{quotation symbol}{default}{}
\defbeamertemplate{quotation symbol}{quotes}[1][5]{\usebeamercolor[fg]{quotation symbol}\openquote[#1]}

\setbeamertemplate{quotation symbol}[quotes][4]

\defbeamertemplate{quotation author separator}{default}{}
\defbeamertemplate{quotation author separator}{dash}{ --- }

\setbeamertemplate{quotation author separator}[dash]

\defbeamertemplate{quotation author}{none}{}
\defbeamertemplate{quotation author}{left}{\quote@author@left{quotation}}
\defbeamertemplate{quotation author}{right}{\quote@author@right{quotation}}
\defbeamertemplate{quotation author}{rightline}{\quote@author@rightline{quotation}}

\setbeamertemplate{quotation author}[rightline]  % none, left, right, rightline

\defbeamertemplate{quotation begin}{none}{}
\defbeamertemplate{quotation begin}{lines}[1][1pt]{\beamer@horizontal@line@top{quotation line top}{#1}\vskip1ex}
\setbeamertemplate{quotation begin}[lines][0.5pt]

\defbeamertemplate{quotation end}{none}{}
\defbeamertemplate{quotation end}{lines}[1][1pt]{\beamer@horizontal@line@bottom{quotation line bottom}{#1}}
\setbeamertemplate{quotation end}[lines][0.5pt]

% see definition in /usr/share/texmf/tex/latex/beamer/base/beamerbaselocalstructure.sty 
\renewenvironment<>{quotation}[1][]
{ \def\insertquoteauthor{#1}
  \actionenv#2%
  \beamercolorbox[vmode]{quotation}
  \usebeamertemplate{quotation begin}
  \usebeamerfont*{quotation}%
  \usebeamercolor{quotation}%
  \setbox0=\hbox{\usebeamertemplate{quotation symbol}\unskip}%
  \ifdim\wd0=0pt
    \list{}{
      \leftmargin    1em
      \rightmargin   1em
      \listparindent 1.5em
      \itemindent    \listparindent
      \parsep        \z@ \@plus\p@
    }%
    \item\relax
  \else
    \list{}{
      \leftmargin    2.5em
      \rightmargin   2em
      \listparindent 1.5em
      \itemindent    \listparindent
      \labelsep      \listparindent
      \advance\labelsep by 1.5ex\relax
      \parsep        \z@ \@plus\p@
    }%
    \item[\usebeamertemplate{quotation symbol}]\relax
  \fi
}
{%
  \usebeamertemplate{quotation author}
  \endlist
  \usebeamertemplate{quotation end}
  \endbeamercolorbox
  \endactionenv%
}

% quote environment:

\defbeamertemplate{quote symbol}{default}{}
\defbeamertemplate{quote symbol}{quotes}[1][5]{\usebeamercolor[fg]{quote symbol}\openquote[#1]}

\setbeamertemplate{quote symbol}[quotes][4]

\defbeamertemplate{quote author separator}{default}{}
\defbeamertemplate{quote author separator}{dash}{ --- }

\setbeamertemplate{quote author separator}[dash]

\defbeamertemplate{quote author}{none}{}
\defbeamertemplate{quote author}{left}{\quote@author@left{quote}}
\defbeamertemplate{quote author}{right}{\quote@author@right{quote}}
\defbeamertemplate{quote author}{rightline}{\quote@author@rightline{quote}}

\setbeamertemplate{quote author}[rightline]  % none, left, right, rightline

\defbeamertemplate{quote begin}{none}{}
\defbeamertemplate{quote begin}{lines}[1][1pt]{\beamer@horizontal@line@top{quote line top}{#1}\vskip1ex}
\setbeamertemplate{quote begin}[lines][0.5pt]

\defbeamertemplate{quote end}{none}{}
\defbeamertemplate{quote end}{lines}[1][1pt]{\beamer@horizontal@line@bottom{quote line bottom}{#1}}
\setbeamertemplate{quote end}[lines][0.5pt]

\renewenvironment<>{quote}[1][]
{ \def\insertquoteauthor{#1}
  \actionenv#2%
  \beamercolorbox[vmode]{quote}%
  \usebeamertemplate{quote begin}%
  \usebeamerfont*{quote}%
  \usebeamercolor{quote}%
  \setbox0=\hbox{\usebeamertemplate{quote symbol}\unskip}%
  \ifdim\wd0=0pt
    \list{}{
      \leftmargin    1em
      \rightmargin   1em
      \parsep        1ex
    }%
    \item\relax%
  \else
    \list{}{
      \leftmargin    2.5em
      \rightmargin   2em
      \labelsep      1.5ex
      \parsep        1ex
    }%
    \item[\usebeamertemplate{quote symbol}]\relax%
  \fi%
}
{%
  \usebeamertemplate{quote author}
  \endlist
  \usebeamertemplate{quote end}
  \endbeamercolorbox%
  \endactionenv%
}

% verse environment:

\defbeamertemplate{verse begin}{none}{}
\defbeamertemplate{verse begin}{lines}[1][1pt]{\beamer@horizontal@line@top{verse line top}{#1}\vskip1ex}
\setbeamertemplate{verse begin}[lines][0.5pt]

\defbeamertemplate{verse end}{none}{}
\defbeamertemplate{verse end}{lines}[1][1pt]{\beamer@horizontal@line@bottom{verse line bottom}{#1}}
\setbeamertemplate{verse end}[lines][0.5pt]

\renewenvironment<>{verse}
{ \actionenv#1%
  \beamercolorbox[vmode]{verse}
  \usebeamertemplate{verse begin}
  \usebeamerfont*{verse}%
  \usebeamercolor{verse}%
  \list{}{
    \leftmargin    2em
    \rightmargin   2em
    \parsep        1ex
  }%
  \item\relax
}
{%
  \endlist
  \usebeamertemplate{verse end}
  \endbeamercolorbox
  \endactionenv%
}

%%%%% title page %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%% title page graphic line:

\defbeamertemplate{title page graphic line}{default}[1][1ex]%
  {\beamer@horizontal@line@bottom{title page graphic line}{#1}}

\setbeamertemplate{title page graphic line}[default][1.5ex]


%%%%% title page title line:

\defbeamertemplate{title page title line}{default}[1][1ex]%
  {\beamer@horizontal@line@bottom{title page title line}{#1}}

\setbeamertemplate{title page title line}[default][0.2ex]


%%%%% title page author \and command:

\defbeamertemplate{title page author and}{space}{\def\beamer@andtitle{\quad}}
\defbeamertemplate{title page author and}{comma}{\def\beamer@andtitle{,\quad}}
\defbeamertemplate{title page author and}{line}{\def\beamer@andtitle{\enspace$\vert$\enspace\thickspace}}
\defbeamertemplate{title page author and}{and}{\def\beamer@andtitle{\thickspace\&\enspace}}

\setbeamertemplate{title page author and}[line]


%%%%% title page institute \and command:

\defbeamertemplate{title page institute and}{default}{}
\defbeamertemplate{title page institute and}{space}{\def\beamer@andinst{\quad}}
\defbeamertemplate{title page institute and}{comma}{\def\beamer@andinst{,\quad}}
\defbeamertemplate{title page institute and}{line}{\def\beamer@andinst{\enspace$\vert$\enspace\thickspace}}

\setbeamertemplate{title page institute and}[line]


%%%%% title page: leftlines

\defbeamertemplate*{title page}{leftlines}
{
  \vbox{}
  % title logo with line:
  \ifx\inserttitlelogo\@empty\else%
    \begin{beamercolorbox}[wd=\linewidth]{titlelogo}
      \inserttitlelogo%
    \end{beamercolorbox}%
    \vspace{1.2ex}
    \usebeamertemplate{frametitle line}%
    \vspace{1ex}
  \fi
  % title graphic:
  \ifx\inserttitlegraphic\@empty\else%
    \begin{beamercolorbox}[wd=\linewidth]{titlegraphic}
      \inserttitlegraphic%
    \end{beamercolorbox}%
    \usebeamertemplate{title page graphic line}%
  \fi%
  \vfill\vfill\vfill
  % title:
  \begin{beamercolorbox}{title}
    \usebeamerfont{title}\inserttitle\par%
  \end{beamercolorbox}%
  % subtitle:
  \ifx\insertsubtitle\@empty\else%
    \vspace{1ex}
    \begin{beamercolorbox}{subtitle}
      \usebeamerfont{subtitle}\insertsubtitle\par%
    \end{beamercolorbox}%
  \fi%
  \vfill
  \usebeamertemplate{title page title line}%
  \vfill
  % author:
  \begin{beamercolorbox}{author}
    \usebeamertemplate{title page author and}%
    \usebeamerfont{author}\insertauthor
  \end{beamercolorbox}
  \vfill
  % institute and date:
  \begin{beamercolorbox}{institute}
    \usebeamertemplate{title page institute and}%
    \usebeamerfont{institute}\insertinstitute
    \hfill
    \usebeamerfont{date}\insertdate
  \end{beamercolorbox}
}


%%%%% title page: centerlines

\defbeamertemplate*{title page}{centerlines}
{
  \vbox{}
  % title logo with line:
  \ifx\inserttitlelogo\@empty\else%
    \begin{beamercolorbox}[wd=\linewidth,center]{titlelogo}
      \inserttitlelogo%
    \end{beamercolorbox}%
    \vspace{1.2ex}
    \usebeamertemplate{frametitle line}%
    \vspace{1ex}
  \fi
  % title graphic:
  \ifx\inserttitlegraphic\@empty\else%
    \begin{beamercolorbox}[wd=\linewidth,center]{titlegraphic}
      \inserttitlegraphic%
    \end{beamercolorbox}%
    \usebeamertemplate{title page graphic line}%
  \fi%
  \vfill\vfill\vfill
  % title:
  \begin{beamercolorbox}[center]{title}
    \usebeamerfont{title}\inserttitle\par%
  \end{beamercolorbox}%
  % subtitle:
  \ifx\insertsubtitle\@empty\else%
    \vspace{1ex}
    \begin{beamercolorbox}[center]{subtitle}
      \usebeamerfont{subtitle}\insertsubtitle\par%
    \end{beamercolorbox}%
  \fi%
  \vfill
  \usebeamertemplate{title page title line}%
  \vfill
  % author:
  \begin{beamercolorbox}[center]{author}
    \usebeamertemplate{title page author and}%
    \usebeamerfont{author}\insertauthor
  \end{beamercolorbox}
  \vfill
  % institute and date:
  \begin{beamercolorbox}[center]{institute}
    \usebeamertemplate{title page institute and}%
    \usebeamerfont{institute}\insertinstitute
    \hfill
    \usebeamerfont{date}\insertdate
  \end{beamercolorbox}
}

\setbeamertemplate{title page}[leftlines]


%%%%% section page %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% section page separator: space

\defbeamertemplate{section name separator}{space}{}

% section page separator: text

\defbeamertemplate{section name separator}{text}[1][1pt]%
{{\usebeamercolor[fg]{section name separator}\rule[-0.5ex]{#1}{2.4ex}}}

\setbeamertemplate{section name separator}[text][1pt]


%%%%% section page: left

\defbeamertemplate{section page}{left}[1][0.3\textheight]
{
  \vspace{#1}%
  \begin{columns}[t,onlytextwidth]
    \begin{column}{0.1\textwidth}
      \usebeamerfont{section name}%
      \raggedleft{\usebeamercolor[fg]{section name}%
        \makebox[0.5\linewidth][r]{\insertsectionnumber}%
        \makebox[0.5\linewidth][c]{\usebeamertemplate{section name separator}}}%
    \end{column}
    \begin{column}{0.9\textwidth}
      \usebeamerfont{section title}%
      {\usebeamercolor[fg]{section title}\hypersetup{linkcolor=}\insertsection}%
    \end{column}
  \end{columns}
}

\setbeamertemplate{section page}[left][0.3\textheight]


%%%%% start each section with a special slide:

\AtBeginSection{
  \frame[plain]{\sectionpage}
}


%%%%% subsection page %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% subsection page separator: space

\defbeamertemplate{subsection name separator}{space}{}

% subsection page separator: text

\defbeamertemplate{subsection name separator}{text}[1][1pt]%
{{\usebeamercolor[fg]{subsection name separator}\rule[-0.5ex]{#1}{2.4ex}}}

\setbeamertemplate{subsection name separator}[text][1pt]


%%%%% subsection page: left

\defbeamertemplate{subsection page}{left}[1][0.3\textheight]%
{
  \usebeamertemplate{section page}
  \vspace{2ex}
  \begin{columns}[t,onlytextwidth]
    \begin{column}{0.1\textwidth}
      \raggedleft%
      \usebeamerfont{subsection name}%
      {\usebeamercolor[fg]{subsection name}%
        \makebox[0.5\linewidth][r]{\insertsubsectionnumber}%
        \makebox[0.5\linewidth][c]{\usebeamertemplate{subsection name separator}}}%
    \end{column}
    \begin{column}{0.9\textwidth}
      \usebeamerfont{subsection title}%
      {\usebeamercolor[fg]{subsection title}\hypersetup{linkcolor=}\insertsubsection}%
    \end{column}
  \end{columns}
}

\setbeamertemplate{subsection page}[left][0.3\textheight]


%%%%% fonts %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\renewcommand{\familydefault}{\sfdefault}

\setbeamerfont{normal text}{size=\normalsize}

\setbeamerfont{frametitle}{size=\LARGE}
\setbeamerfont{framesubtitle}{size=\large}

\setbeamerfont{title}{size=\Large, shape=\bfseries}
\setbeamerfont{subtitle}{size=\large, shape=\bfseries}
\setbeamerfont{author}{size=\large}
\setbeamerfont{institute}{size=\normalsize}
\setbeamerfont{date}{size=\tiny}

\setbeamerfont{block title}{parent={normal text}}
\setbeamerfont{block body}{parent={normal text}}
\setbeamerfont{block title alerted}{parent={block title}}
\setbeamerfont{block body alerted}{parent={block body}}
\setbeamerfont{block title example}{parent={block title}}
\setbeamerfont{block body example}{parent={block body}}
\setbeamerfont{theorem title}{parent={block title}}
\setbeamerfont{theorem body}{parent={block body}}

\setbeamerfont{message}{parent={normal text}, size=\large}
\setbeamerfont{message item}{parent={normal text}, size=\large}

\setbeamerfont{quotation}{shape=\slshape}
\setbeamerfont{quotation author}{parent={normal text}, size=\small, shape=\upshape}

\setbeamerfont{quote}{shape=\slshape}
\setbeamerfont{quote author}{parent={normal text}, size=\small, shape=\upshape}

\setbeamerfont{verse}{shape=\itshape}

\setbeamerfont*{section title}{size=\huge}
\setbeamerfont*{section name}{size=\huge}
\setbeamerfont*{subsection title}{size=\Large}
\setbeamerfont*{subsection name}{size=\Large}

\setbeamerfont{footline}{size=\footnotesize}
\setbeamerfont{author in head/foot}{}
\setbeamerfont{date in head/foot}{}
\setbeamerfont{institute in head/foot}{}
\setbeamerfont{title in head/foot}{}
\setbeamerfont{page number in head/foot}{}

\mode<all>
