add @DATE@, @TIME@ and @TITLE@ macros to HTML printing (extended/modified patch 1528679)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40370 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-07-29 20:45:13 +00:00
parent 40e0cf4894
commit 766571a703
4 changed files with 29 additions and 18 deletions

View File

@@ -115,11 +115,7 @@ Set page header.
\wxheading{Parameters}
\docparam{header}{HTML text to be used as header. You can use macros in it:
\begin{itemize}\itemsep=0pt
\item @PAGENUM@ is replaced by page number
\item @PAGESCNT@ is replaced by total number of pages
\end{itemize}
\input htprintmacros.inc
}
\docparam{pg}{one of wxPAGE\_ODD, wxPAGE\_EVEN and wxPAGE\_ALL constants.}
@@ -133,11 +129,7 @@ Set page footer.
\wxheading{Parameters}
\docparam{footer}{HTML text to be used as footer. You can use macros in it:
\begin{itemize}\itemsep=0pt
\item @PAGENUM@ is replaced by page number
\item @PAGESCNT@ is replaced by total number of pages
\end{itemize}
\input htprintmacros.inc
}
\docparam{pg}{one of wxPAGE\_ODD, wxPAGE\_EVEN and wxPAGE\_ALL constants.}

View File

@@ -50,10 +50,7 @@ Sets page footer.
\wxheading{Parameters}
\docparam{footer}{HTML text to be used as footer. You can use macros in it:
\begin{itemize}
\item @PAGENUM@ is replaced by page number
\item @PAGESCNT@ is replaced by total number of pages
\end{itemize}
\input htprintmacros.inc
}
\docparam{pg}{one of wxPAGE\_ODD, wxPAGE\_EVEN and wxPAGE\_ALL constants.}
@@ -68,10 +65,7 @@ Sets page header.
\wxheading{Parameters}
\docparam{header}{HTML text to be used as header. You can use macros in it:
\begin{itemize}
\item @PAGENUM@ is replaced by page number
\item @PAGESCNT@ is replaced by total number of pages
\end{itemize}
\input htprintmacros.inc
}
\docparam{pg}{one of wxPAGE\_ODD, wxPAGE\_EVEN and wxPAGE\_ALL constants.}

View File

@@ -0,0 +1,19 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Name: htprint.inc
%% Purpose: Macros which can be used with wxHtmlPrintout: this file is
%% included from several locations where we list these macros
%% Author: Vadim Zeitlin
%% Created: 2006-07-29
%% RCS-ID: $Id$
%% Copyright: (c) 2006 Vadim Zeitlin
%% License: wxWindows license
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{itemize}\itemsep=0pt
\item @DATE@ is replaced by the current date in default format
\item @PAGENUM@ is replaced by page number
\item @PAGESCNT@ is replaced by total number of pages
\item @TIME@ is replaced by the current time in default format
\item @TITLE@ is replaced with the title of the document
\end{itemize}

View File

@@ -443,6 +443,12 @@ wxString wxHtmlPrintout::TranslateHeader(const wxString& instr, int page)
num.Printf(wxT("%lu"), (unsigned long)(m_PageBreaks.Count() - 1));
r.Replace(wxT("@PAGESCNT@"), num);
const wxDateTime now = wxDateTime::Now();
r.Replace(wxT("@DATE@"), now.FormatDate());
r.Replace(wxT("@TIME@"), now.FormatTime());
r.Replace(wxT("@TITLE@"), GetTitle());
return r;
}