]> git.saurik.com Git - wxWidgets.git/blobdiff - src/html/htmprint.cpp
Added missing includes
[wxWidgets.git] / src / html / htmprint.cpp
index 4625c82e897bb18df6fe05456a1cc4dd1aed8f42..cacbefbc60939d9025ffdb3cb90efe7c11d2e87c 100644 (file)
@@ -22,6 +22,8 @@
     #include "wx/intl.h"
     #include "wx/dc.h"
     #include "wx/settings.h"
     #include "wx/intl.h"
     #include "wx/dc.h"
     #include "wx/settings.h"
+    #include "wx/msgdlg.h"
+    #include "wx/module.h"
 #endif
 
 #include "wx/print.h"
 #endif
 
 #include "wx/print.h"
@@ -29,7 +31,6 @@
 #include "wx/html/htmprint.h"
 #include "wx/wxhtml.h"
 #include "wx/wfstream.h"
 #include "wx/html/htmprint.h"
 #include "wx/wxhtml.h"
 #include "wx/wfstream.h"
-#include "wx/module.h"
 
 
 //--------------------------------------------------------------------------------
 
 
 //--------------------------------------------------------------------------------
@@ -250,7 +251,7 @@ bool wxHtmlPrintout::OnBeginDocument(int startPage, int endPage)
 bool wxHtmlPrintout::OnPrintPage(int page)
 {
     wxDC *dc = GetDC();
 bool wxHtmlPrintout::OnPrintPage(int page)
 {
     wxDC *dc = GetDC();
-    if (dc)
+    if (dc && dc->IsOk())
     {
         if (HasPage(page))
             RenderPage(dc, page);
     {
         if (HasPage(page))
             RenderPage(dc, page);
@@ -263,19 +264,19 @@ bool wxHtmlPrintout::OnPrintPage(int page)
 void wxHtmlPrintout::GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo)
 {
     *minPage = 1;
 void wxHtmlPrintout::GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo)
 {
     *minPage = 1;
-    if ( m_NumPages >= (signed)m_PageBreaks.Count()-1)
+    if ( m_NumPages >= (signed)m_PageBreaks.GetCount()-1)
         *maxPage = m_NumPages;
     else
         *maxPage = m_NumPages;
     else
-        *maxPage = (signed)m_PageBreaks.Count()-1;
+        *maxPage = (signed)m_PageBreaks.GetCount()-1;
     *selPageFrom = 1;
     *selPageFrom = 1;
-    *selPageTo = (signed)m_PageBreaks.Count()-1;
+    *selPageTo = (signed)m_PageBreaks.GetCount()-1;
 }
 
 
 
 bool wxHtmlPrintout::HasPage(int pageNum)
 {
 }
 
 
 
 bool wxHtmlPrintout::HasPage(int pageNum)
 {
-    return (pageNum >= 1 && pageNum-1 <= (signed)m_PageBreaks.Count());
+    return pageNum > 0 && (unsigned)pageNum < m_PageBreaks.GetCount();
 }
 
 
 }
 
 
@@ -373,9 +374,9 @@ void wxHtmlPrintout::CountPages()
                                  m_PageBreaks,
                                  pos, true, INT_MAX);
         m_PageBreaks.Add( pos);
                                  m_PageBreaks,
                                  pos, true, INT_MAX);
         m_PageBreaks.Add( pos);
-        if( m_PageBreaks.Count() > wxHTML_PRINT_MAX_PAGES)
+        if( m_PageBreaks.GetCount() > wxHTML_PRINT_MAX_PAGES)
         {
         {
-            wxMessageBox( _("HTML pagination algorithm generated more than the allowed maximum number of pages and it can continue any longer!"),
+            wxMessageBox( _("HTML pagination algorithm generated more than the allowed maximum number of pages and it can't continue any longer!"),
             _("Warning"), wxCANCEL | wxICON_ERROR );
             break;
         }
             _("Warning"), wxCANCEL | wxICON_ERROR );
             break;
         }
@@ -439,9 +440,15 @@ wxString wxHtmlPrintout::TranslateHeader(const wxString& instr, int page)
     num.Printf(wxT("%i"), page);
     r.Replace(wxT("@PAGENUM@"), num);
 
     num.Printf(wxT("%i"), page);
     r.Replace(wxT("@PAGENUM@"), num);
 
-    num.Printf(wxT("%i"), m_PageBreaks.Count()-1);
+    num.Printf(wxT("%lu"), (unsigned long)(m_PageBreaks.GetCount() - 1));
     r.Replace(wxT("@PAGESCNT@"), num);
 
     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;
 }
 
     return r;
 }