%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -*- Mode: Latex -*- %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% aamyletter.sty -- My default letter style.
%% 
%% Author          : Anders Andersen
%% Created On      : Tue Nov  5 13:58:59 1996
%% Last Modified By: Anders Andersen
%% Last Modified On: Fri Mar  9 10:18:33 2001
%% Status          : Unknown, Use with caution!
%% 
%% Unless other notices are present in any part of this file explicitly
%% claiming copyrights for other people and/or organizations, the contents
%% of this file is fully copyright (C) 1996 Norut IT, all rights reserved.
%% 
%% Permission is granted to make and distribute verbatim copies of this
%% document provided that the copyright notice and this permission notice
%% are preserved on all copies.
%% 
%% Permission is granted to copy and distribute modified versions of this
%% document under the conditions for verbatim copying, provided that the
%% entire resulting derived work is distributed under the terms of a
%% permission notice identical to this one.
%% 
%% If any other present copyright notices interfere with the copyright
%% claims above, these claims may be partially overruled by those notices.
%% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% --------------------------------------%--------------------------------------
% ---------------------------- Identification part ----------------------------
% --------------------------------------%--------------------------------------

\RequirePackage{rcs}
\RequirePackage{ifthen}

\RCS$Date: 2002/07/09 23:45:45 $
\RCS$RCSfile: aamyletter.sty,v $
\RCS$Revision: 1.1 $
\RCS$State: Exp $
\RCS$Author: aa $

\def\aabasenamex#1.#2,#3{#1}
\def\aafiletypex#1.#2,#3{#2}
\def\aabasename{\expandafter\aabasenamex\RCSRCSfile}
\ifthenelse{\equal{\@clsextension}{\expandafter\aafiletypex\RCSRCSfile}}{%
  \def\aafiletype{Class}}{%
  \def\aafiletype{Package}}
\ifthenelse{\equal{OK}{\RCSState}}{%
  \def\aastate{ }}{%
  \def\aastate{ (\RCSState) }}
\typeout{\aafiletype: `\aabasename' v\RCSRevision\aastate
  <\RCSRawDate> (\RCSAuthor)}

\NeedsTeXFormat{LaTeX2e}
\ifthenelse{\equal{\aafiletype}{Class}}{%
  \ProvidesClass{\aabasename}[\RCSRawDate]}{%
  \ProvidesPackage{\aabasename}[\RCSRawDate]}


% --------------------------------------%--------------------------------------
% -------------------------------- Start code ---------------------------------
% --------------------------------------%--------------------------------------

\newboolean{private}
\newboolean{logo}


% --------------------------------------%--------------------------------------
% -------------------------- Declaration of options ---------------------------
% --------------------------------------%--------------------------------------

\def\myname{Anders Andersen}%
\def\exname{}%
\def\privaddr{P.G.~Rodumsvei 12 \\ 9011 Troms{\o}}%
\def\privphone{77\,69\,12\,72}%
\def\mobphone{951\,80\,675}%
\def\emailaddr{aa@computer.org}%
\def\url{http://w3.to/andersen/}%

\DeclareOption{private}{\setboolean{private}{true}%
  \PassOptionsToPackage{winenv}{aaletter}}
\DeclareOption{office}{\setboolean{private}{false}%
  \PassOptionsToPackage{winenv}{aaletter}%
  \def\workaddr{Universitetet i Troms{\o} \\ 9037 Tromsø}%
  \def\workphone{77\,64\,47\,03}%
  \def\faxphone{77\,64\,45\,80}}
\DeclareOption{ii}{\setboolean{private}{false}%
  \PassOptionsToPackage{winenv}{aaletter}%
  \def\exname{\\ Invenia Innovation AS}%
  \def\workaddr{Forskningsparken \\ 9291 Tromsø}%
  \def\workphone{77\,75\,75\,35}%
  \def\faxphone{77\,75\,75\,01}%
  \def\url{http://ii.invenia.no/}}
\DeclareOption{logo}{\setboolean{logo}{true}}
\DeclareOption{nologo}{\setboolean{logo}{false}}
\DeclareOption{norsk}{%
  \def\country{}
  \def\workaddrname{Arbeid}
  \def\othername{Nett}
  \def\workname{arb}%
  \def\privname{priv}%
  \def\ipc{}%
  \PassOptionsToPackage{norsk}{aaletter}}
\DeclareOption{english}{%
  \def\country{Norway}
  \def\workaddrname{Work}
  \def\othername{Net}
  \def\workname{work}%
  \def\privname{priv}%
  \def\ipc{+47}%
  \PassOptionsToPackage{english}{aaletter}}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{aaletter}}


% --------------------------------------%--------------------------------------
% --------------------------- Execution of options ----------------------------
% --------------------------------------%--------------------------------------

\ExecuteOptions{norsk,nologo,private}
\ProcessOptions


% --------------------------------------%--------------------------------------
% ------------------------------ Package loading ------------------------------
% --------------------------------------%--------------------------------------

\RequirePackage{aaletter}[1996/11/05]
\ifthenelse{\boolean{logo}}{\RequirePackage{graphics}}{}


% --------------------------------------%--------------------------------------
% --------------------------------- Main code ---------------------------------
% --------------------------------------%--------------------------------------

\AtBeginDocument{%
  \signature{\myname\exname}%
  \ifthenelse{\boolean{private}}{%
    \name{\myname}%
    \address{\privaddr
      \ifx\@empty\country \else \\ \country\fi}}{%
    \name{\myname}%
    \ifthenelse{\boolean{logo}}{%
      \def\info@one{\raisebox{-1.05\baselineskip}{\scalebox{0.28}{%
            \includegraphics{aalogo.ps}}}}}{}
    \location{\privaddr
      \ifx\@empty\country \else , \country\fi}
    \otherinfo{\workaddrname}{\workaddr%
      \ifx\@empty\country \else , \country\fi}
    \telephone{\ipc~\privphone~(\privname) \\
      \ipc~\workphone~(\workname)}
    \otherinfo{Mob/Fax}{\ipc~\mobphone~(mob) \\
      \ipc~\faxphone~(fax)}
    \otherinfo{\othername}{\makebox[0pt][l]{mailto:\emailaddr} \\
      \makebox[0pt][l]{\url}}}}
