%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% PDF specfic commands
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\cmisgraphics}[3]
{
\begin{figure}[htb]
\centering
\includegraphics[#2]{images/#1.pdf}
\caption{#3}
\end{figure}
\FloatBarrier
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Errata
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\errataadd}[1]
{
{\color{erratagreen}{#1}}
}

\newcommand{\errataremove}[1]
{
{\color{erratagreen}\sout{#1}}
}

\newcommand{\erratareplace}[2]
{
{\color{erratagreen}\sout{#1} #2}
}

\newcommand{\erratatitle}[1]
{\fontspec[Color=red]{Arial}{#1}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% CMIS title sections
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\oasistitle}[1]
{
\begin{spacing}{1.5}
\fontspec[Color=552681]{Arial}
\fontsize{24}{24}
\textbf{\noindent#1}
\end{spacing}
}

\newcommand{\oasisstagelabel}[1]
{
\begin{spacing}{1.1}
\fontspec[Color=552681]{Arial}
\fontsize{18}{18}
\textbf{\noindent#1}
\end{spacing}
}

\newcommand{\oasisdate}[1]
{
\begin{spacing}{1.1}
\fontspec[Color=552681]{Arial}
\fontsize{18}{18}
\textbf{\noindent#1}
\end{spacing}
}

\newcommand{\oasisnoticelabel}[1]
{
\begin{spacing}{1.5}
\fontspec[Color=552681]{Arial}
\fontsize{18}{18}
\textbf{\noindent#1}
\end{spacing}
}

\newcommand{\oasisspecificationuris}[1]
{
{
\fontspec[Color=552681]{Arial}
\fontsize{12}{12}
\textbf{\noindent#1}
}
}

\newenvironment{oasistitlesection}[1]
{
\begin{tabular}{p{0.4in}p{5.8in}}
\multicolumn{2}{l}{\fontspec[Color=552681]{Arial}\fontsize{10}{10}\textbf{#1:}}\\[-0.05in]
&\setlength{\topsep}{0in}\setlength{\parsep}{0in}\setlength{\partopsep}{0in}   }
{
\end{tabular}
\vspace{-0.11in}
}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% CMIS type attributes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% new environment: CMIS type attribute
\newenvironment{cmisattribute}[2]
{
\vspace{0.05in}
\begin{tabular}{p{2in}l}
\texttt{\textbf{#1}} & #2\\
\end{tabular}\\\
\begin{tabular}{p{0.3in}p{5.7in}}
&}
{\\
\end{tabular}\\
\vspace{0.05in}
}

% new command: CMIS type attribute value
\newcommand{\cmisattributevalue}[2]
{
\vspace{0.05in}
\noindent
\texttt{\textbf{#1}}\\
\indent
Value: #2
\vspace{0.05in}
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% CMIS properties
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% new environment: CMIS property
\newenvironment{cmisproperty}[2]
{
\vspace{0.05in}
\begin{tabular}{p{0.1in}p{2.3in}p{3.5in}}
\multicolumn{2}{p{1.8in}}{\textbf{\texttt{#1}}} & #2\vspace{0.05in}\\
}
{
\end{tabular}\\
\vspace{0.05in}\\
}

% new command: CMIS property detail
\newcommand{\cmispropertydetail}[2]{& #1: & #2\\}

% new command: CMIS property comment
\newcommand{\cmispropertycomment}[1]{\\&\multicolumn{2}{p{5.7in}}{#1}\\}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% CMIS allowable actions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% new environment: CMIS allowable action
\newenvironment{cmisallowableaction}[1]
{
\vspace{0.05in}
\noindent
\textbf{#1}
\vspace{0.05in}\\
\begin{tabular}{p{0.1in}p{1in}p{4.8in}}
}
{
\end{tabular}\\
\vspace{0.05in}\\
}

% new command: CMIS allowable action detail
\newcommand{\cmisallowableactiondetail}[2]{& #1: & #2\\}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% CMIS version properties
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% new environment: CMIS version property
\newenvironment{cmisversionproperty}[2]
{
\vspace{0.05in}
\begin{tabular}{p{3in}l}
\texttt{\textbf{#1}} & #2\\
\end{tabular}\\\
\begin{tabular}{p{0.3in}p{5.7in}}
&}
{\\
\end{tabular}\\
\vspace{0.05in}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% CMIS general description
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% new environment: CMIS description
\newenvironment{cmisdescription}[1]
{
\vspace{0.05in}
\noindent
\begin{tabular}{p{0.1in}p{5.9in}}
\multicolumn{2}{l}{\textbf{#1:}}\\
&\setlength{\topsep}{0in}\setlength{\parsep}{0in}\setlength{\partopsep}{0in}   }
{\\
\end{tabular}\\
\vspace{0.05in}
}


\newenvironment{cmisexample}[1]
{
\vspace{0.2in}
\begin{shaded}
\textbf{Example:}\\
Request: \texttt{#1-request.log}\\
Response: \texttt{#1-response.log}
\end{shaded}
\vspace{0.2in}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% CMIS services
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\cmisserviceref}[1]{\ref{dm:service:#1}~\nameref{dm:service:#1}}

\newcommand{\cmisservicelink}[1]{\texttt{\textmd{\nameref{dm:service:#1}}}}

\newcommand{\cmisexceptionlink}[1]{\texttt{\hyperref[dm:exception:#1]{#1}}}

\newenvironment{cmisservice}[1]
{
\pagebreak[4]
%\rule[-0.1in]{6in}{0.01in}
\subsubsection{#1}
\label{dm:service:#1}
}
{}

\newenvironment{cmisservicedescription}[1]
{\noindent\textbf{#1:}}{\vspace{0.05in}}

\newenvironment{cmisserviceinputs}
{
\paragraph{Inputs}
}
{}

\newenvironment{cmisservicerequired}
{
\textbf{Required:}
\begin{itemize}
}
{
\end{itemize}
}

\newenvironment{cmisserviceoptional}
{
\textbf{Optional:}
\begin{itemize}
}
{
\end{itemize}
}

\newenvironment{cmisserviceoutputs}
{
\paragraph{Outputs}
\begin{itemize}
}
{
\end{itemize}
}

\newenvironment{cmisserviceexpections}
{
\paragraph{Exceptions Thrown \& Conditions}
\begin{sloppypar}
}
{\end{sloppypar}}

\newenvironment{cmisserviceinout}[2]
{
\item \textbf{#1 \texttt{#2}:}
}
{}

\newcommand{\cmisserviceinoutnone}{\item None.}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% CMIS AtomPub
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% new envirnoment cmisatompubmedia
\newenvironment{cmisatompubmedia}
{
\begin{tabular}{p{1.5in}p{4.7in}}
}
{
\end{tabular}\hfill\\\\
}

\newcommand{\cmisatompubxml}[2]{\lstinputlisting[language=XML,title=#1]{atompub/#2}}

\newcommand{\cmisatompubhttp}[2]{\lstinputlisting[language=CMISAtomPubHTTP,title=#1]{atompub/#2}}


% new envirnoments cmisatompublink
\newenvironment{cmisatompublink}[1]
{
\vspace{0.1in}
\noindent
\texttt{\textbf{#1}}
\begin{itemize}
}
{
\end{itemize}
\vspace{0.05in}
}


% new envirnoments cmisatompubitems
\newenvironment{cmisatompubitems}[1]
{
\vspace{0.1in}
\noindent
#1:
\begin{itemize*}
\setlength{\leftskip}{0.3in}
}
{
\end{itemize*}
}

% new envirnoments cmisatompubdescs
\newenvironment{cmisatompubdescs}[1]
{
\vspace{0.1in}
\noindent
#1:
\begin{description}
\setlength{\leftskip}{0.3in}
}
{
\end{description}
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% CMIS Browser Binding
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\cmisbrowserGET}[5]
{
\ifthenelse{\isempty{#2}}{}{\subsubsection{Selector "#2"}}

\begin{tabular}{p{1.7in}p{4.7in}}
	\ifthenelse{\equal{#2}{lastResult}}{}{\textbf{Service:} & \cmisservicelink{#1}\\[0.05in]}
	\textbf{HTTP method:} & GET\\[0.05in]
	\textbf{Argument} \texttt{cmisselector}: & \texttt{#2}\\[0.05in]
	\textbf{Arguments:} & #3\\[0.05in]
	\textbf{Response:} & #4\\[0.05in]
	\textbf{Schema Element:} & \path{#5}\\[0.05in]
	\textbf{Success HTTP\newline status code:} & 200 OK
\end{tabular}
}

\newcommand{\cmisbrowserPOST}[6]
{
\subsubsection{Action "#2"}

\begin{tabular}{p{1.7in}p{4.7in}}
	\textbf{Service:} & \cmisservicelink{#1}\\[0.05in]
	\textbf{HTTP method:} & POST\\[0.05in]
	\textbf{Control} \texttt{cmisaction}: & \texttt{#2}\\[0.05in]
	\textbf{Relevant\newline CMIS Controls:} & #3\\[0.05in]
	\textbf{Response:} & #4\\[0.05in]
	\textbf{Schema Element:} & \path{#5}\\[0.05in]
	\textbf{Success HTTP\newline status code:} & #6
\end{tabular}
}

\newcommand{\cmisbrowsercontrol}[2]
{
\begin{tabular}{p{1.2in}p{5.5in}}
	\textbf{Control name:} & \texttt{#1}\\
	\textbf{Control value:} & #2
\end{tabular}
}

\newcommand{\cmisjsonhttp}[2]{\lstinputlisting[language=CMISJSONHTTP,title=#1]{browser/#2}}

