%%
%% This is file `hvfloat-luapersian.def',
%% generated with the docstrip utility.
%%  ______________________________________
%%   Copyright © 2011  Vafa Khalighi
%% 
%%   License information appended.
%% 
%% 
\ProvidesFile{hvfloat-luapersian.def}[2011/08/01 v0.1 adaptations for hvfloat package]
\def\do@@hvFloat[#1]#2#3{%
\def\hv@shortCap{#1}
\def\hv@longCap{#2}
\def\hv@label{#3}
\def\@tempa{90}%
\ifx\hvSet@rotAngle\@tempa
\setlength{\hvMaxCapWidth}{\textheight}
\else
\setlength{\hvMaxCapWidth}{\linewidth}
\fi
\ifx\hvSet@objectAngle\hv@Zero % rotate the object?
\savebox{\hvObjectBox}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}
\else
\savebox{\hvObjectBox}{%
\rotatebox{\hvSet@objectAngle}{%
\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}}
\fi
\setlength{\hvObjectWidth}{\wd\hvObjectBox}
\ifx\hvSet@capWidth\hv@Width
\setlength{\hvCapWidth}{\hvObjectWidth}
\else
\ifx\hvSet@capWidth\hv@Height
\setlength{\hvCapWidth}{\ht\hvObjectBox}
\else
\setlength{\hvCapWidth}{\hvObjectWidth}
\ifx\hvSet@capPos\hv@Left
\addtolength{\hvMaxCapWidth}{-\hvObjectWidth}
\fi
\ifx\hvSet@capPos\hv@Right
\addtolength{\hvMaxCapWidth}{-\hvObjectWidth}
\fi
\ifdim\hvSet@capWidth\columnwidth<\hvMaxCapWidth
\setlength{\hvCapWidth}{\hvSet@capWidth\columnwidth}
\else
\setlength{\hvCapWidth}{\hvMaxCapWidth}
\fi
\fi
\fi
\def\fps@figure{\hvSet@floatPos}
\ifhv@nonFloat%
\begingroup% Start the nonfloat part
\else%
\begin{\hv@floatType}% Start the floating environment
\fi%
\saveCaptionSkip% we put this space ourselve
\ifx\hvSet@capAngle\hv@Width % need rotation?
\sbox{\hvCaptionBox}{%
\begin{minipage}[b]{\hvCapWidth}% minipage, to get hyphenation
\ifhv@nonFloat%
\ifhv@onlyText%
#2%
\else%
    \ifthenelse{\equal{\hv@floatType}{figure}}{%
\ifthenelse{\equal{#1}{}}{\figcaption{#2}}{\figcaption[#1]{#2}}%
    }{%
\ifthenelse{\equal{#1}{}}{\tabcaption{#2}}{\tabcaption[#1]{#2}}%
    }%
\fi%
\else%
\ifx\hv@shortCap\empty\caption{#2}\else\caption[#1]{#2}\fi%
\fi%
\label{#3}%
\end{minipage}%
}%
\else%
\sbox{\hvCaptionBox}{%
\rotatebox{\hvSet@capAngle}{%
\begin{minipage}[b]{\hvCapWidth}% minipage, to get hyphenation
\ifhv@nonFloat%
\ifhv@onlyText%
#2%
\else%
    \ifthenelse{\equal{\hv@floatType}{figure}}{%
\ifthenelse{\equal{#1}{}}{\figcaption{#2}}{\figcaption[#1]{#2}}%
    }{%
\ifthenelse{\equal{#1}{}}{\tabcaption{#2}}{\tabcaption[#1]{#2}}%
    }%
\fi%
\else%
\ifx\hv@shortCap\empty\caption{#2}\else\caption[#1]{#2}\fi%
\fi%
\label{#3}%
\end{minipage}%
}%
}%
\fi%
%%
\restoreCaptionSkip% save old values
                \if@RTL%
                 \ifx\hvSet@objectPos\hv@Left%
\raggedright%
\else%
\ifx\hvSet@objectPos\hv@Center%
\ifhv@nonFloat%
\hspace*{\fill}%
\else%
\centering
\fi%
\fi%
\fi%
                \else
\ifx\hvSet@objectPos\hv@Right%
\raggedleft%
\else%
\ifx\hvSet@objectPos\hv@Center%
\ifhv@nonFloat%
\hspace*{\fill}%
\else%
\centering
\fi%
\fi%
\fi%
                \fi
\savebox{\@tempboxa}{\if@RTL%
                         \ifx\hvSet@capPos\hv@Right  %  caption on left side
\ifx\hvSet@capVPos\hv@Center%
\ifhv@framedCaption%
\fbox{\parbox{\wd\hvCaptionBox}{\usebox{\hvCaptionBox}}}%
\else
\parbox{\wd\hvCaptionBox}{\usebox{\hvCaptionBox}}
\fi%
         \hspace{\hvSet@floatCapSep pt}% capfloatsep
\ifhv@framedObject%
\fbox{\parbox{\wd\hvObjectBox}{\usebox{\hvObjectBox}}}
\else
\parbox{\wd\hvObjectBox}{\usebox{\hvObjectBox}}
\fi%
\else%
\ifx\hvSet@capVPos\hv@Top % caption at top
\ifhv@framedCaption%
\fbox{\raisebox{-\height}{\usebox{\hvCaptionBox}}}%
\else
\raisebox{-\height}{\usebox{\hvCaptionBox}}%
\fi
\hspace{\hvSet@floatCapSep pt}% capfloatsep
\ifhv@framedObject%
\fbox{\raisebox{-\height}{\usebox{\hvObjectBox}}}%
\else
\raisebox{-\height}{\usebox{\hvObjectBox}}%
\fi%
\else% caption on bottom
\ifhv@framedCaption%
\fbox{\usebox{\hvCaptionBox}}
\else
\usebox{\hvCaptionBox}
\fi%
\hspace{\hvSet@floatCapSep pt}%
\ifhv@framedObject%
\fbox{\usebox{\hvObjectBox}}
\else
\usebox{\hvObjectBox}
\fi%
\fi%
\fi%
\else
\ifx\hvSet@capPos\hv@Top
\ifdim\wd\hvCaptionBox>\wd\hvObjectBox
\begin{minipage}{\wd\hvCaptionBox}
\else
\begin{minipage}{\wd\hvObjectBox}
\fi
\centering
\ifhv@framedCaption%
\fbox{\usebox{\hvCaptionBox}}\\[\hvBelowCaptionSkip]
\else
\usebox{\hvCaptionBox}\\[\hvBelowCaptionSkip]%
\fi%
\ifhv@framedObject%
\fbox{\usebox{\hvObjectBox}}%
\else
\usebox{\hvObjectBox}%
\fi%
\end{minipage}
\else
\ifx\hvSet@capPos\hv@Bottom
\ifdim\wd\hvCaptionBox>\wd\hvObjectBox
\begin{minipage}{\wd\hvCaptionBox}
\else
\begin{minipage}{\wd\hvObjectBox}
\fi
\centering
\ifhv@framedObject
\fbox{\usebox{\hvObjectBox}}\\[\hvAboveCaptionSkip]
\else
\usebox{\hvObjectBox}\\[\hvAboveCaptionSkip]
\fi%
\ifhv@framedCaption
\fbox{\usebox{\hvCaptionBox}}%
\else
\usebox{\hvCaptionBox}%
\fi%
\end{minipage}
\else% the last option: put the caption on the right
\ifx\hvSet@capVPos\hv@Center%
\ifhv@framedObject
\fbox{\parbox{\wd\hvObjectBox}{\usebox{\hvObjectBox}}}
\else
\parbox{\wd\hvObjectBox}{\usebox{\hvObjectBox}}
\fi%
\hspace{\hvSet@floatCapSep pt}%
\ifhv@framedCaption
\fbox{\parbox{\wd\hvCaptionBox}{\usebox{\hvCaptionBox}}}%
\else
\parbox{\wd\hvCaptionBox}{\usebox{\hvCaptionBox}}
\fi%
\else%
\ifx\hvSet@capVPos\hv@Top
\ifhv@framedObject
\fbox{\raisebox{-\height}{\usebox{\hvObjectBox}}}%
\else
\raisebox{-\height}{\usebox{\hvObjectBox}}%
\fi%
\hspace{\hvSet@floatCapSep pt}%
\ifhv@framedCaption
\fbox{\raisebox{-\height}{\usebox{\hvCaptionBox}}}%
\else
\raisebox{-\height}{\usebox{\hvCaptionBox}}%
\fi
\else
\ifhv@framedObject
\fbox{\usebox{\hvObjectBox}}%
\else
\usebox{\hvObjectBox}%
\fi
\hspace{\hvSet@floatCapSep pt}%
\ifhv@framedCaption
\fbox{\usebox{\hvCaptionBox}}%
\else
\usebox{\hvCaptionBox}%
\fi%
\fi%
\fi
\fi
\fi
\fi
                        \else
\ifx\hvSet@capPos\hv@Left  %  caption on left side
\ifx\hvSet@capVPos\hv@Center%
\ifhv@framedCaption%
\fbox{\parbox{\wd\hvCaptionBox}{\usebox{\hvCaptionBox}}}%
\else
\parbox{\wd\hvCaptionBox}{\usebox{\hvCaptionBox}}
\fi%
         \hspace{\hvSet@floatCapSep pt}% capfloatsep
\ifhv@framedObject%
\fbox{\parbox{\wd\hvObjectBox}{\usebox{\hvObjectBox}}}
\else
\parbox{\wd\hvObjectBox}{\usebox{\hvObjectBox}}
\fi%
\else%
\ifx\hvSet@capVPos\hv@Top % caption at top
\ifhv@framedCaption%
\fbox{\raisebox{-\height}{\usebox{\hvCaptionBox}}}%
\else
\raisebox{-\height}{\usebox{\hvCaptionBox}}%
\fi
\hspace{\hvSet@floatCapSep pt}% capfloatsep
\ifhv@framedObject%
\fbox{\raisebox{-\height}{\usebox{\hvObjectBox}}}%
\else
\raisebox{-\height}{\usebox{\hvObjectBox}}%
\fi%
\else% caption on bottom
\ifhv@framedCaption%
\fbox{\usebox{\hvCaptionBox}}
\else
\usebox{\hvCaptionBox}
\fi%
\hspace{\hvSet@floatCapSep pt}%
\ifhv@framedObject%
\fbox{\usebox{\hvObjectBox}}
\else
\usebox{\hvObjectBox}
\fi%
\fi%
\fi%
\else
\ifx\hvSet@capPos\hv@Top
\ifdim\wd\hvCaptionBox>\wd\hvObjectBox
\begin{minipage}{\wd\hvCaptionBox}
\else
\begin{minipage}{\wd\hvObjectBox}
\fi
\centering
\ifhv@framedCaption%
\fbox{\usebox{\hvCaptionBox}}\\[\hvBelowCaptionSkip]
\else
\usebox{\hvCaptionBox}\\[\hvBelowCaptionSkip]%
\fi%
\ifhv@framedObject%
\fbox{\usebox{\hvObjectBox}}%
\else
\usebox{\hvObjectBox}%
\fi%
\end{minipage}
\else
\ifx\hvSet@capPos\hv@Bottom
\ifdim\wd\hvCaptionBox>\wd\hvObjectBox
\begin{minipage}{\wd\hvCaptionBox}
\else
\begin{minipage}{\wd\hvObjectBox}
\fi
\centering
\ifhv@framedObject
\fbox{\usebox{\hvObjectBox}}\\[\hvAboveCaptionSkip]
\else
\usebox{\hvObjectBox}\\[\hvAboveCaptionSkip]
\fi%
\ifhv@framedCaption
\fbox{\usebox{\hvCaptionBox}}%
\else
\usebox{\hvCaptionBox}%
\fi%
\end{minipage}
\else% the last option: put the caption on the right
\ifx\hvSet@capVPos\hv@Center%
\ifhv@framedObject
\fbox{\parbox{\wd\hvObjectBox}{\usebox{\hvObjectBox}}}
\else
\parbox{\wd\hvObjectBox}{\usebox{\hvObjectBox}}
\fi%
\hspace{\hvSet@floatCapSep pt}%
\ifhv@framedCaption
\fbox{\parbox{\wd\hvCaptionBox}{\usebox{\hvCaptionBox}}}%
\else
\parbox{\wd\hvCaptionBox}{\usebox{\hvCaptionBox}}
\fi%
\else%
\ifx\hvSet@capVPos\hv@Top
\ifhv@framedObject
\fbox{\raisebox{-\height}{\usebox{\hvObjectBox}}}%
\else
\raisebox{-\height}{\usebox{\hvObjectBox}}%
\fi%
\hspace{\hvSet@floatCapSep pt}%
\ifhv@framedCaption
\fbox{\raisebox{-\height}{\usebox{\hvCaptionBox}}}%
\else
\raisebox{-\height}{\usebox{\hvCaptionBox}}%
\fi
\else
\ifhv@framedObject
\fbox{\usebox{\hvObjectBox}}%
\else
\usebox{\hvObjectBox}%
\fi
\hspace{\hvSet@floatCapSep pt}%
\ifhv@framedCaption
\fbox{\usebox{\hvCaptionBox}}%
\else
\usebox{\hvCaptionBox}%
\fi%
\fi%
\fi
\fi
\fi
\fi
\fi}% End savebox Object and caption
\ifx\hvSet@rotAngle\hv@Zero
\usebox{\@tempboxa}
\else
\rotatebox{\hvSet@rotAngle}{\usebox{\@tempboxa}}
\fi
\ifhv@nonFloat
\ifx\hvSet@objectPos\hv@Center
\ifhv@nonFloat
\hspace{\fill}
\fi
\fi
\endgroup% End the nonfloat part
\else
\end{\hv@floatType}% End the floating environment
\fi
\ifhv@fbox % reset local settings
    \setkeys{hvSet}{framedCaption=true, framedObject=true}
\fi
}
%% 
%% Copyright © 2011  Vafa Khalighi <vafa018@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.
%% 
%% 
%% 
%%
%% End of file `hvfloat-luapersian.def'.
