lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 9fe1d07 125/156: Implement page-specific foot


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 9fe1d07 125/156: Implement page-specific footer for "Tabular Details" pages
Date: Tue, 30 Jan 2018 17:22:28 -0500 (EST)

branch: master
commit 9fe1d0741c448eebe654d1ba244bab91786776ba
Author: Vadim Zeitlin <address@hidden>
Commit: Vadim Zeitlin <address@hidden>

    Implement page-specific footer for "Tabular Details" pages
    
    These pages need to show specific footnotes in their footer, so allow
    overriding get_upper_footer_template_name() at the page level and use
    the correct footer template for these pages.
---
 footer_disclaimer.mustache  | 11 +++++++++++
 ledger_pdf_generator_wx.cpp | 26 ++++++++++++++++++++++----
 2 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/footer_disclaimer.mustache b/footer_disclaimer.mustache
new file mode 100644
index 0000000..fc5f2b0
--- /dev/null
+++ b/footer_disclaimer.mustache
@@ -0,0 +1,11 @@
+<font size="-2">
+
+{{^IsInforce}}
+    {{NonGuaranteedFootnote}}
+{{/IsInforce}}
+{{#IsInforce}}
+    {{InforceNonGuaranteedFootnote0}}<br>
+    <b>{{InforceNonGuaranteedFootnote3}}</b>
+{{/IsInforce}}
+
+</font>
diff --git a/ledger_pdf_generator_wx.cpp b/ledger_pdf_generator_wx.cpp
index 3adce7a..a24960c 100644
--- a/ledger_pdf_generator_wx.cpp
+++ b/ledger_pdf_generator_wx.cpp
@@ -756,6 +756,9 @@ class pdf_illustration : protected html_interpolator
     // templates should be used for the upper (above the separating line) and
     // the lower parts of the footer. The upper template name may be empty if
     // it is not used at all.
+    //
+    // Notice that the upper footer template name can be overridden at the page
+    // level, the methods here define the default for all illustration pages.
     virtual std::string get_upper_footer_template_name() const = 0;
     virtual std::string get_lower_footer_template_name() const = 0;
 
@@ -976,8 +979,7 @@ class page_with_footer : public page
             ,e_output_measure_only
             );
 
-        auto const&
-            upper_template = illustration_->get_upper_footer_template_name();
+        auto const& upper_template = get_upper_footer_template_name();
         if(!upper_template.empty())
             {
             footer_height += writer.output_html
@@ -1003,8 +1005,7 @@ class page_with_footer : public page
 
         auto y = footer_top_;
 
-        auto const&
-            upper_template = illustration_->get_upper_footer_template_name();
+        auto const& upper_template = get_upper_footer_template_name();
         if(!upper_template.empty())
             {
             y += writer.output_html
@@ -1049,6 +1050,13 @@ class page_with_footer : public page
     // the page number or equivalent string (e.g. "Appendix").
     virtual std::string get_page_number() const = 0;
 
+    // This method forwards to the illustration by default, but can be
+    // overridden to define a page-specific footer if necessary.
+    virtual std::string get_upper_footer_template_name() const
+    {
+        return illustration_->get_upper_footer_template_name();
+    }
+
     // This method uses get_page_number() and returns the HTML wrapping it
     // and other fixed information appearing in the lower part of the footer.
     text get_footer_lower_html(html_interpolator const& interpolate_html) const
@@ -1708,6 +1716,11 @@ class tabular_detail_page : public 
page_with_tabular_report
         return "{{>tabular_details}}";
     }
 
+    std::string get_upper_footer_template_name() const override
+    {
+        return "footer_disclaimer";
+    }
+
     void render_or_measure_extra_headers
         (illustration_table_generator&  table
         ,html_interpolator const&       interpolate_html
@@ -1791,6 +1804,11 @@ class tabular_detail2_page : public 
page_with_tabular_report
         return "{{>tabular_details2}}";
     }
 
+    std::string get_upper_footer_template_name() const override
+    {
+        return "footer_disclaimer";
+    }
+
     illustration_table_columns const& get_table_columns() const override
     {
         static illustration_table_columns const columns =



reply via email to

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