%%
%% This is file `bidibeamer-bidi.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% bidi.dtx  (with options: `bidibeamer-bidi.def')
%% 
%%   __________________________________
%%   Copyright © 2009 Vafa Khalighi
%% 
%%   License information appended.
%% 
%% 
\raggedleft
\def\LTR{\bgroup\par\raggedright\@RTLfalse}
\def\endLTR{\par\egroup}
\def\RTL{\bgroup\par\raggedleft\@RTLtrue}
\def\endRTL{\par\egroup}
\long\def\beamer@@frametitle[#1]#2{%
  \beamer@ifempty{#2}{}{%
    \gdef\insertframetitle{\raggedleft\rightskip=2em{\beginR#2\endR\ifnum\beamer@autobreakcount>0\relax{}\space\usebeamertemplate*{frametitle continuation}\fi}}%
  \gdef\beamer@frametitle{\beginR#2\endR}%
  \gdef\beamer@shortframetitle{\beginR#1\endR}%
}%
}
\def\@thm#1#2#3{%
  \ifhmode\unskip\unskip\par\fi
  \normalfont
  \let\thmheadnl\relax
  \let\thm@swap\@gobble
  \thm@headpunct{.}% add period after heading
  \thm@space@setup
  #1% style overrides
  \def\inserttheoremname{#3}
  \def\inserttheorempunctuation{\the\thm@headpunct}
  \def\@tempa{#2}%
  \ifx\@empty\@tempa
    \def\inserttheoremnumber{}
  \else
    \refstepcounter{#2}%
    \expandafter\def\expandafter\inserttheoremnumber\expandafter{ \csname the#2\endcsname}
  \fi
  \beamer@begintheorem%
\raggedleft\@RTLtrue
}
 \ifbeamer@countsect
      \newtheorem{biditheorem}{\raggedleft \biditheoremname}[section]
    \else
      \newtheorem{biditheorem}{\raggedleft \biditheoremname}
    \fi
    \newtheorem{bidicorollary}[theorem]{\raggedleft \bidicorollaryname}
    \newtheorem{bidifact}[theorem]{\raggedleft \bidifactname}
    \newtheorem{bidilemma}[theorem]{\raggedleft \bidilemmaname}
    \newtheorem{bidiproblem}[theorem]{\raggedleft \bidiproblemname}
    \newtheorem{bidisolution}[theorem]{\raggedleft \bidisolutionname}
\theoremstyle{definition}
    \newtheorem{bididefinition}[theorem]{\raggedleft \bididefinitionname}
    \newtheorem{bididefinitions}[theorem]{\raggedleft \bididefinitionsname}
\theoremstyle{example}
    \newtheorem{bidiexample}[theorem]{\raggedleft \bidiexamplename}
    \newtheorem{bidiexamples}[theorem]{\raggedleft \bidiexamplesname}
\newenvironment<>{bidiproof}[1][\raggedleft \bidiproofname]{%
  \par
  \def\insertproofname{#1\@addpunct{}}%
  \pushQED{\qed}
  \usebeamertemplate{proof begin}\@RTLtrue#2}
{\popQED\usebeamertemplate{proof end}}
 \newenvironment<>{bidiblock}[1]{%
    \begin{actionenv}#2%
      \def\insertblocktitle{\raggedleft#1}%
      \par%
      \usebeamertemplate{block begin}\raggedleft\@RTLtrue}
    {\par%
      \usebeamertemplate{block end}%
    \end{actionenv}}
  \newenvironment<>{bidialertblock}[1]{%
    \begin{actionenv}#2%
      \def\insertblocktitle{\raggedleft#1}%
      \par%
      \mode<presentation>{%\usebeamerfont{block}%
        \setbeamercolor{local structure}{parent=alerted text}}%
      \usebeamertemplate{block alerted begin}\raggedleft\@RTLtrue}
    {\par%
      \usebeamertemplate{block alerted end}%
    \end{actionenv}}
  \newenvironment<>{bidiexampleblock}[1]{%
    \begin{actionenv}#2%
      \def\insertblocktitle{\raggedleft#1}%
      \par%
      \mode<presentation>{%\usebeamerfont{block}%
        \setbeamercolor{local structure}{parent=example text}}%
      \usebeamertemplate{block example begin}\raggedleft\@RTLtrue}
    {\par%
      \usebeamertemplate{block example end}%
    \end{actionenv}}
\def\@listi{\if@RTL\rightmargin\leftmargini\else\leftmargin\leftmargini\fi
            \topsep 3\p@ \@plus2\p@ \@minus2.5\p@
            \parsep 0\p@
            \itemsep3\p@ \@plus2\p@ \@minus3\p@}
\let\@listI\@listi
\def\@listii{\if@RTL\rightmargin\leftmarginii\else\leftmargin\leftmarginii\fi
              \topsep    2\p@ \@plus1\p@ \@minus2\p@
              \parsep    0\p@   \@plus\p@
              \itemsep   \parsep}
\def\@listiii{\if@RTL\rightmargin\leftmarginiii\else\leftmargin\leftmarginiii\fi
              \topsep    2\p@ \@plus1\p@ \@minus2\p@
              \parsep    0\p@   \@plus\p@
              \itemsep   \parsep}
\def\beamer@enum@{%
  \beamer@computepref\@itemdepth% sets \beameritemnestingprefix
  \usebeamerfont{itemize/enumerate \beameritemnestingprefix body}%
  \usebeamercolor[fg]{itemize/enumerate \beameritemnestingprefix body}%
  \usebeamertemplate{itemize/enumerate \beameritemnestingprefix body begin}%
  \expandafter
    \list
      {\usebeamertemplate{\beamer@enumtempl}}
      {\usecounter\@enumctr%
        \def\makelabel##1{{\hss\llap{{%
                \usebeamerfont*{enumerate \beameritemnestingprefix item}%
                \usebeamercolor[fg]{enumerate \beameritemnestingprefix item}##1}}}}}%
  \beamer@cramped%
  \raggedleft%
  \beamer@firstlineitemizeunskip%
}
\renewcommand{\itemize}[1][]{%
  \beamer@ifempty{#1}{}{\def\beamer@defaultospec{#1}}%
  \ifnum \@itemdepth >2\relax\@toodeep\else
    \advance\@itemdepth\@ne
    \beamer@computepref\@itemdepth% sets \beameritemnestingprefix
    \usebeamerfont{itemize/enumerate \beameritemnestingprefix body}%
    \usebeamercolor[fg]{itemize/enumerate \beameritemnestingprefix body}%
    \usebeamertemplate{itemize/enumerate \beameritemnestingprefix body begin}%
    \list
      {\usebeamertemplate{itemize \beameritemnestingprefix item}}
      {\def\makelabel##1{%
          {%
            \hss\llap{{%
                \usebeamerfont*{itemize \beameritemnestingprefix item}%
                \usebeamercolor[fg]{itemize \beameritemnestingprefix item}##1}}%
          }%
        }%
      }
  \fi%
  \beamer@cramped%
  \raggedleft%
  \beamer@firstlineitemizeunskip%
}
\def\@@description{%
  \advance\beamer@descdefault by \labelsep%
  \list
  {}
  {\labelwidth\beamer@descdefault\leftmargin\beamer@descdefault\let\makelabel\beamer@descriptionitem}%
  \beamer@cramped%
  \raggedleft\rightskip=6em
  \beamer@firstlineitemizeunskip%
}
\AtBeginDocument{\@RTLfalse}
\renewenvironment{beamer@frameslide}{%
  \ifbeamer@autobreak\else%
    \ifx\beamer@againname\@empty%
      {\let\@elt\beamer@restorecounter\beamer@overlaycounterresets}%
    \else%
      {\let\@elt\beamer@labelrestorecounter\beamer@overlaycounterresets}%
    \fi%
  \fi%
  \global\c@beamerpauses=1\relax%
  \expandafter\beamer@ifempty\expandafter{\beamer@framestartpage}{%
    \refstepcounter{subsectionslide}%
    \xdef\beamer@framestartpage{\the\c@page}% only first time
  }{\clearpage\beamer@notesactions}% cleanup from previous slide
  \hypersetup{pdfpagetransition=R}%
  \hypersetup{pdfpageduration=}%
  \xdef\beamer@frameendpage{\the\c@page}% every time
  \beamer@setuplinks%
  \beamer@displaybreak%
  \global\setbox\beamer@zoombox=\box\voidb@x%
  \def\beamer@zoomer{}%
  \beamer@slidehaszoomfalse%
  \gdef\insertframetitle{}%
  \gdef\insertframesubtitle{}%
  \gdef\beamer@frametitle{}%
  \gdef\beamer@shortframetitle{}%
  \gdef\beamer@framesubtitle{}%
  \let\beamer@startcomment=\beamer@startcommentinframe%
  % Start slide:
  \beamer@framenotesbegin\@RTLtrue%
    \global\setbox\beamer@framebox=\vbox\bgroup%
    \beamer@inframetrue%
    \let\frame=\framelatex% inside frames, use LaTeX's \frame command
    \begin{beamer@framepauses}%
      \ifbeamer@shrink%
        \hsize=\beamer@shrinkfactorinv\hsize%
        \textwidth=\beamer@shrinkfactorinv\textwidth%
        \linewidth=\beamer@shrinkfactorinv\linewidth%
      \fi%
      % Insert labels if necessary:
      \ifx\beamer@againname\@empty\else%
        \nointerlineskip\vbox to0pt{\vss%
        \label<\the\beamer@slideinframe>{\beamer@againname<\the\beamer@slideinframe>}%
        \ifnum\beamer@slideinframe=1\relax%
          \label<1>{\beamer@againname}%
        \fi%
        }\nointerlineskip%
      \fi%
      \ifx\beamer@framehypertargets\@empty\else%
        \nointerlineskip\vbox to0pt{\vss%
          \beamer@framehypertargets%
          \global\let\beamer@framehypertargets\@empty%
        }\nointerlineskip%
      \fi%
      \vskip-\parskip\vbox{}%
      \beamer@initfirstlineunskip%
      \ifbeamer@plainframe\nointerlineskip\fi%
    \beamer@checkframetitle}%
    {\end{beamer@framepauses}%
  \egroup%
  \ifx\beamer@frametitle\@empty%
    \setbox\beamer@frametitlebox=\box\voidb@x%
  \else%
    \setbox\beamer@frametitlebox=\vbox{%
      \vbox{}%
      {\parskip0pt\usebeamertemplate***{frametitle}\vskip0.25em}%
    }%
  \fi%
  \ifbeamer@plainframe%
    \beamer@frametextheight=\paperheight%
  \else%
    \beamer@frametextheight=\textheight%
  \fi%
  \advance\beamer@frametextheight by-\ht\beamer@frametitlebox%
  \advance\beamer@frametextheight by-\dp\beamer@frametitlebox%
  \advance\beamer@frametextheight by-\beamer@frametopskip%
  \ifbeamer@shrink%
    \beamer@shrinkframebox%
  \fi%
  \ifx\beamer@zoomer\@empty
    \setbox\beamer@framebox=\vbox{%
      \nobreak\vbox{}\nobreak\par\nobreak\beamer@entrycode\nobreak%
      \nointerlineskip\unvbox\beamer@frametitlebox%
      \nobreak%
      \ifbeamer@autobreak%
        \vskip\beamer@frametopskipautobreak%
      \else%
        \vskip\beamer@frametopskip%
      \fi%
      \nobreak%
      \nointerlineskip\box\beamer@zoombox\nointerlineskip%
      \nobreak%
      \ifbeamer@slidehaszoom\box\beamer@framebox\else\unvbox\beamer@framebox\fi%
      % bottom skip is added in autobreakframebox
    }%
    \beamer@autobreakframebox%
  \else%
    \beamer@zoomer%
  \fi%
  \beamer@undolabels%
  \beamer@framenotesend%
  \box\beamer@framebox}
\long\def\beamer@title[#1]#2{%
  \def\inserttitle{\beginR#2\endR}%
  \def\beamer@shorttitle{\beginR#1\endR}%
  }
\long\def\beamer@subtitle[#1]#2{%
  \def\insertsubtitle{\beginR#2\endR}%
  \def\beamer@shortsubtitle{\beginR#1\endR}%
  }
\long\def\beamer@date[#1]#2{%
  \def\insertdate{\beginR#2\endR}%
  \def\beamer@shortdate{\beginR#1\endR}%
  }
\long\def\beamer@author[#1]#2{%
  \def\insertauthor{\def\inst{\beamer@insttitle}\def\and{\beamer@andtitle}\beginR#2\endR}%
  \def\beamer@shortauthor{\beginR#1\endR}%
  \ifbeamer@autopdfinfo%
    \def\beamer@andstripped{}%
    \beamer@stripands#2 \and\relax
    {\let\inst=\@gobble\let\thanks=\@gobble\def\and{, }\hypersetup{pdfauthor={\beamer@andstripped}}}
  \fi%
}
\long\def\beamer@institute[#1]#2{%
  \def\beamer@temp{\beginR#2\endR}%
  \ifx\beamer@temp\@empty
    \def\insertinstitute{}
  \else
    \def\insertinstitute{\def\inst{\beamer@instinst}\def\and{\beamer@andinst}\beginR#2\endR}%
  \fi
 \def\beamer@shortinstitute{\beginR#1\endR}}
\renewenvironment{thebibliography}[1]
{%\leavevmode\unskip%
  \list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\beamer@biblabeltemplate{\@biblabel{#1}}}%
            \leftmargin\labelwidth
            \advance\leftmargin\labelsep
            \itemsep=0pt%
            \partopsep=0pt%
            \topsep=0pt%
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}
            \let\makelabel\beamer@biblabeltemplate}%
      \sloppy\raggedleft
      \clubpenalty10000
      \@clubpenalty \clubpenalty
      \widowpenalty10000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
      \ifhmode\unskip\fi\endlist}
\long\def\beamer@@@section#1{\beamer@section[\beginR#1\endR]{#1}}
\def\beamer@@@subsection#1{\beamer@subsection[\beginR#1\endR]{#1}}
\def\beamer@@@subsubsection#1{\beamer@subsubsection[\beginR#1\endR]{#1}}
\long\def\beamer@subsectionintoc#1#2#3#4#5#6{%
  \ifnum\c@tocdepth>1%
  \ifnum#5=\beamer@showpartnumber%
  {
    \beamer@saveanother%
    \gdef\beamer@todo{}%
    \beamer@slideinframe=#1\relax%
    \expandafter\only\beamer@tocsections{\gdef\beamer@todo{%
      \ifbeamer@pausesubsections\pause\fi%
      \beamer@tempcount=#6%
      \advance\beamer@tempcount by\beamer@sectionadjust%
      \edef\inserttocsectionnumber{\the\beamer@tempcount}%
      \def\inserttocsubsectionnumber{#2}%
      \def\inserttocsubsection{\rightskip=1.5em\hyperlink{Navigation#4}{\beginR#3\endR\hfill}}%
      \beamer@tocifnothide{\ifnum\c@section=#1\beamer@toc@oss\else\beamer@toc@ooss\fi}%
      {%
        \def\beamer@breakhere{\\}%
        \beamer@tocact{\ifnum\c@section=#1\ifnum\c@subsection=#2\beamer@toc@css\else\beamer@toc@oss\fi\else\beamer@toc@ooss\fi}
        {subsection in toc}%
      }%
    }}%
    \beamer@restoreanother%
  }
  \beamer@todo%
  \fi\fi%
}
\long\def\beamer@subsubsectionintoc#1#2#3#4#5#6#7{%
  \ifnum\c@tocdepth>2%
  \ifnum#1=\beamer@showpartnumber%
  {
    \beamer@saveanother%
    \gdef\beamer@todo{}%
    \beamer@slideinframe=#2\relax%
    \expandafter\only\beamer@tocsections{\gdef\beamer@todo{%
      \ifbeamer@pausesubsections\pause\fi%
      \beamer@tempcount=#6%
      \advance\beamer@tempcount by\beamer@sectionadjust%
      \edef\inserttocsectionnumber{\the\beamer@tempcount}%
      \def\inserttocsubsectionnumber{#3}%
      \def\inserttocsubsubsectionnumber{#4}%
      \def\inserttocsubsubsection{\rightskip=3em\hyperlink{Navigation#5}{\beginR#7\endR\hfill}}%
      \beamer@tocifnothide{\ifnum\c@section=#2\beamer@toc@oss\else\beamer@toc@ooss\fi}%
      {%
        \def\beamer@breakhere{\\}%
        \beamer@tocact{\ifnum\c@section=#2\ifnum\c@subsection=#3\beamer@toc@css\else\beamer@toc@oss\fi\else\beamer@toc@ooss\fi}
        {subsubsection in toc}%
      }%
    }}%
    \beamer@restoreanother%
  }
  \beamer@todo%
  \fi\fi%
}
\long\def\beamer@makecaption#1#2{%
  \def\insertcaptionname{\csname#1name\endcsname}%
  \def\insertcaptionnumber{\csname the#1\endcsname}%
  \def\insertcaption{#2}%
  \nobreak\vskip\abovecaptionskip\nobreak
  \sbox\@tempboxa{\usebeamertemplate**{caption}}%
  \ifdim \wd\@tempboxa >\hsize
    \usebeamertemplate**{caption}\par
  \else
    \global \@minipagefalse
    \hb@xt@\hsize{\if@RTL\beginR\fi\hfil\box\@tempboxa\hfil\if@RTL\endR\fi}%
  \fi
  \nobreak\vskip\belowcaptionskip\nobreak}
\let\origin@alert=\alert
\def\alert#1{\ifmmode\origin@alert{#1}\else\if@RTL\beginL\origin@alert{\beginR#1\endR}\endL\else\origin@alert{#1}\fi\fi}
%% 
%% Copyright © 2009      by Vafa Khalighi     <vafa@users.berlios.de>
%% 
%% Distributable under the LaTeX Project Public License,
%% version 1.3c or higher (your choice). The latest version of
%% this license is at: http://www.latex-project.org/lppl.txt
%% 
%% This work is "maintained" (as per LPPL maintenance status)
%% by Vafa Khalighi.
%% 
%% 
%% 
%% 
%%
%% End of file `bidibeamer-bidi.def'.
