summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-11-10 12:10:21 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-11-10 14:41:24 +0100
commit81ff857b51b5904abe7ad75f05c19cb445d78e5f (patch)
tree1c1d62357c443990afa4e3b2f1532e8acd738ba9
parentf8f21b0465d087beb3f4f900401797608a073f7c (diff)
sync filter's paper table with calcs and i18nutils
older ms specs confused JIS and ISO "B" sizes and there are now documented newer sizes not in filter. some of the sizes at https://docs.microsoft.com/en-us/windows/win32/intl/paper-sizes are surely still wrong, e.g. Letter extra paper and I trust the values in calc table more. orientation of ISO B6 Envelope dimensions is still ambiguous to me, so left that alone for now Change-Id: I6b6beb2620fe79f03ad5068eab0657a0b65f1aa4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105521 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--filter/source/msfilter/util.cxx42
-rw-r--r--i18nutil/source/utility/paper.cxx1
-rw-r--r--sc/source/filter/excel/xlpage.cxx39
3 files changed, 49 insertions, 33 deletions
diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx
index 778fdce07c3f..8ea3be35dba9 100644
--- a/filter/source/msfilter/util.cxx
+++ b/filter/source/msfilter/util.cxx
@@ -148,6 +148,7 @@ OString ConvertColor( const Color &rColor )
#define IN2MM100( v ) static_cast< sal_Int32 >( (v) * 2540.0 + 0.5 )
#define MM2MM100( v ) static_cast< sal_Int32 >( (v) * 100.0 + 0.5 )
+// see XclPaperSize pPaperSizeTable in calc and aDinTab in i18nutil
const ApiPaperSize spPaperSizeTable[] =
{
{ 0, 0 }, // 0 - (undefined)
@@ -162,8 +163,12 @@ const ApiPaperSize spPaperSizeTable[] =
{ MM2MM100( 210 ), MM2MM100( 297 ) }, // 9 - A4 paper
{ MM2MM100( 210 ), MM2MM100( 297 ) }, // 10 - A4 small paper
{ MM2MM100( 148 ), MM2MM100( 210 ) }, // 11 - A5 paper
- { MM2MM100( 250 ), MM2MM100( 353 ) }, // 12 - B4 paper
- { MM2MM100( 176 ), MM2MM100( 250 ) }, // 13 - B5 paper
+ /* for JIS vs ISO B confusion see:
+ https://docs.microsoft.com/en-us/windows/win32/intl/paper-sizes
+ http://wiki.openoffice.org/wiki/DefaultPaperSize comments
+ http://partners.adobe.com/public/developer/en/ps/5003.PPD_Spec_v4.3.pdf */
+ { MM2MM100( 257 ), MM2MM100( 364 ) }, // 12 - B4 (JIS) paper
+ { MM2MM100( 182 ), MM2MM100( 257 ) }, // 13 - B5 (JIS) paper
{ IN2MM100( 8.5 ), IN2MM100( 13 ) }, // 14 - Folio paper
{ MM2MM100( 215 ), MM2MM100( 275 ) }, // 15 - Quarto paper
{ IN2MM100( 10 ), IN2MM100( 14 ) }, // 16 - Standard paper
@@ -200,13 +205,14 @@ const ApiPaperSize spPaperSizeTable[] =
{ MM2MM100( 220 ), MM2MM100( 220 ) }, // 47 - Invite envelope
{ 0, 0 }, // 48 - (undefined)
{ 0, 0 }, // 49 - (undefined)
- { IN2MM100( 9.275 ), IN2MM100( 12 ) }, // 50 - Letter extra paper
- { IN2MM100( 9.275 ), IN2MM100( 15 ) }, // 51 - Legal extra paper
+ /* See: https://docs.microsoft.com/en-us/windows/win32/intl/paper-sizes */
+ { IN2MM100( 9.5 ), IN2MM100( 12 ) }, // 50 - Letter extra paper
+ { IN2MM100( 9.5 ), IN2MM100( 15 ) }, // 51 - Legal extra paper
{ IN2MM100( 11.69 ), IN2MM100( 18 ) }, // 52 - Tabloid extra paper
- { MM2MM100( 236 ), MM2MM100( 322 ) }, // 53 - A4 extra paper
- { IN2MM100( 8.275 ), IN2MM100( 11 ) }, // 54 - Letter transverse paper
+ { MM2MM100( 235 ), MM2MM100( 322 ) }, // 53 - A4 extra paper
+ { IN2MM100( 8.5 ), IN2MM100( 11 ) }, // 54 - Letter transverse paper
{ MM2MM100( 210 ), MM2MM100( 297 ) }, // 55 - A4 transverse paper
- { IN2MM100( 9.275 ), IN2MM100( 12 ) }, // 56 - Letter extra transverse paper
+ { IN2MM100( 9.5 ), IN2MM100( 12 ) }, // 56 - Letter extra transverse paper
{ MM2MM100( 227 ), MM2MM100( 356 ) }, // 57 - SuperA/SuperA/A4 paper
{ MM2MM100( 305 ), MM2MM100( 487 ) }, // 58 - SuperB/SuperB/A3 paper
{ IN2MM100( 8.5 ), IN2MM100( 12.69 ) }, // 59 - Letter plus paper
@@ -219,8 +225,28 @@ const ApiPaperSize spPaperSizeTable[] =
{ MM2MM100( 420 ), MM2MM100( 594 ) }, // 66 - A2 paper
{ MM2MM100( 297 ), MM2MM100( 420 ) }, // 67 - A3 transverse paper
{ MM2MM100( 322 ), MM2MM100( 445 ) }, // 68 - A3 extra transverse paper
- { 0, 0 }, // 69 - undefined
+ { MM2MM100( 200 ), MM2MM100( 148 ) }, // 69 - Japanese double postcard
{ MM2MM100( 105 ), MM2MM100( 148 ), }, // 70 - A6 paper
+ { 0, 0 }, // 71 - Japanese Envelope Kaku #2
+ { 0, 0 }, // 72 - Japanese Envelope Kaku #3
+ { 0, 0 }, // 73 - Japanese Envelope Chou #3
+ { 0, 0 }, // 74 - Japanese Envelope Chou #4
+ { IN2MM100( 11 ), IN2MM100( 8.5 ) }, // 75 - Letter Rotated
+ { MM2MM100( 420 ), MM2MM100( 297 ) }, // 76 - A3 Rotated
+ { MM2MM100( 297 ), MM2MM100( 210 ) }, // 77 - A4 Rotated
+ { MM2MM100( 210 ), MM2MM100( 148 ) }, // 78 - A5 Rotated
+ { MM2MM100( 364 ), MM2MM100( 257 ) }, // 79 - B4 (JIS) Rotated
+ { MM2MM100( 257 ), MM2MM100( 182 ) }, // 80 - B5 (JIS) Rotated
+ { MM2MM100( 148 ), MM2MM100( 100 ) }, // 81 - Japanese Postcard Rotated
+ { MM2MM100( 148 ), MM2MM100( 200 ) }, // 82 - Double Japanese Postcard Rotated
+ { MM2MM100( 148 ), MM2MM100( 105 ) }, // 83 - A6 Rotated
+ { 0, 0 }, // 84 - Japanese Envelope Kaku #2 Rotated
+ { 0, 0 }, // 85 - Japanese Envelope Kaku #3 Rotated
+ { 0, 0 }, // 86 - Japanese Envelope Chou #3 Rotated
+ { 0, 0 }, // 87 - Japanese Envelope Chou #4 Rotated
+ { MM2MM100( 128 ), MM2MM100( 182 ) }, // 88 - B6 (JIS)
+ { MM2MM100( 182 ), MM2MM100( 128 ) }, // 89 - B6 (JIS) Rotated
+ { IN2MM100( 12 ), IN2MM100( 11 ) } // 90 - 12x11
};
sal_Int32 PaperSizeConv::getMSPaperSizeIndex( const css::awt::Size& rSize )
diff --git a/i18nutil/source/utility/paper.cxx b/i18nutil/source/utility/paper.cxx
index 7b6fdfb1437b..1b87b37871c9 100644
--- a/i18nutil/source/utility/paper.cxx
+++ b/i18nutil/source/utility/paper.cxx
@@ -68,6 +68,7 @@ struct PageDesc
//!! The order of these entries must correspond to enum Paper in <i18nutil/paper.hxx>
+// see XclPaperSize pPaperSizeTable in calc and ApiPaperSize in filter
const PageDesc aDinTab[] =
{
{ MM2MM100( 841 ), MM2MM100( 1189 ), "A0", nullptr },
diff --git a/sc/source/filter/excel/xlpage.cxx b/sc/source/filter/excel/xlpage.cxx
index 1f5f72cf1184..6186266fafb0 100644
--- a/sc/source/filter/excel/xlpage.cxx
+++ b/sc/source/filter/excel/xlpage.cxx
@@ -47,6 +47,7 @@ constexpr tools::Long twips2mm(tools::Long n_twips)
return static_cast<tools::Long>((static_cast<double>(n_twips) - 0.5) / EXC_TWIPS_PER_INCH * CM_PER_INCH * 10.0);
}
+// see ApiPaperSize spPaperSizeTable in filter and aDinTab in i18nutil
constexpr XclPaperSize pPaperSizeTable[] =
{
/* 0*/ { PAPER_USER, 0, 0 }, // undefined
@@ -61,23 +62,10 @@ constexpr XclPaperSize pPaperSizeTable[] =
{ PAPER_A4, mm2twips( 210 ), mm2twips( 297 ) }, // A4
/* 10*/ { PAPER_USER, mm2twips( 210 ), mm2twips( 297 ) }, // A4 Small
{ PAPER_A5, mm2twips( 148 ), mm2twips( 210 ) }, // A5
- //See: http://wiki.openoffice.org/wiki/DefaultPaperSize comments
- //near DMPAPER_B4 in vcl
- //i.e.
- //http://msdn.microsoft.com/en-us/library/bb241398.aspx makes the claim:
- //xlPaperB4 12 B4 (250 mm x 354 mm)
- //xlPaperB5 13 A5 (148 mm x 210 mm)
- //but, a paper enum called B5 is surely not actually "A5", and furthermore
- //the XlPaperSize enumeration otherwise follows the DMPAPER values
- //http://msdn.microsoft.com/en-us/library/ms776398(VS.85).aspx
- //which has
- //DMPAPER_B4 12 B4 (JIS) 250 x 354
- //DMPAPER_B5 13 B5 (JIS) 182 x 257 mm
- //which claim them to be the JIS sizes. Though that document then gives
- //"B4 (JIS)" an *ISO* B4 size in the text, but
- //http://partners.adobe.com/public/developer/en/ps/5003.PPD_Spec_v4.3.pdf
- //claims that the MS DMPAPER_B4 and DMPAPER_B5 truly are the JIS sizes
- //which at least makes some sort of sense. (cmc)
+ /* for JIS vs ISO B confusion see:
+ https://docs.microsoft.com/en-us/windows/win32/intl/paper-sizes
+ http://wiki.openoffice.org/wiki/DefaultPaperSize comments
+ http://partners.adobe.com/public/developer/en/ps/5003.PPD_Spec_v4.3.pdf */
{ PAPER_B4_JIS, mm2twips( 257 ), mm2twips( 364 ) }, // B4 (JIS)
{ PAPER_B5_JIS, mm2twips( 182 ), mm2twips( 257 ) }, // B5 (JIS)
{ PAPER_USER, in2twips( 8.5 ), in2twips( 13 ) }, // Folio
@@ -116,6 +104,7 @@ constexpr XclPaperSize pPaperSizeTable[] =
{ PAPER_ENV_INVITE, mm2twips( 220 ), mm2twips( 220 ) }, // Envelope Invite
{ PAPER_USER, 0, 0 }, // undefined
{ PAPER_USER, 0, 0 }, // undefined
+ /* See: https://docs.microsoft.com/en-us/windows/win32/intl/paper-sizes */
/* 50*/ { PAPER_USER, in2twips( 9.5 ), in2twips( 12 ) }, // Letter Extra
{ PAPER_USER, in2twips( 9.5 ), in2twips( 15 ) }, // Legal Extra
{ PAPER_USER, in2twips( 11.69 ), in2twips( 18 ) }, // Tabloid Extra
@@ -137,10 +126,10 @@ constexpr XclPaperSize pPaperSizeTable[] =
{ PAPER_USER, mm2twips( 322 ), mm2twips( 445 ) }, // A3 Extra Transverse
{ PAPER_DOUBLEPOSTCARD_JP, mm2twips( 200 ), mm2twips( 148 ) }, // Double Japanese Postcard
/* 70*/ { PAPER_A6, mm2twips( 105 ), mm2twips( 148 ) }, // A6
- { PAPER_USER, 0, 0 }, // undefined
- { PAPER_USER, 0, 0 }, // undefined
- { PAPER_USER, 0, 0 }, // undefined
- { PAPER_USER, 0, 0 }, // undefined
+ { PAPER_USER, 0, 0 }, // Japanese Envelope Kaku #2
+ { PAPER_USER, 0, 0 }, // Japanese Envelope Kaku #3
+ { PAPER_USER, 0, 0 }, // Japanese Envelope Chou #3
+ { PAPER_USER, 0, 0 }, // Japanese Envelope Chou #4
/* 75*/ { PAPER_USER, in2twips( 11 ), in2twips( 8.5 ) }, // Letter Rotated
{ PAPER_USER, mm2twips( 420 ), mm2twips( 297 ) }, // A3 Rotated
{ PAPER_USER, mm2twips( 297 ), mm2twips( 210 ) }, // A4 Rotated
@@ -150,10 +139,10 @@ constexpr XclPaperSize pPaperSizeTable[] =
{ PAPER_USER, mm2twips( 148 ), mm2twips( 100 ) }, // Japanese Postcard Rotated
{ PAPER_USER, mm2twips( 148 ), mm2twips( 200 ) }, // Double Japanese Postcard Rotated
{ PAPER_USER, mm2twips( 148 ), mm2twips( 105 ) }, // A6 Rotated
- { PAPER_USER, 0, 0 }, // undefined
-/* 85*/ { PAPER_USER, 0, 0 }, // undefined
- { PAPER_USER, 0, 0 }, // undefined
- { PAPER_USER, 0, 0 }, // undefined
+ { PAPER_USER, 0, 0 }, // Japanese Envelope Kaku #2 Rotated
+/* 85*/ { PAPER_USER, 0, 0 }, // Japanese Envelope Kaku #3 Rotated
+ { PAPER_USER, 0, 0 }, // Japanese Envelope Chou #3 Rotated
+ { PAPER_USER, 0, 0 }, // Japanese Envelope Chou #4 Rotated
{ PAPER_B6_JIS, mm2twips( 128 ), mm2twips( 182 ) }, // B6 (JIS)
{ PAPER_USER, mm2twips( 182 ), mm2twips( 128 ) }, // B6 (JIS) Rotated
/* 90*/ { PAPER_12x11, in2twips( 12 ), in2twips( 11 ) } // 12x11