Skip to content

Commit

Permalink
Fix bug #67248
Browse files Browse the repository at this point in the history
Fix clearing the text properties for an inline-level sdt
  • Loading branch information
KirillovIlya committed Jul 5, 2024
1 parent d463873 commit 566ce97
Show file tree
Hide file tree
Showing 2 changed files with 193 additions and 2 deletions.
4 changes: 2 additions & 2 deletions word/Editor/StructuredDocumentTags/InlineLevel.js
Original file line number Diff line number Diff line change
Expand Up @@ -1373,14 +1373,14 @@ CInlineLevelSdt.prototype.Apply_TextPr = function(TextPr, IncFontSize, ApplyToAl
oNewTextPr.FontSizeCS = oCompiledTextPr.GetIncDecFontSizeCS(IncFontSize);

var oTempTextPr = this.Pr.TextPr.Copy();
oTempTextPr.Merge(oNewTextPr);
oTempTextPr.Apply(oNewTextPr);
this.SetDefaultTextPr(oTempTextPr);
}
}
else
{
var oTempTextPr = this.Pr.TextPr.Copy();
oTempTextPr.Merge(TextPr);
oTempTextPr.Apply(TextPr);
this.SetDefaultTextPr(oTempTextPr);
}
}
Expand Down
191 changes: 191 additions & 0 deletions word/Editor/Styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -12484,6 +12484,29 @@ CLang.prototype =
this.Val = Reader.GetLong();
}
};
CLang.prototype.Clear = function()
{
this.Bidi = undefined;
this.EastAsia = undefined;
this.Val = undefined;
};
CLang.prototype.Apply = function(lang)
{
if (null === lang.Bidi)
this.Bidi = undefined;
else if (undefined !== lang.Bidi)
this.Bidi = lang.Bidi;

if (null === lang.EastAsia)
this.EastAsia = undefined;
else if (undefined !== lang.EastAsia)
this.EastAsia = lang.EastAsia;

if (null === lang.Val)
this.Val = undefined;
else if (undefined !== lang.Val)
this.Val = lang.Val;
};
CLang.prototype.Is_Empty = function()
{
if (undefined !== this.Bidi
Expand Down Expand Up @@ -12852,6 +12875,174 @@ CTextPr.prototype.Merge = function(TextPr)
this.FontScale = TextPr.FontScale;
}
};
/**
* Накатываем на данные настройки те, которые пришли, причем если какое-то значение null, то это поле мы делаем undefined
* @param {CTextPr} textPr
*/
CTextPr.prototype.Apply = function(textPr)
{
if (null === textPr.Bold)
this.Bold = undefined;
else if (undefined !== textPr.Bold)
this.Bold = textPr.Bold;

if (null === textPr.BoldCS)
this.BoldCS = undefined;
else if (undefined !== textPr.BoldCS)
this.BoldCS = textPr.BoldCS;

if (null === textPr.Italic)
this.Italic = undefined;
else if (undefined !== textPr.Italic)
this.Italic = textPr.Italic;

if (null === textPr.ItalicCS)
this.ItalicCS = undefined;
else if (undefined !== textPr.ItalicCS)
this.ItalicCS = textPr.ItalicCS;

if (null === textPr.Strikeout)
this.Strikeout = undefined;
else if (undefined !== textPr.Strikeout)
this.Strikeout = textPr.Strikeout;

if (null === textPr.Underline)
this.Underline = undefined;
else if (undefined !== textPr.Underline)
this.Underline = textPr.Underline;

if (null === textPr.FontFamily)
{
this.FontFamily = undefined;
}
else if (undefined !== textPr.FontFamily)
{
this.FontFamily = {
Name : textPr.FontFamily.Name,
Index : textPr.FontFamily.Index,
};
}

if (null === textPr.FontSize)
this.FontSize = undefined;
else if (undefined !== textPr.FontSize)
this.FontSize = textPr.FontSize;

if (null === textPr.FontSizeCS)
this.FontSizeCS = undefined;
else if (undefined !== textPr.FontSizeCS)
this.FontSizeCS = textPr.FontSizeCS;

if (null === textPr.Color)
this.Color = undefined;
else if (undefined !== textPr.Color)
this.Color = textPr.Color.Copy();

if (null === textPr.VertAlign)
this.VertAlign = undefined;
else if (undefined !== textPr.VertAlign)
this.VertAlign = textPr.VertAlign;

if (null === textPr.HighLight)
this.HighLight = undefined;
else if (highlight_None === textPr.HighLight)
this.HighLight = highlight_None;
else if (undefined !== textPr.HighLight)
this.HighLight = textPr.HighLight.Copy();

if (null === textPr.RStyle)
this.RStyle = undefined;
else if (undefined !== textPr.RStyle)
this.RStyle = textPr.RStyle;

if (null === textPr.Spacing)
this.Spacing = undefined;
else if (undefined !== textPr.Spacing)
this.Spacing = textPr.Spacing;

if (null === textPr.DStrikeout)
this.DStrikeout = undefined;
else if (undefined !== textPr.DStrikeout)
this.DStrikeout = textPr.DStrikeout;

if (null === textPr.SmallCaps)
this.SmallCaps = undefined;
else if (undefined !== textPr.SmallCaps)
this.SmallCaps = textPr.SmallCaps;

if (null === textPr.Caps)
this.Caps = undefined;
else if (undefined !== textPr.Caps)
this.Caps = textPr.Caps;

if (null === textPr.Position)
this.Position = undefined;
else if (undefined !== textPr.Position)
this.Position = textPr.Position;

if (textPr.RFonts)
this.RFonts.Merge(textPr.RFonts);

if (null === textPr.CS)
this.CS = undefined;
else if (undefined !== textPr.CS)
this.CS = textPr.CS;

if (null === textPr.RTL)
this.RTL = undefined;
else if (undefined !== textPr.RTL)
this.RTL = textPr.RTL;

if (null === textPr.Lang)
this.Lang.Clear();
else if (textPr.Lang)
this.Lang.Apply(textPr.Lang);

if (null === textPr.Unifill)
this.Unifill = undefined;
else if (textPr.Unifill)
this.Unifill = textPr.Unifill.createDuplicate();

if (null === textPr.FontRef)
this.FontRef = undefined;
else if (textPr.FontRef)
this.FontRef = textPr.FontRef.createDuplicate();

if (null === textPr.TextOutline)
this.TextOutline = undefined;
else if (textPr.TextOutline)
this.TextOutline = textPr.TextOutline.createDuplicate();

if (null === textPr.TextFill)
this.TextFill = undefined;
else if (textPr.TextFill)
this.TextFill = textPr.TextFill.createDuplicate();

if (null === textPr.HighlightColor)
this.HighlightColor = undefined;
else if (textPr.HighlightColor)
this.HighlightColor = textPr.HighlightColor.createDuplicate();

if (null === textPr.Shd)
this.Shd = undefined;
else if (undefined !== textPr.Shd)
this.Shd = textPr.Shd.Copy();

if (null === textPr.Vanish)
this.Vanish = undefined;
else if (undefined !== textPr.Vanish)
this.Vanish = textPr.Vanish;

if (null === textPr.Ligatures)
this.Ligatures = undefined;
else if (undefined !== textPr.Ligatures)
this.Ligatures = textPr.Ligatures;

if (null === textPr.FontScale)
this.FontScale = undefined;
else if (undefined !== textPr.FontScale)
this.FontScale = textPr.FontScale;
};
CTextPr.prototype.InitDefault = function(nCompatibilityMode)
{
this.Bold = false;
Expand Down

0 comments on commit 566ce97

Please sign in to comment.