From 2514893cf2c25dbdde4138170c05f8a77f4580e6 Mon Sep 17 00:00:00 2001 From: Ariel Rorabaugh Date: Fri, 26 Apr 2024 17:31:53 -0400 Subject: [PATCH] Add BasedOn style property and fix duplicate styles - Add based on property when generating styles from LCM stylesheet that have based on specified in FLEx. - Edit styleDictionary to store individual styles instead of groups of styles. - Revise AddStyles so it adds each style one time only, using the stylenames instead of css classes as the dictionary keys. NOTE: In the Word export, the style dictionary should save each style individually rather than a collection of styles associated with a given css class. Otherwise, any given style may be added to the styles xml multiple times, once for each css class using that style. Remaining task: - Homograph-Number style is still being duplicated. It is handled in a different function and requires its own fix. Change-Id: I9530c894fdae8251ab4211f1c7529fa63586b446 --- Src/xWorks/LcmWordGenerator.cs | 46 +++++++++++++++++-------------- Src/xWorks/WordStylesGenerator.cs | 9 ++++-- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/Src/xWorks/LcmWordGenerator.cs b/Src/xWorks/LcmWordGenerator.cs index 989e6168c0..dd48bd9c18 100644 --- a/Src/xWorks/LcmWordGenerator.cs +++ b/Src/xWorks/LcmWordGenerator.cs @@ -36,7 +36,7 @@ public class LcmWordGenerator : ILcmContentGenerator, ILcmStylesGenerator { private LcmCache Cache { get; } private static Styles _styleSheet { get; set; } = new Styles(); - private static Dictionary _styleDictionary = new Dictionary(); + private static Dictionary _styleDictionary = new Dictionary(); private ReadOnlyPropertyTable _propertyTable; internal const int maxImageHeightInches = 1; internal const int maxImageWidthInches = 1; @@ -129,17 +129,16 @@ public static void SavePublishedDocx(int[] entryHvos, DictionaryPublicationDecor stylePart = AddStylesPartToPackage(fragment.DocFrag); // Add generated styles into the stylesheet from the dictionary - foreach (var stylesItem in _styleDictionary.Values) + foreach (var style in _styleDictionary.Values) { - foreach (var style in stylesItem.Descendants