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

New commits:
commit a9213f4bd6334892fde0aa6127acc9d1dc486f7d
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sun Jan 22 08:33:17 2023 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Sun Jan 22 08:13:55 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/+/145936
    Tested-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/sw/source/filter/ww8/wrtw8sty.cxx 
b/sw/source/filter/ww8/wrtw8sty.cxx
index b2b84295e504..11bf0471812a 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,

Reply via email to