]> git.saurik.com Git - wxWidgets.git/blobdiff - src/html/m_layout.cpp
cast corrected
[wxWidgets.git] / src / html / m_layout.cpp
index e501f1f6dc7a3853bf7239dd3b19d31c74c3643c..2464a5a9cecb7c3640714b43423c05559c5f4bfb 100644 (file)
@@ -6,7 +6,7 @@
 // Copyright:   (c) 1999 Vaclav Slavik
 // Licence:     wxWindows Licence
 /////////////////////////////////////////////////////////////////////////////
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
 #pragma implementation
 #endif
 
@@ -66,19 +66,25 @@ FORCE_LINK_ME(m_layout)
 // array wxHtmlPrintout::m_PageBreaks of pagebreaks already set, and
 // set a new one only if it's not in that array.
 
-class WXDLLEXPORT wxHtmlPageBreakCell : public wxHtmlCell
+class wxHtmlPageBreakCell : public wxHtmlCell
 {
-  public:
+public:
     wxHtmlPageBreakCell() {}
 
-    bool AdjustPagebreak(int* pagebreak, int* known_pagebreaks = NULL, int number_of_pages = 0) const;
+    bool AdjustPagebreak(int* pagebreak,
+                         int* known_pagebreaks = NULL,
+                         int number_of_pages = 0) const;
+    void Draw(wxDC& WXUNUSED(dc),
+              int WXUNUSED(x), int WXUNUSED(y),
+              int WXUNUSED(view_y1), int WXUNUSED(view_y2),
+              wxHtmlRenderingInfo& WXUNUSED(info)) {}
 
-  private:
+private:
     DECLARE_NO_COPY_CLASS(wxHtmlPageBreakCell)
 };
 
 // Comparison routine for bsearch into an int* array of pagebreaks.
-static int integer_compare(void const* i0, void const* i1)
+extern "C" int wxCMPFUNC_CONV wxInteger_compare(void const* i0, void const* i1)
 {
     return *(int*)i0 - *(int*)i1;
 }
@@ -113,7 +119,7 @@ bool wxHtmlPageBreakCell::AdjustPagebreak(int* pagebreak, int* known_pagebreaks,
     // zero plus one element for each page.
     int* where = (int*) bsearch(&total_height, known_pagebreaks,
                                 1 + number_of_pages, sizeof(int),
-                                integer_compare);
+                                wxInteger_compare);
     // Add a pagebreak only if there isn't one already set here.
     if(NULL != where)
         {
@@ -127,10 +133,11 @@ bool wxHtmlPageBreakCell::AdjustPagebreak(int* pagebreak, int* known_pagebreaks,
 }
 
 TAG_HANDLER_BEGIN(P, "P")
+    TAG_HANDLER_CONSTR(P) { }
 
     TAG_HANDLER_PROC(tag)
     {
-        if (m_WParser->GetContainer()->GetFirstCell() != NULL)
+        if (m_WParser->GetContainer()->GetFirstChild() != NULL)
         {
             m_WParser->CloseContainer();
             m_WParser->OpenContainer();
@@ -145,6 +152,7 @@ TAG_HANDLER_END(P)
 
 
 TAG_HANDLER_BEGIN(BR, "BR")
+    TAG_HANDLER_CONSTR(BR) { }
 
     TAG_HANDLER_PROC(tag)
     {
@@ -164,6 +172,7 @@ TAG_HANDLER_END(BR)
 
 
 TAG_HANDLER_BEGIN(CENTER, "CENTER")
+    TAG_HANDLER_CONSTR(CENTER) { }
 
     TAG_HANDLER_PROC(tag)
     {
@@ -171,7 +180,7 @@ TAG_HANDLER_BEGIN(CENTER, "CENTER")
         wxHtmlContainerCell *c = m_WParser->GetContainer();
 
         m_WParser->SetAlign(wxHTML_ALIGN_CENTER);
-        if (c->GetFirstCell() != NULL)
+        if (c->GetFirstChild() != NULL)
         {
             m_WParser->CloseContainer();
             m_WParser->OpenContainer();
@@ -184,7 +193,7 @@ TAG_HANDLER_BEGIN(CENTER, "CENTER")
             ParseInner(tag);
 
             m_WParser->SetAlign(old);
-            if (c->GetFirstCell() != NULL)
+            if (c->GetFirstChild() != NULL)
             {
                 m_WParser->CloseContainer();
                 m_WParser->OpenContainer();
@@ -202,6 +211,7 @@ TAG_HANDLER_END(CENTER)
 
 
 TAG_HANDLER_BEGIN(DIV, "DIV")
+    TAG_HANDLER_CONSTR(DIV) { }
 
     TAG_HANDLER_PROC(tag)
     {
@@ -225,7 +235,7 @@ TAG_HANDLER_BEGIN(DIV, "DIV")
         {
             int old = m_WParser->GetAlign();
             wxHtmlContainerCell *c = m_WParser->GetContainer();
-            if (c->GetFirstCell() != NULL)
+            if (c->GetFirstChild() != NULL)
             {
                 m_WParser->CloseContainer();
                 m_WParser->OpenContainer();
@@ -242,7 +252,7 @@ TAG_HANDLER_BEGIN(DIV, "DIV")
             ParseInner(tag);
 
             m_WParser->SetAlign(old);
-            if (c->GetFirstCell() != NULL)
+            if (c->GetFirstChild() != NULL)
             {
                 m_WParser->CloseContainer();
                 m_WParser->OpenContainer();
@@ -250,11 +260,20 @@ TAG_HANDLER_BEGIN(DIV, "DIV")
             else
                 c->SetAlignHor(old);
 
-            return TRUE;
+            return true;
         }
         else
         {
-            return FALSE;
+            // Same as BR
+            int al = m_WParser->GetContainer()->GetAlignHor();
+            wxHtmlContainerCell *c;
+
+            m_WParser->CloseContainer();
+            c = m_WParser->OpenContainer();
+            c->SetAlignHor(al);
+            c->SetAlign(tag);
+            c->SetMinHeight(m_WParser->GetCharHeight());
+            return false;
         }
     }
 
@@ -264,6 +283,7 @@ TAG_HANDLER_END(DIV)
 
 
 TAG_HANDLER_BEGIN(TITLE, "TITLE")
+    TAG_HANDLER_CONSTR(TITLE) { }
 
     TAG_HANDLER_PROC(tag)
     {
@@ -286,6 +306,7 @@ TAG_HANDLER_END(TITLE)
 
 
 TAG_HANDLER_BEGIN(BODY, "BODY")
+    TAG_HANDLER_CONSTR(BODY) { }
 
     TAG_HANDLER_PROC(tag)
     {
@@ -315,6 +336,7 @@ TAG_HANDLER_END(BODY)
 
 
 TAG_HANDLER_BEGIN(BLOCKQUOTE, "BLOCKQUOTE")
+    TAG_HANDLER_CONSTR(BLOCKQUOTE) { }
 
     TAG_HANDLER_PROC(tag)
     {
@@ -345,7 +367,9 @@ TAG_HANDLER_END(BLOCKQUOTE)
 // Tag handler for tags that we have to ignore, otherwise non-text data
 // would show up as text:
 TAG_HANDLER_BEGIN(DoNothing, "SCRIPT")
-    TAG_HANDLER_PROC(tag)
+    TAG_HANDLER_CONSTR(DoNothing) { }
+
+    TAG_HANDLER_PROC(WXUNUSED(tag))
     {
         return true;
     }