lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master d68c078 3/5: Warn if cover page will overflow


From: Greg Chicares
Subject: [lmi-commits] [lmi] master d68c078 3/5: Warn if cover page will overflow
Date: Tue, 14 May 2019 16:19:06 -0400 (EDT)

branch: master
commit d68c0781bddc926d8e8d23f537c5a857b5bcd7e5
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Warn if cover page will overflow
    
    With a sufficiently long ProducerName (e.g.), the cover page must
    require more than a single physical page. Former behavior: an
    assertion fired somewhere in PDF-generation code, and no PDF file
    was produced. New behavior: a warning is given, and then a PDF file
    with the warned-of cosmetic anomaly is produced.
    
    * cover.mst: Removed some <br> elements to prevent the cover page from
      overflowing in a simple default case.
    * pdf_command_wx.cpp: Made standard_page::get_extra_pages_needed()
      protected so that it can be called from derived classes.
    
    Although this revision's purpose is to improve the illustration reg and
    group private placement formats, the 'cover.mst' change would affect
    finra cover pages as well, but no observed effect seemed unacceptable.
---
 cover.mst          |  2 --
 pdf_command_wx.cpp | 51 +++++++++++++++++++--------------------------------
 2 files changed, 19 insertions(+), 34 deletions(-)

diff --git a/cover.mst b/cover.mst
index e1b759c..a9f376e 100644
--- a/cover.mst
+++ b/cover.mst
@@ -136,8 +136,6 @@ it roughly where we want it to appear.
 <p align="center"><img inv_factor="0.45" src="company_logo.png"></img></p>
 
 <br></br>
-<br></br>
-<br></br>
 
 <font size="-1">
 
diff --git a/pdf_command_wx.cpp b/pdf_command_wx.cpp
index 5a8b6ce..8c5105e 100644
--- a/pdf_command_wx.cpp
+++ b/pdf_command_wx.cpp
@@ -1384,6 +1384,21 @@ class standard_page : public numbered_page
             }
     }
 
+  protected:
+    int get_extra_pages_needed() override
+    {
+        page_break_positions_ = writer_.paginate_html
+            (writer_.get_page_width()
+            ,get_page_body_height()
+            ,*page_body_cell_
+            );
+
+        // The cast is safe, we're never going to have more than INT_MAX
+        // pages and if we, somehow, do, the caller checks that this function
+        // returns a positive value.
+        return static_cast<int>(page_break_positions_.size()) - 1;
+    }
+
   private:
     // Parse HTML page contents once and store the result in page_body_cell_
     // and header_cell_ member variables.
@@ -1434,20 +1449,6 @@ class standard_page : public numbered_page
         return header_cell_.get();
     }
 
-    int get_extra_pages_needed() override
-    {
-        page_break_positions_ = writer_.paginate_html
-            (writer_.get_page_width()
-            ,get_page_body_height()
-            ,*page_body_cell_
-            );
-
-        // The cast is safe, we're never going to have more than INT_MAX
-        // pages and if we, somehow, do, the caller checks that this function
-        // returns a positive value.
-        return static_cast<int>(page_break_positions_.size()) - 1;
-    }
-
     char const* const                    page_template_name_;
     std::unique_ptr<wxHtmlContainerCell> page_body_cell_;
     std::unique_ptr<wxHtmlContainerCell> header_cell_;
@@ -1478,28 +1479,14 @@ class cover_page : public standard_page
     {
     }
 
-#if 0
-// Now that this class derives from class standard_page, this virtual
-// member must no longer be overridden. If this override is not
-// commented out, then the cover page is entirely blank.
-//
-// Is this because standard_page::page_break_positions_ must be set
-// (by calling standard_page::get_extra_pages_needed() in any
-// override, or (as seems best in this case) by not overriding that
-// virtual member here)?
-//
-// But maybe that's not the reason: it seems remarkable that replacing
-// +        ,"ill_reg_numeric_summary"
-// -        ,"cover"
-// above in the ctor causes a non-blank first page to be printed, even
-// if this override is not commented out.
-//
   private:
     int get_extra_pages_needed() override
     {
-        return 0;
+        int const extra = standard_page::get_extra_pages_needed();
+        if(0 != extra)
+            warning() << "Cover page will overflow." << LMI_FLUSH;
+        return extra;
     }
-#endif // 0
 
     // Only the lower part of the footer is wanted here.
     std::string get_upper_footer_template_name() const override



reply via email to

[Prev in Thread] Current Thread [Next in Thread]