\NeedsTeXFormat{LaTeX2e}[1996/06/01]
\ProvidesPackage{Franc-chap}[1997/01/15]
\RequirePackage[Bjarne]{fncychap}
% Jean-Pierre Drucbert
% from Bjarne option of fncychap.sty
%%%%%%% FRANC DEF
%%%%% NUMÉROS LITTÉRAUX EN FRANÇAIS (<=99; >=0)

% pb \appendix 17Dec96
\let\sv@appendix\appendix
\newif\ifappendix\appendixfalse
\def\appendix{\sv@appendix\appendixtrue}

%\DeclareOption{Franc}{%
  \ChNameUpperCase
  \ChTitleUpperCase  
% \ChNameVar{\raggedleft\normalsize\rm}
% \ChNumVar{\raggedleft \bfseries\Large}
  \ChNameVar{\raggedleft\normalsize\sffamily\bfseries}
  \ChNumVar{\raggedleft\Large\sffamily\bfseries}
%  \ChTitleVar{\raggedleft \Large\rm}
  \ChTitleVar{\raggedleft \bfseries\LARGE\sf\bfseries}
  \ChRuleWidth{1pt}

%  \newcounter{AlphaCnt}
%  \newcounter{AlphaDecCnt}
  \newcounter{UnitsCnt}
  \renewcommand{\AlphaNo}{%
    \ifcase\number\theAlphaCnt
      \ifnum\number\thechapter=0
        ZÉRO\else{}\fi
    \or
    \ifnum\number\thechapter>20
    \def\@sepAlpha{}%
    \ifnum\number\thechapter<80 ET \fi UN\fi
    \or DEUX\or TROIS\or QUATRE\or CINQ
    \or SIX\or SEPT\or HUIT\or NEUF\or DIX
    \or ONZE\or DOUZE\or TREIZE\or QUATORZE\or QUINZE
    \or SEIZE\or DIX-SEPT\or DIX-HUIT\or DIX-NEUF\fi
}

  \renewcommand{\AlphaDecNo}{%
    \setcounter{AlphaDecCnt}{0}
    \@whilenum\number\theAlphaCnt>0\do
      {\addtocounter{AlphaCnt}{-10}
       \def\@sepAlpha{}
       \addtocounter{AlphaDecCnt}{1}}
     \ifnum\number\theAlphaCnt=0
     \else
       \addtocounter{AlphaDecCnt}{-1}
       \def\@sepAlpha{-}
% CALCULER UnitsCnt. Si = 0 ou 1, pas de separateur.
       \setcounter{UnitsCnt}{\number\thechapter}
       \divide\c@UnitsCnt by 10
       \multiply\c@UnitsCnt by 10
       \@tempcnta=\c@chapter
       \advance\@tempcnta by -\c@UnitsCnt
       \c@UnitsCnt=\@tempcnta
       \ifnum\number\theUnitsCnt<2\def\@sepAlpha{ }\fi
       \addtocounter{AlphaCnt}{10}
     \fi
     
     
    \ifcase\number\theAlphaDecCnt\or DIX\or VINGT\or TRENTE\or
    QUARANTE\or CINQUANTE\or SOIXANTE\or SOIXANTE-DIX\or
    QUATRE-VINGT\or QUATRE-VINGT-DIX\fi
    }
  \renewcommand{\TheAlphaChapter}{%
  \ifappendix\thechapter\else % in appendices, get just the letter
    \ifnum\number\thechapter>99
    \thechapter
    \else
    \ifnum\number\thechapter<0
    \thechapter
    \else
    \setcounter{AlphaCnt}{\number\thechapter}
    \ifnum\number\thechapter<20
      \ifnum\number\thechapter=1
      PREMIER
      \else
      \AlphaNo
      \fi
    \else\ifnum\number\thechapter<70
      \ifnum\number\theAlphaCnt=0
      \AlphaDecNo
      \else
      \ifnum\number\theAlphaCnt=1
      \AlphaDecNo et Un
      \else
      \AlphaDecNo\@sepAlpha\AlphaNo
      \fi\fi
    \else\ifnum\number\thechapter<80
      %70 à 79
      \setcounter{UnitsCnt}{\number\thechapter}
      \addtocounter{UnitsCnt}{-70}
       \ifcase\number\theUnitsCnt
	SOIXANTE-DIX
	\or SOIXANTE ET ONZE%
	\or SOIXANTE-DOUZE%
	\or SOIXANTE-TREIZE%
	\or SOIXANTE-QUATORZE%
	\or SOIXANTE-QUINZE%
	\or SOIXANTE-SEIZE%
	\or SOIXANTE-DIX-SEPT%
	\or SOIXANTE-DIX-HUIT%
	\or SOIXANTE-DIX-NEUF\fi
    \else\ifnum\number\thechapter<90
      \AlphaDecNo\@sepAlpha\AlphaNo
    \else
      \setcounter{UnitsCnt}{\number\thechapter}
      \addtocounter{UnitsCnt}{-90}
       \ifcase\number\theUnitsCnt
	QUATRE-VINGT-DIX
	\or QUATRE-VINGT-ONZE%
	\or QUATRE-VINGT-DOUZE%
	\or QUATRE-VINGT-TREIZE%
	\or QUATRE-VINGT-QUATORZE%
	\or QUATRE-VINGT-QUINZE%
	\or QUATRE-VINGT-SEIZE%
	\or QUATRE-VINGT-DIX-SEPT%
	\or QUATRE-VINGT-DIX-HUIT%
	\or QUATRE-VINGT-DIX-NEUF\fi
    \fi\fi\fi\fi
    \fi\fi
    \fi
    }

  \renewcommand{\DOCH}{%
    \mghrulefill{\RW}\par\nobreak
    \CNV\FmN{\@chapapp}\par\nobreak 
    \CNoV\TheAlphaChapter\par\nobreak
    \vskip -1\baselineskip\vskip 5pt\mghrulefill{\RW}\par\nobreak
    \vskip 20\p@
    }
  \renewcommand{\DOTI}[1]{%
    \CTV\FmTi{#1}\par\nobreak
    \vskip 40\p@
    }
  \renewcommand{\DOTIS}[1]{%
    \CTV\FmTi{#1}\par\nobreak
    \vskip 40\p@
    }
%}
\endinput
