Skip to content

Commit

Permalink
[de] Implement rendering block-level content controls with custom sha…
Browse files Browse the repository at this point in the history
…de color and custom border color
  • Loading branch information
KirillovIlya committed Feb 7, 2025
1 parent ac19db2 commit 33b4ddf
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions word/Editor/StructuredDocumentTags/BlockLevel.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,31 @@ CBlockLevelSdt.prototype.Read_FromBinary2 = function(Reader)
};
CBlockLevelSdt.prototype.Draw = function(CurPage, oGraphics)
{
if (this.LogicDocument.GetSdtGlobalShowHighlight() && !oGraphics.isPdf())
let shdColor = this.getShdColor();
if (!shdColor && (this.LogicDocument.GetSdtGlobalShowHighlight() && !oGraphics.isPdf()))
shdColor = AscWord.CDocumentColorA.fromObjectRgb(this.LogicDocument.GetSdtGlobalColor());

if (shdColor)
{
var oBounds = this.GetContentBounds(CurPage);
var oColor = this.LogicDocument.GetSdtGlobalColor();

oGraphics.b_color1(oColor.r, oColor.g, oColor.b, 255);
oGraphics.rect(oBounds.Left, oBounds.Top, oBounds.Right - oBounds.Left, oBounds.Bottom - oBounds.Top);
let pageBounds = this.GetContentBounds(CurPage);
oGraphics.b_color1(shdColor.r, shdColor.g, shdColor.b, shdColor.a);
oGraphics.rect(pageBounds.Left, pageBounds.Top, pageBounds.Right - pageBounds.Left, pageBounds.Bottom - pageBounds.Top);
oGraphics.df();
}

let borderColor = this.getBorderColor();
if (borderColor)
{
let pageBounds = this.GetContentBounds(CurPage);
oGraphics.p_color(borderColor.r, borderColor.g, borderColor.b, borderColor.a);
oGraphics.drawPolygonByRects([[{
X : pageBounds.Left,
Y : pageBounds.Top,
W : pageBounds.Right - pageBounds.Left,
H : pageBounds.Bottom - pageBounds.Top,
Page : 0
}]], 0, 0);
}

var isPlaceHolder = this.IsPlaceHolder();
var nTextAlpha;
Expand Down

0 comments on commit 33b4ddf

Please sign in to comment.