%%
%% This is file `bidipresentation.cls',     % I've modified it, though, and I have also used the class ``bidiSP.cls" by H. Noori, and the style ``sidebidipres.sty" by AR Hashemi
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% bidi.dtx  (with options: `bidipresentation.cls')
%% 
%%   ______________________________________
%%   Copyright © 2009–2010  Vafa Khalighi
%% 
%%   License information appended.
%% 
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{bidipresentation_modified}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions\relax
\LoadClass{article}


\RequirePackage[paperwidth=240mm,paperheight=180mm,  lmargin=20mm,rmargin=40mm,bmargin=16mm,tmargin=16mm, footskip=10mm, headheight=10mm,headsep=6mm, marginparwidth=30mm,marginparsep=10mm]{geometry}
% از  rmargin  برای خالی کردن قسمتی از سمت راست تمامی اسلایدها (حتی اگر استایل آنها empty باشد که زیرنویس و ... هم نداشته باشد) استفاده میشود که بتوان در جای آن یک نوار side-bar قرار داد مثلاً برای فهرست مطالب، اگرچه من آنرا 10mm بزرگتر از سایدبار گرفته ام که کار right را هم همزمان بکند و از سایدبار نوشته های داخل اسلاید به اندازه ی 10mm فاسله بگیرند، خود right اگر مساوی 10mm بود نمیتوانست در حضور rmargin بزرگتر از خودش این کار را بکند و حذفش کردم!       % برای heading صفحات هم اگر کاغذ اسلایدها کوچک معرفی شود گاهی باید از مقادیر منفی استفاده کرد تا header ها داخل اسلاید بیفتند و نه بالاتر و بیرون از آن

\RequirePackage{amsmath,amssymb,amsfonts,textcomp,txfonts,mathrsfs,stmaryrd}


