Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LT-21785: Add more style support #77

Merged
merged 2 commits into from
Jun 13, 2024
Merged

LT-21785: Add more style support #77

merged 2 commits into from
Jun 13, 2024

Conversation

mark-sil
Copy link
Contributor

@mark-sil mark-sil commented Jun 12, 2024

  • When a run is created set the style name. (It may get modified with basedOn information as we get other notifications.)
  • Add styles during run creation.
  • Allow styles to be based on other styles, which can be based on other styles…
  • Support different styles on different document fragments.

TODO:
A remaining task is to change the style names from the config.Style to the config.DisplayLabel. This will improve the style names that appear in Word. At that time we will need to add additional code to generate a unique style name if the properties of a style are different.


This change is Reviewable

- When a run is created set the style name. (It may get modified
  with basedOn information as we get other notifications.)
- Add styles during run creation.
- Allow styles to be based on other styles, which can be based on
  other styles…
- Support different styles on different document fragments.

TODO:
A remaining task is to change the style names from the
config.Style to the config.DisplayLabel.  This will improve
the style names that appear in Word. At that time we will need
to add additional code to generate a unique style name if the
properties of a style are different.

Change-Id: I12b308232559b4845970d0b345a840ae230f7534
@jasonleenaylor
Copy link
Contributor

Src/xWorks/LcmWordGenerator.cs line 253 at r1 (raw file):

			public static string GetWsStyleName(LcmCache cache, string styleName, ConfigurableDictionaryNode config, string writingSystem)
			{
				// If the config does not contain writing system options, then just return the style name.(custom fields)

I'm not sure what this bit on the comment is about.

@jasonleenaylor
Copy link
Contributor

Src/xWorks/LcmWordGenerator.cs line 1509 at r1 (raw file):

						style.StyleName = new StyleName() { Val = styleName };
						_styleDictionary[styleName] = style;
					}

I'm wondering if we should also include this logic in AddRun?

Code quote:

					string styleName = style.StyleId;
					if (!_styleDictionary.ContainsKey(styleName))
					{
						_styleDictionary[styleName] = style;
					}
					// If the content is the same, we don't need to do anything--the style is already in the dictionary.
					// But if the content is NOT the same, re-name this style and add it to the dictionary.
					else if (!WordStylesGenerator.AreStylesEquivalent(_styleDictionary[styleName], style))
					{
						// Otherwise get a unique but useful style name and re-name the style
						styleName = GetBestUniqueNameForNode(_styleDictionary, node);
						style.StyleId = styleName;
						style.StyleName = new StyleName() { Val = styleName };
						_styleDictionary[styleName] = style;
					}

Copy link
Contributor

@jasonleenaylor jasonleenaylor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 6 of 6 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @mark-sil)

Copy link
Contributor Author

@mark-sil mark-sil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @mark-sil)


Src/xWorks/LcmWordGenerator.cs line 253 at r1 (raw file):

Previously, jasonleenaylor (Jason Naylor) wrote…

I'm not sure what this bit on the comment is about.

custom fields are an example that will hit this code. I'll clarify the comment.

- When a run is created set the style name. (It may get modified
  with basedOn information as we get other notifications.)
- Add styles during run creation.
- Allow styles to be based on other styles, which can be based on
  other styles…
- Support different styles on different document fragments.

TODO:
A remaining task is to change the style names from the
config.Style to the config.DisplayLabel.  This will improve
the style names that appear in Word. At that time we will need
to add additional code to generate a unique style name if the
properties of a style are different.

Change-Id: I6b993e1f83b41a0ff2fb05afa1410ff336110427
Copy link
Contributor

@jasonleenaylor jasonleenaylor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @mark-sil)

@mark-sil mark-sil merged commit f8043a2 into release/9.1 Jun 13, 2024
5 checks passed
@mark-sil mark-sil deleted the LT-21785 branch June 13, 2024 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants