[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] odd/foliation e30ab03 2/2: Attempt to number the cov
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] odd/foliation e30ab03 2/2: Attempt to number the cover page, for some ledger types only |
Date: |
Tue, 23 Apr 2019 12:17:28 -0400 (EDT) |
branch: odd/foliation
commit e30ab034bdd149d5c89e61e1dcdfe4c7b7b7392d
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Attempt to number the cover page, for some ledger types only
This attempt fails to exclude 'mce_finra' cover pages: see the inline
comments.
---
pdf_command_wx.cpp | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 64 insertions(+), 3 deletions(-)
diff --git a/pdf_command_wx.cpp b/pdf_command_wx.cpp
index 32369c8..a333d24 100644
--- a/pdf_command_wx.cpp
+++ b/pdf_command_wx.cpp
@@ -1301,13 +1301,21 @@ class numbered_page : public page_with_marginals
};
// Cover page used by several different illustration kinds.
-class cover_page : public logical_page
+class cover_page : public numbered_page
{
public:
- using logical_page::logical_page;
+ // Required...but why?
+ using numbered_page::numbered_page;
void render() override
{
+ // Must call base-class implementation to render the footer.
+ // Would it be preferable to call this through the immediate
+ // base class [numbered_page::render()] instead? That would
+ // allow class numbered_page to add functionality, but it
+ // makes the actual implementation harder to track down.
+ page_with_marginals::render();
+
int const height_contents = writer_.output_html
(writer_.get_horz_margin()
,writer_.get_vert_margin()
@@ -1329,6 +1337,42 @@ class cover_page : public logical_page
,height_contents
);
}
+
+ private:
+ // Required implementation of a pure virtual.
+ //
+ // Assume that the cover page is a single page. Is there any way
+ // to assert that instead of assuming it? Copying and pasting the
+ // standard_page::get_extra_pages_needed() here doesn't work (it
+ // won't compile); should this class derive from standard_page
+ // instead of numbered_page?
+ int get_extra_pages_needed() override
+ {
+ return 0;
+ }
+
+ // Only the lower portion of the footer is wanted here, so set
+ // the upper-footer template to an empty string.
+ //
+ // Is it just by chance that the lower footer fits below the
+ // large rectangle drawn in render(), while the upper footer,
+ // if not suppressed here, would (undesirably) place its
+ // contents inside that rectangle?
+ //
+ // It looks like the bottom of the rectangle drawn in this class's
+ // render() collides with the horizontal line preceding the footer.
+ // Is that line the one drawn by page_with_marginals::render()?
+ // It seems to be, because removing some of the '<br></br>' lines
+ // in 'cover.mst' moves the bottom of the rectangle upward, leaving
+ // the horizontal line distinct. If so, then changing the "lower"
+ // footer in any way that affects its height would elicit a layout
+ // defect. No such problem would arise if that rectangle were not
+ // drawn at all; perhaps it should be eliminated if it's not worth
+ // the trouble to get it reliably right.
+ std::string get_upper_footer_template_name() const override
+ {
+ return std::string {};
+ }
};
// Simplest possible page which is entirely defined by its external template
@@ -2841,8 +2885,13 @@ class pdf_illustration_finra : public pdf_illustration
// Add all the pages.
add<cover_page>();
// PDF !! For the moment, don't number this format's cover page.
- numbered_page::start_numbering();
+ // Well, that was the dream--that the finra cover page wouldn't be
+ // numbered if we "start numbering" only after we "add" that page.
+ // But it's numbered even so.
+// numbered_page::start_numbering();
add<finra_basic>();
+ // Calling start_numbering() again doesn't re-start the numbering.
+// numbered_page::start_numbering();
add<finra_supplemental>();
add<standard_page>("finra_column_headings");
add<standard_page>("finra_notes1");
@@ -2859,6 +2908,18 @@ class pdf_illustration_finra : public pdf_illustration
{
add<standard_supplemental_report>("finra_supp_report");
}
+ // In fact, it's enough to "start numbering" after we "add"
+ // the last page. These statements appear not to be executed
+ // in sequence. Presumably add<> merely signals an intention
+ // to include a page, and there's an implicit step elsewhere
+ // that "really" adds the pages, so start_numbering() can
+ // be called anywhere in the present function.
+ //
+ // First last_page_number_ is initialized to zero, then it
+ // must be initialized by start_numbering() before it's
+ // actually (implicitly) used, or else an assertion fires.
+ // Does that complex mechanism serve any worthwhile purpose?
+ numbered_page::start_numbering();
}
std::string get_upper_footer_template_name() const override