[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master e00ab7d 080/156: Hide "attained age" column f
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master e00ab7d 080/156: Hide "attained age" column for composite illustrations |
Date: |
Tue, 30 Jan 2018 17:22:16 -0500 (EST) |
branch: master
commit e00ab7de25fdb08f8f7a7329d2e1d5467ab6d62a
Author: Vadim Zeitlin <address@hidden>
Commit: Vadim Zeitlin <address@hidden>
Hide "attained age" column for composite illustrations
Add should_show_column() virtual method to allow dynamically hiding some
columns and use it to hide the age column in the tabular details pages.
---
ledger_pdf_generator_wx.cpp | 46 +++++++++++++++++++++++++++++++++++++++------
1 file changed, 40 insertions(+), 6 deletions(-)
diff --git a/ledger_pdf_generator_wx.cpp b/ledger_pdf_generator_wx.cpp
index 5bd17b8..69aec5d 100644
--- a/ledger_pdf_generator_wx.cpp
+++ b/ledger_pdf_generator_wx.cpp
@@ -314,18 +314,37 @@ class using_illustration_table
// Must be overridden to return the description of the table columns.
virtual illustration_table_columns const& get_table_columns() const = 0;
+ // May be overridden to return false if the given column shouldn't be shown
+ // for the specific ledger values (currently used to exclude individual
+ // columns from composite illustrations).
+ virtual bool should_show_column(Ledger const& ledger, int column) const
+ {
+ stifle_warning_for_unused_value(ledger);
+ stifle_warning_for_unused_value(column);
+ return true;
+ }
+
// Useful helper for creating the table generator using the columns defined
// by the separate (and simpler to implement) get_table_columns() pure
// virtual method.
illustration_table_generator create_table_generator
- (pdf_writer_wx& writer
+ (Ledger const& ledger
+ ,pdf_writer_wx& writer
) const
{
illustration_table_generator table(writer);
+ int column = 0;
for(auto const& i : get_table_columns())
{
- table.add_column(i.label, i.widest_text);
+ std::string label;
+ if(should_show_column(ledger, column++))
+ {
+ label = i.label;
+ }
+ //else: Leave the label empty to avoid showing the column.
+
+ table.add_column(label, i.widest_text);
}
return table;
@@ -919,11 +938,13 @@ class numeric_summary_table_cell
int render_or_measure(int pos_y, enum_output_mode output_mode)
{
+ auto const& ledger = pdf_context_for_html_output.ledger();
auto& writer = pdf_context_for_html_output.writer();
auto& dc = writer.dc();
wxDCFontChanger set_smaller_font(dc, dc.GetFont().Smaller());
- illustration_table_generator table{create_table_generator(writer)};
+ illustration_table_generator
+ table{create_table_generator(ledger, writer)};
// Output multiple rows of headers.
@@ -1000,7 +1021,6 @@ class numeric_summary_table_cell
auto const& columns = get_table_columns();
std::vector<std::string> values(columns.size());
- auto const& ledger = pdf_context_for_html_output.ledger();
auto const& invar = ledger.GetLedgerInvariant();
auto const& interpolate_html =
pdf_context_for_html_output.interpolate_html();
@@ -1191,7 +1211,8 @@ class page_with_tabular_report
{
numbered_page::render(ledger, writer, interpolate_html);
- illustration_table_generator table{create_table_generator(writer)};
+ illustration_table_generator
+ table{create_table_generator(ledger, writer)};
auto const& columns = get_table_columns();
@@ -1268,7 +1289,8 @@ class page_with_tabular_report
,html_interpolator const& interpolate_html
) const override
{
- illustration_table_generator table{create_table_generator(writer)};
+ illustration_table_generator
+ table{create_table_generator(ledger, writer)};
int const pos_y = render_or_measure_fixed_page_part
(table
@@ -1406,6 +1428,12 @@ class tabular_detail_page : public
page_with_tabular_report
return columns;
}
+
+ bool should_show_column(Ledger const& ledger, int column) const override
+ {
+ // One column should be hidden for composite ledgers.
+ return column != column_end_of_year_age || !ledger.is_composite();
+ }
};
class tabular_detail2_page : public page_with_tabular_report
@@ -1431,6 +1459,12 @@ class tabular_detail2_page : public
page_with_tabular_report
return columns;
}
+ bool should_show_column(Ledger const& ledger, int column) const override
+ {
+ // One column should be hidden for composite ledgers.
+ return column != column_end_of_year_age || !ledger.is_composite();
+ }
+
int render_or_measure_fixed_page_part
(illustration_table_generator& table
,pdf_writer_wx& writer
- [lmi-commits] [lmi] master d1204c2 111/156: Factor out common parts of render_or_measure_fixed_page_part(), (continued)
- [lmi-commits] [lmi] master d1204c2 111/156: Factor out common parts of render_or_measure_fixed_page_part(), Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master e388f6e 037/156: Add beginning of numeric summary page using an external template, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 531699b 115/156: Factor out common page_with_basic_tabular_report class, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master a85943b 124/156: Add the rest of individual private placement illustration pages, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master f0b9cea 113/156: Add "Assumption Detail" page to NASD illustrations, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 031070b 132/156: Implement supplemental report page for the regular illustrations, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 9fe1d07 125/156: Implement page-specific footer for "Tabular Details" pages, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 4f3a02e 078/156: Add company logo to the cover page, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 2d93248 118/156: Add the rest of group private placement illustration pages, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 1272ce2 127/156: Don't include "Assumptions" page in composite NASD illustrations, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master e00ab7d 080/156: Hide "attained age" column for composite illustrations,
Greg Chicares <=
- [lmi-commits] [lmi] master 29e63d6 117/156: Add basic illustration page of group placement illustration, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 1a9bfb3 137/156: Factor out standard_supplemental_report class, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 7c0ff88 145/156: Add copyright notices to all .mst template files, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 2fd6a11 147/156: Use shorter and more consistent names for external templates, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master b09a25f 026/156: Implement numbering pages in the PDF output, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master bb75971 033/156: Implement the second part of the narrative summary page, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 964db82 067/156: Rename columns_headings_page to column_headings_page, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 2a94469 074/156: Use Mustache template files from the data directory, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 01be23a 103/156: Automatically squeeze table columns to make them fit if necessary, Greg Chicares, 2018/01/30
- [lmi-commits] [lmi] master 46a7442 068/156: Factor out helper render_template() method, Greg Chicares, 2018/01/30