sw/source/filter/ww8/wrtw8sty.cxx |   46 +++++++++++++++++++++++++++++++++++---
 1 file changed, 43 insertions(+), 3 deletions(-)

New commits:
commit 5633a60164cc81fd33a038ee736bad75c6c2346d
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sun Jan 22 08:33:17 2023 +0300
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Jan 23 08:55:03 2023 +0000

    tdf#153094: Fix default character style index, and document it
    
    Thanks Caolán for catching it, and providing the relevant
    documentation pointers! See
    
https://gerrit.libreoffice.org/c/core/+/145806/1#message-c4a9649a8381bd1885d39923fe278b86bc07a228
    
    Change-Id: I6379579befda583f609f87d973fcfaacf9f1fed6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145963
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    (cherry picked from commit a00556ada3214d7584bebd4d6ac33bf5c25a3467)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145937
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/source/filter/ww8/wrtw8sty.cxx 
b/sw/source/filter/ww8/wrtw8sty.cxx
index 2d9a346365e7..5f26f90e17fa 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -121,15 +121,55 @@ public:
 
 //  Styles
 
-// Immediately after reserved slots, character styles begin
-#define WW8_RESERVED_SLOTS 15 // tdf#153094: the value is important
+// According to [MS-DOC] v20221115 2.9.271 STSH,
+// "The beginning of the rglpstd array is reserved for specific "fixed-index" 
application-defined
+//  styles. A particular fixed-index, application-defined style has the same 
istd value in every
+//  stylesheet. The rglpstd MUST contain an LPStd for each of these 
fixed-index styles and the order
+//  MUST match the order in the following table.
+//
+//  istd   sti of application-defined style (see sti in StdfBase)
+//  0      0
+//  1      1
+//  2      2
+//  3      3
+//  4      4
+//  5      5
+//  6      6
+//  7      7
+//  8      8
+//  9      9
+//  10     65
+//  11     105
+//  12     107
+//  13     Reserved for future use
+//  14     Reserved for future use"
+//
+// And [MS-OE376] v20220816 2.1.236 Part 4 Section 2.7.3.9, name (Primary 
Style Name)
+// specifies the following mapping:
+//
+//  sti    Style name                Style type
+//  0      Normal                    paragraph
+//  1      heading 1                 paragraph
+//  2      heading 2                 paragraph
+//  3      heading 3                 paragraph
+//  4      heading 4                 paragraph
+//  5      heading 5                 paragraph
+//  6      heading 6                 paragraph
+//  7      heading 7                 paragraph
+//  8      heading 8                 paragraph
+//  9      heading 9                 paragraph
+//  65     Default Paragraph Font    character
+//  105    Normal Table              table
+//  107    No List                   numbering
+
+#define WW8_RESERVED_SLOTS 15
 
 // GetId( SwCharFormat ) for use in text -> zero is not allowed,
 // use "Default Char Style" instead
 sal_uInt16 MSWordExportBase::GetId( const SwCharFormat* pFormat ) const
 {
     sal_uInt16 nRet = m_pStyles->GetSlot( pFormat );
-    return ( nRet != 0x0fff ) ? nRet : WW8_RESERVED_SLOTS;      // Default 
Char Style
+    return ( nRet != 0x0fff ) ? nRet : 10;      // Default Char Style
 }
 
 // GetId( SwTextFormatColl ) for use in TextNodes -> zero is not allowed,
commit 2846b0d07074ed8a29fb9ce38c60e7e585140ee7
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Fri Jan 20 11:41:06 2023 +0300
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Jan 23 08:54:51 2023 +0000

    tdf#153094: it seems that DOC requires WW8_RESERVED_SLOTS = 15
    
    Regression from commit a2a08463e0299d514e6e555ae61c68bb0e4348d0,
    where I mistakenly assumed that the value is just to accommodate
    enough entries. I don't know where it's documented, but this
    fixes the bug.
    
    Change-Id: Ifecf5d294222e3a40cb23f7c147694dbdf35e405
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145869
    Tested-by: Mike Kaganski <mike.kagan...@collabora.com>
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    (cherry picked from commit dc2ad435cd148a492aba3f2b18bbba0c769f463e)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145806
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/source/filter/ww8/wrtw8sty.cxx 
b/sw/source/filter/ww8/wrtw8sty.cxx
index f251f41cff15..2d9a346365e7 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -122,7 +122,7 @@ public:
 //  Styles
 
 // Immediately after reserved slots, character styles begin
-#define WW8_RESERVED_SLOTS 10
+#define WW8_RESERVED_SLOTS 15 // tdf#153094: the value is important
 
 // GetId( SwCharFormat ) for use in text -> zero is not allowed,
 // use "Default Char Style" instead

Reply via email to