include/i18nutil/paper.hxx |    4 ++++
 vcl/inc/print.hrc          |    3 +++
 vcl/source/gdi/print.cxx   |    1 +
 3 files changed, 8 insertions(+)

New commits:
commit ae6f7eecfc62442584473034853539706b03f7af
Author:     Tor Lillqvist <t...@collabora.com>
AuthorDate: Tue Nov 2 18:14:48 2021 +0200
Commit:     Tor Lillqvist <t...@collabora.com>
CommitDate: Tue Nov 2 19:15:08 2021 +0100

    Add comments to two arrays mentioning that they must match the enum Paper
    
    At least I think they must. Also add a comment to the enum pointing at
    those arrays. There are now four different places in four files that
    must be manually kept in sync. Quite possibly more. This stinks.
    
    Change-Id: I7b5c721329c69a16b8cdf07390d481ec77c7b5ae
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124610
    Tested-by: Jenkins
    Reviewed-by: Tor Lillqvist <t...@collabora.com>

diff --git a/include/i18nutil/paper.hxx b/include/i18nutil/paper.hxx
index 71ca22bb9486..b84d7b3af074 100644
--- a/include/i18nutil/paper.hxx
+++ b/include/i18nutil/paper.hxx
@@ -32,6 +32,10 @@ struct Locale;
 //!! The values of the following enumerators must correspond to the array 
position
 //!! of the respective paper size in the file i18nutil/source/utility/paper.cxx
 //!! Thus don't reorder the enum values here without changing the code there 
as well.
+
+//!! Also the RID_STR_PAPERNAMES array in vcl/inc/print.hrc and the
+//!! PaperIndex array in Printer::GetPaperName() in
+//!! vcl/source/gdi/print.cxx are parallel to this enum.
 enum Paper : unsigned
 {
     PAPER_A0,
diff --git a/vcl/inc/print.hrc b/vcl/inc/print.hrc
index b654a77ec3b8..7e19c4c75004 100644
--- a/vcl/inc/print.hrc
+++ b/vcl/inc/print.hrc
@@ -27,6 +27,9 @@
 const TranslateId RID_STR_PAPERNAMES[] =
 {
     // To translators: This is the first entry of a sequence of paper size 
names
+
+    // This array must (probably) match exactly the enum Paper in 
<i18nutil/paper.hxx>
+
     NC_("RID_STR_PAPERNAMES", "A0"),
     NC_("RID_STR_PAPERNAMES", "A1"),
     NC_("RID_STR_PAPERNAMES", "A2"),
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 1b7e4210e691..e728edf1dca3 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -1387,6 +1387,7 @@ OUString Printer::GetPaperName( Paper ePaper )
     ImplSVData* pSVData = ImplGetSVData();
     if( pSVData->maPaperNames.empty() )
     {
+        // This array must (probably) match exactly the enum Paper in 
<i18nutil/paper.hxx>
         static const int PaperIndex[] =
         {
             PAPER_A0, PAPER_A1, PAPER_A2, PAPER_A3, PAPER_A4, PAPER_A5, 
PAPER_B4_ISO, PAPER_B5_ISO,

Reply via email to