]> git.saurik.com Git - wxWidgets.git/blobdiff - src/html/htmprint.cpp
todos, cleanups, detabified
[wxWidgets.git] / src / html / htmprint.cpp
index 720bde4849a338cdbfaa1837e0741d7996e52110..d9623d0a6e413d6970f7fa1780eb603c88dbf835 100644 (file)
@@ -37,6 +37,7 @@
 #include "wx/wxhtml.h"
 #include "wx/wfstream.h"
 #include "wx/module.h"
+#include "wx/settings.h"
 
 
 //--------------------------------------------------------------------------------
@@ -97,7 +98,17 @@ void wxHtmlDCRenderer::SetFonts(wxString normal_face, wxString fixed_face,
                                 const int *sizes)
 {
     m_Parser->SetFonts(normal_face, fixed_face, sizes);
-    if (m_DC == NULL && m_Cells != NULL) m_Cells->Layout(m_Width);
+    if (m_DC == NULL && m_Cells != NULL)
+        m_Cells->Layout(m_Width);
+}
+
+void wxHtmlDCRenderer::SetStandardFonts(int size,
+                                        const wxString& normal_face,
+                                        const wxString& fixed_face)
+{
+    m_Parser->SetStandardFonts(size, normal_face, fixed_face);
+    if (m_DC == NULL && m_Cells != NULL)
+        m_Cells->Layout(m_Width);
 }
 
 
@@ -284,7 +295,12 @@ void wxHtmlPrintout::SetHtmlText(const wxString& html, const wxString &basepath,
 void wxHtmlPrintout::SetHtmlFile(const wxString& htmlfile)
 {
     wxFileSystem fs;
-    wxFSFile *ff = fs.OpenFile(htmlfile);
+    wxFSFile *ff;
+    
+    if (wxFileExists(htmlfile))
+        ff = fs.OpenFile(wxFileSystem::FileNameToURL(htmlfile));
+    else
+        ff = fs.OpenFile(htmlfile);
 
     if (ff == NULL)
     {
@@ -446,6 +462,14 @@ void wxHtmlPrintout::SetFonts(wxString normal_face, wxString fixed_face,
     m_RendererHdr->SetFonts(normal_face, fixed_face, sizes);
 }
 
+void wxHtmlPrintout::SetStandardFonts(int size,
+                                      const wxString& normal_face,
+                                      const wxString& fixed_face)
+{
+    m_Renderer->SetStandardFonts(size, normal_face, fixed_face);
+    m_RendererHdr->SetStandardFonts(size, normal_face, fixed_face);
+}
+
 
 
 //----------------------------------------------------------------------------
@@ -622,6 +646,7 @@ void wxHtmlEasyPrinting::SetFooter(const wxString& footer, int pg)
 void wxHtmlEasyPrinting::SetFonts(wxString normal_face, wxString fixed_face,
                                   const int *sizes)
 {
+    m_fontMode = FontMode_Explicit;
     m_FontFaceNormal = normal_face;
     m_FontFaceFixed = fixed_face;
 
@@ -634,12 +659,30 @@ void wxHtmlEasyPrinting::SetFonts(wxString normal_face, wxString fixed_face,
         m_FontsSizes = NULL;
 }
 
+void wxHtmlEasyPrinting::SetStandardFonts(int size,
+                                          const wxString& normal_face,
+                                          const wxString& fixed_face)
+{
+    m_fontMode = FontMode_Standard;
+    m_FontFaceNormal = normal_face;
+    m_FontFaceFixed = fixed_face;
+    m_FontsSizesArr[0] = size;
+}
+
 
 wxHtmlPrintout *wxHtmlEasyPrinting::CreatePrintout()
 {
     wxHtmlPrintout *p = new wxHtmlPrintout(m_Name);
 
-    p->SetFonts(m_FontFaceNormal, m_FontFaceFixed, m_FontsSizes);
+    if (m_fontMode == FontMode_Explicit)
+    {
+        p->SetFonts(m_FontFaceNormal, m_FontFaceFixed, m_FontsSizes);
+    }
+    else // FontMode_Standard
+    {
+        p->SetStandardFonts(m_FontsSizesArr[0],
+                            m_FontFaceNormal, m_FontFaceFixed);
+    }
 
     p->SetHeader(m_Headers[0], wxPAGE_EVEN);
     p->SetHeader(m_Headers[1], wxPAGE_ODD);