\RequirePackage{multicol,multirow,xecolour,xcolor,colortbl,graphicx,watermark,tikz,boxedminipage}
%package: multicol         if ``twocolumn" is added as an argument to the class definition, this package should be unactivated; I need it for my proposal's  time table
%package: multirow       again I need it for my proposal's time table
%package: xecolour        used  for RTL coloured texts that spans more than a line     % not required to be called as is already called from within the class exploited
%package: xcolor             used  for ???
%package: colortbl          used for coloring the tables and also coloring the fonts in text and also highligthing the texts
%package: graphicx        used to include figures and watermarks as well       % not required to be called as is already called from within the class exploited
%package: watermark    In order to become able to use the command \watermark, to add watermark to the slides   %but note that it removes the headers in the slides having watermarks
%package: tikz                 useful to produce rotated (by an arbitrary angle) colored boxes (it even doesn't need any "color" related package to be called, either)
\usetikzlibrary{shapes,snakes}     %to work with "tikz" package


\RequirePackage{fancyhdr}
\renewcommand{\headrulewidth}{0.3mm}    %the line below the header part of the slide with thickness 0.2 mm
\renewcommand{\footrulewidth}{0.3mm}     %the line above the footer part of the slide with thickness 0.2 mm


\RequirePackage[RL]{flowfram}       % it is required for using the command ``\newstaticframe" and etc. in definition of the sidebar, but destroys the headers and footers by pulling them to the left    % we enable `RL' option for RTL multicolumn typesetting (see flowfram package documentation)


\RequirePackage{eso-pic}                   % it is required for using the command ``\AddToShipoutPicture" in definition of a background for the sidebar


\renewcommand{\sectionmark}[1]{\markright{#1}{}} %%استخراج عنوان خالص سكشن % required for writing the section titles in the header


\RequirePackage{lastpage}     % this package is used for the last page of the presentation to be known, useful for writing down the slide's page number as page/lastpage


\RequirePackage[colorlinks=true,linkcolor=link-text,filecolor=blue,pagecolor=blue,urlcolor=url-text,citecolor=cite-text,setpagesize=false,pdfhighlight=/N,backref=page]{hyperref}     % thispackage would be called from within sidebarbidipres_modified, so the below adjustments should be placed after that package
\hypersetup{
pdfpagemode=FullScreen,                                                 % this opens the pdf in fullscreen such that it will be more suitable for a presentation
pdftitle={عنوان اسلاید},pdfkeywords={کلید واژه‌ها},
pdfauthor={نویسنده}, pdfsubject={موضوع},
%anchorcolor={blue},linktocpage=true,
}

\RequirePackage{xepersian}       % this includes the bidi package? and translates some latin commands to their persian translations, e.g. see that \date now writes the persian date
%\RequirePackage[RTLdocument]{bidi}                                                                         % this is supposed  to be the last package to be called, so add other packages before it
\setmainfont[Scale=1,Script=Arabic,Mapping=farsidigits]{XB Niloofar}              %the main font to be used within the script%
\newfontfamily\kayhan[Scale=1,Script=Arabic,Mapping=farsidigits]{XB Kayhan}           %an extra font to be used whenever interested
\newfontfamily\kayhansayeh[Scale=0.9,Script=Arabic,Mapping=farsidigits]{XB Kayhan Sayeh} %an extra font to be used whenever interested
\newfontfamily\yas[Scale=1.1,Script=Arabic,Mapping=farsidigits]{XB Yas}                          %an extra font to be used whenever interested
\newfontfamily\zar[Scale=1,Script=Arabic,Mapping=farsidigits]{XB Zar}                          %an extra font to be used whenever interested
\newfontfamily\sols[Scale=1,Script=Arabic,Mapping=farsidigits]{XB Sols}                          %an extra font to be used whenever interested
\newfontfamily\nastaliq[Scale=2,Script=Arabic,Mapping=farsidigits]{IranNastaliq}          %an extra font to be used whenever interested

%-------------------------------------------------------------------------------------------------------------
\def\contentsname{ }           % this redifinition acts like modiffying the class ``article" for nothing to be written above the table of contents like ``Contents" or ``فهرست مطالب"

\renewcommand \thesection { }   % and this redifinition acts like modiffying the class ``article" for the sections not to be numbered, neither in the slides, nor in the list of content

\renewcommand*\l@section[2]{ % and this modifies the original tableofcontents not to include the page numbers corresponding to sections, for beauty and also using in sidebar
  \ifnum \c@tocdepth >\z@
    %\addpenalty\@secpenalty
    \addvspace{1.0em \@plus\p@}%
    \setlength\@tempdima{0.1em}%                  %insread of 1.5em in the original command \l@section[2]
    \begingroup
      %\parindent \z@ \rightskip \@pnumwidth
      %\parfillskip -\@pnumwidth
      %\leavevmode \bfseries
      \advance\leftskip\@tempdima
      %\hskip -\leftskip
      #1\par            %  the command used originally in ``article.cls" was:     #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par    %   #1 stands for the title, and #2 stands for its corresponding page number
    \endgroup
  \fi}
%-------------------------------------------------------------------------------------------------------------

\renewcommand{\maketitle}%
  {\ClassError{bidipresentation}{Caution: ``maketitle'' command not supported}%
  {Please use ``titlepage'' environment instead}%
}
%------------------------------------------
\def\institute#1{\gdef\@institute{#1}}	  %
\def\department#1{\gdef\@department{#1}}  %
\def\slidetitle#1{\gdef\@slidetitle{#1}}  %
\def\slideauthor#1{\gdef\@slideauthor{#1}}%
\def\slidedate#1{\gdef\@slidedate{#1}}	  %
%------------------------------------------
\newcommand{\distance}[1]{\vspace*{\stretch{#1}}}
\newcommand{\abstand}[1]{\vspace*{\stretch{#1}}}
%------------------------------------------
\newcommand{\titleslide}                                                           %%  دستوری برای ایجاد صفحه ی عنوان
{{\thispagestyle{empty}\distance{0}\centering{
            \sols {«بِسمِ اللّٰهِ الرَّحمٰنِ الرَّحیمِ»}\\
            \distance{2}  {\Large\kayhansayeh \@slidetitle}\\
			\distance{1} {\large\sols \@slideauthor}\\
			\distance{0.2} {\small\nastaliq \@institute}\\
			\distance{2}  {\small\yas \@slidedate}
	        \distance{0.3}}\newpage\setcounter{page}{1}}}             % this ends the title page and starts a new page with page number just starting from 1, instad of 2
%--------------------------------------------


\setlength{\parskip}{0.6ex}
\setlength{\parindent}{0mm}


%--------------------------------------------------------------------------------------------------
\newenvironment{plainslide}[1][]%
   {{\raggedleft\large\bfseries #1\par}\par\vspace*{\stretch{1}}}%
   {\par\vspace*{\stretch{1}}\newpage}

\newenvironment{frameslide}[1][]%
   {\addtocounter{page}{-1}{\raggedleft\large\bfseries #1\par}\par\vspace*{\stretch{1}}}%        %this is just like ``plainslide" but only keeps the same its pagenumber, so is useful as a frame to be called inside one slide! a figure, a table, or even counting the \items in a text slide!
   {\par\vspace*{\stretch{1}}\newpage}

\newenvironment{rawslide}{}{\newpage}%

\newenvironment{rawframe}{}{\addtocounter{page}{-1}\newpage}%    % this is the same as frameslide but only for rawslides! so that there is no ``عنوان" but all the lines start at top of the page

%one may also combine the ``plainslide" and ``rawslide" to obtain something in middle as his own ``frameslide"
%--------------------------------------------------------------------------------------------------


\def\itemize{%
  \ifnum \@itemdepth >\thr@@\@toodeep\else
    \advance\@itemdepth\@ne
    \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
    \expandafter
    \list
      \csname\@itemitem\endcsname
      {\def\makelabel##1{\hss\llap{##1}}}%
  \fi
    \setlength{\itemsep}{0ex}%
    \setlength{\parskip}{0.1ex}%
    \setlength{\parsep}{0ex}%
    }%
\let\enditemize =\endlist

\def\enumerate{%
  \ifnum \@enumdepth >\thr@@\@toodeep\else
    \advance\@enumdepth\@ne
    \edef\@enumctr{enum\romannumeral\the\@enumdepth}%
      \expandafter
      \list
        \csname label\@enumctr\endcsname
        {\usecounter\@enumctr\def\makelabel##1{\hss\llap{##1}}}%
  \fi
    \setlength{\itemsep}{0ex}%
    \setlength{\parskip}{0.1ex}%
    \setlength{\parsep}{0ex}%
    }%
\let\endenumerate =\endlist

\renewenvironment{description}
               {\list{}{\labelwidth\z@ \itemindent-\leftmargin
                        \let\makelabel\descriptionlabel}
 \setlength{\itemsep}{0ex}%
    \setlength{\parskip}{0.1ex}%
    \setlength{\parsep}{0ex}}
               {\endlist}
%% 
%% Copyright © 2009–2010  Vafa Khalighi <vafakhlgh@gmail.com>
%% 
%% It may be distributed and/or modified 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 “author-maintained” (as per LPPL maintenance status)
%% by Vafa Khalighi.
%% 
%% In addition to the terms of LPPL any distributed version
%% (unchanged or modified) of bidi has to keep the statement
%% about the moral obligation for using bidi. In case of major
%% changes where this would not be appropriate the author of the
%% changed version should contact the copyright holder.
%% 
%% 
%% 
%% Moral obligation for using bidi:
%% ____________________________________
%% 
%% Users of bidi who wish to include or use bidi or a modified
%% version in a proprietary and commercially market product are asked
%% under certain conditions (see below) for the payment of a license
%% fee.  The size of this fee is to be determined, in each instance,
%% by the commercial user, depending on his/her judgment of the value of
%% bidi for his/her product.
%% 
%% 
%% The conditions for this are as follows:
%% 
%% The producer of a proprietary and commercially market product
%% that involves typesetting using bidi is asked to determine
%% the value of a license fee for using bidi if
%% 
%%    - the product is a document and the producer has decided to
%%      include bidi to typeset (parts of) the document or has
%%      directed the author of the document to include bidi (for
%%      example, by providing a class file to be used by the author)
%% 
%%    - the product is a LaTeX class or package that includes bidi
%% 
%% 
%% There is no moral obligation in case
%% 
%%    - the product is a document but producer has not directed
%%      the author to include bidi (in that case the moral obligation
%%      lies with the author of the document)
%% 
%%    - the product does not involve typesetting, e.g., consists, for
%%      example, of distributing bidi and its documentation.
%% 
%%    - the product is not proprietary, i.e., is made available as free
%%      software itself (which doesn't prohibit its commercial marketing)
%% 
%%    - bidi is used for non-commercial purposes
%% 
%% 
%% Determinating a license fee might result in a license fee of zero
%% (i.e., no payment) in case a producer has determined that the use
%% of bidi has no enhancing effect on the product. This is a
%% plausible scenario, i.e., in the above two cases the producer is
%% only asked to evaluate the value of bidi for the product
%% not for the payment of a license fee per se (which might or might
%% not follow from this evaluation).
%% 
%%  The license fee, if any, can be payed to the author of
%%  the program who can be contacted at
%% 
%%      vafakhlgh@gmail.com
%% 
%% 
%% 
%%
%% End of file `bidipresentation.cls'.
