% This is a style file for formatting letters with the LETTER.STY 
% LaTeX2e format, but with a logo on the first page. Changing it to 
% older versions of LaTeX should be obvious.
% The variations are in the headings on letters (there is also an 
% Italian `lettera' environment with an added),
% and in the date format (there are an Italian 
% \oggi and a french \aujourdhui).
% Prepared by Pino Rosolini on Sep. 30 1994.
\ProvidesPackage{letterlogo}
% CAMBIATO TEMPORANEAMENTE
%\ProvidesPackage{MauraHD:Software:Software_Standard:Oztex1.7:FromPino:letterlogo}
\@ifclassloaded{letter}{}{\input letter.cls}

% The following redefine \raggedbottom and \flushbottom to put the 
% logo in place, and add an extra clause to \letter

\def\raggedbottom{\def\@texttop{\ifx\@empty\fromaddress\printLogo\fi\relax}%
 \def\@textbottom{\gdef\printLogo{\relax}\vskip \z@ \@plus.0001fil}}

\def\flushbottom{\def\@texttop{\ifx\@empty\fromaddress\printLogo\fi}%
 \def\@textbottom{\gdef\printLogo{\relax}\relax}}

\raggedbottom % default value as required in LaTeX user's guide

\let\s@v@letter\letter
\def\letter{\def\printLogo{\LogoPage\vskip \z@ \@plus.0001fil}\s@v@letter}

% \opening is re-\def'ed to improve presentation and set 
% \thispagestyle to empty

\def\opening#1{\thispagestyle{empty}\ifx\@empty\fromaddress
    {\raggedleft\@date\par}%
  \else  % home address
    {\raggedleft\begin{tabular}{l}\ignorespaces
      \fromaddress \\*[2\parskip]%
      \@date \end{tabular}\par}%
  \fi
  \vspace{2\parskip}%
  {\raggedright\toname\ifx\@empty\toname\relax\else\\\fi\toaddress \par}%
  \vspace{2\parskip}%
  #1\par\nobreak}

% \closing is re-\def'ed to remove the \if check

\long\def\closing#1{\par\nobreak\vspace{\parskip}%
  \stopbreaks
  \noindent
  %\ifx\@empty\fromaddress\else
  \hspace*{\longindentation}%\fi
  \parbox{\indentedwidth}{\raggedright
       \ignorespaces #1\\[6\medskipamount]%
       \ifx\@empty\fromsig
           \fromname
       \else \fromsig \fi\strut}%
   \par}

\renewcommand\pagename{p.} % changed because I like it better

%%% End of changes

% labels
\def\mlabel#1#2{\setbox0\hbox to 20cm{#1\qquad\parbox[t]{9cm}%
                               {\strut\ignorespaces #2}\hfil}%
  \vbox to .1in{\box0 \vss}}
\def\returnaddress{\noexpand\returnLogo}

%% The following three macros set up an Italian style
\def\apertura#1{\thispagestyle{empty}\ifx\@empty\fromaddress
  \relax
 \else 
 {\raggedright\begin{tabular}{l}\ignorespaces
 \fromaddress \\*[2\parskip]
 \end{tabular}\par}
 \fi
 {\raggedleft \hspace*{6cm}
 \parbox{5cm}{\raggedright
  \makebox[0pt][r]{\introhead{} }%
                       \toname\ifx\@empty\toname\relax\else\\\fi
                       \toaddress\par}\par}
  \vspace{2\parskip}
 #1\par\nobreak}

\long\def\chiusura#1{\par\nobreak\vspace{\parskip}%
  \stopbreaks
  \noindent
  %\ifx\@empty\fromaddress\else
  \parbox{0pt}{\hbox to 0pt{\@date\hss}}%
  \hspace*{\longindentation}%\fi
  \parbox{\indentedwidth}{\raggedright
       \ignorespaces #1\\[6\medskipamount]%
       \ifx\@empty\fromsig
           \fromname
       \else \fromsig \fi\strut}%
   \par}

\long\def\llettera[#1]{\renewcommand\ccname{p.c.}%
 \renewcommand\headtoname{A}
 \let\opening\apertura \let\closing\chiusura
 \def\introhead{#1}%
 \letter}

\def\lettera{\@ifnextchar[{\llettera}{\llettera[]}}
\def\endlettera{\endletter}

% date in Italian and in French
\def\oggi{\number\day\space\ifcase\month
 \relax\or gennaio\or febbraio\or marzo\or aprile\or maggio\or giugno%
 \or luglio\or agosto\or settembre\or ottobre\or novembre\or dicembre\fi 
 \space \number\year}
\def\aujourdhui{\number\day\space\ifcase\month
 \relax\or janvier\or f\'evrier\or mars\or avril\or mai\or juin%
 \or julliet\or ao\^ut\or septembre\or octobre\or novembre\or d\'ecembre\fi 
 \space\number\year}
\date{\message{Default is NO date}}

% email address
\def\email#1{\def\net{#1}}
\def\net{}
\let\netmail\email

\def\up#1{\leavevmode \raise.16ex\hbox{#1}} % suggested in the TeXbook

\let\LogoPage\relax
\let\returnLogo\relax
