Skip to content

Commit

Permalink
Init global variables from custom property
Browse files Browse the repository at this point in the history
  • Loading branch information
Coolcooo committed Feb 4, 2025
1 parent 915521f commit e15c9e7
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
12 changes: 12 additions & 0 deletions common/Drawings/Format/Format.js
Original file line number Diff line number Diff line change
Expand Up @@ -13855,6 +13855,17 @@
}

InitClass(CCustomProperty, CBaseNoIdObject, 0);
CCustomProperty.prototype.initGlobalVariables = function() {
switch (this.name) {
case "smartart_text_test":
if (this.content && this.content.bContent) {
AscCommon.IS_GENERATE_SMARTART_AND_TEXT_ON_OPEN = true;
}
break;
default:
break;
}
};
CCustomProperty.prototype.fromStream = function (s) {
var _type;
var _len = s.GetULong();
Expand Down Expand Up @@ -13909,6 +13920,7 @@
}
}
}
this.initGlobalVariables();
s.Seek2(_end_pos);
};
CCustomProperty.prototype.toStream = function (s) {
Expand Down
10 changes: 8 additions & 2 deletions common/Drawings/Format/Shape.js
Original file line number Diff line number Diff line change
Expand Up @@ -5326,6 +5326,12 @@
}
}
};
CShape.prototype.isSmartArtTextTestMode = function() {
if (AscCommon.IS_GENERATE_SMARTART_AND_TEXT_ON_OPEN) {
return !(this.pen && this.pen.Fill && this.pen.Fill.fill && !(this.pen.Fill.fill instanceof AscFormat.CNoFill));
}
return false;
};

/**
* @memberOf CShape
Expand Down Expand Up @@ -5573,8 +5579,8 @@
this.isPlaceholder && this.isPlaceholder()) {
bMasterPh = true;
}
if (/*(!(this.pen && this.pen.Fill && this.pen.Fill.fill && !(this.pen.Fill.fill instanceof AscFormat.CNoFill)) && AscCommon.IS_GENERATE_SMARTART_AND_TEXT_ON_OPEN) || */(!graphics.isSmartArtPreviewDrawer && !graphics.isPdf() && !this.bWordShape && (this.isEmptyPlaceholder() && !this.isObjectInSmartArt() || bMasterPh) && !(this.parent && this.parent.kind === AscFormat.TYPE_KIND.NOTES) && !(this.pen && this.pen.Fill && this.pen.Fill.fill && !(this.pen.Fill.fill instanceof AscFormat.CNoFill)) && (graphics.IsNoDrawingEmptyPlaceholder !== true || bMasterPh) && !AscCommon.IsShapeToImageConverter)
|| (Asc.editor.isPdfEditor() && !graphics.isPdf() && !graphics.isSmartArtPreviewDrawer && this.IsDrawing && this.IsDrawing() && this.ShouldDrawImaginaryBorder(graphics) && (graphics.IsNoDrawingEmptyPlaceholder !== true || bMasterPh) && !AscCommon.IsShapeToImageConverter)) {
if ((!graphics.isSmartArtPreviewDrawer && !graphics.isPdf() && !this.bWordShape && (this.isEmptyPlaceholder() && !this.isObjectInSmartArt() || bMasterPh) && !(this.parent && this.parent.kind === AscFormat.TYPE_KIND.NOTES) && !(this.pen && this.pen.Fill && this.pen.Fill.fill && !(this.pen.Fill.fill instanceof AscFormat.CNoFill)) && (graphics.IsNoDrawingEmptyPlaceholder !== true || bMasterPh) && !AscCommon.IsShapeToImageConverter)
|| (Asc.editor.isPdfEditor() && !graphics.isPdf() && !graphics.isSmartArtPreviewDrawer && this.IsDrawing && this.IsDrawing() && this.ShouldDrawImaginaryBorder(graphics) && (graphics.IsNoDrawingEmptyPlaceholder !== true || bMasterPh) && !AscCommon.IsShapeToImageConverter) || this.isSmartArtTextTestMode()) {
var drawingObjects = this.getDrawingObjectsController();
if (typeof editor !== "undefined" && editor && graphics.m_oContext !== undefined && graphics.m_oContext !== null && !graphics.isTrack() && (Asc.editor.isPdfEditor() || !drawingObjects || AscFormat.getTargetTextObject(drawingObjects) !== this)) {
var angle = _transform.GetRotation();
Expand Down
5 changes: 4 additions & 1 deletion common/Drawings/Format/TextBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,12 @@
CTextBody.prototype.checkCurrentPlaceholder = function() {
return false;
};
CTextBody.prototype.isSmartArtTextTestMode = function() {
return AscCommon.IS_GENERATE_SMARTART_AND_TEXT_ON_OPEN;
};
CTextBody.prototype.draw = function(graphics) {
if((!this.content || this.content.Is_Empty()) && !AscCommon.IsShapeToImageConverter && this.parent.isEmptyPlaceholder() && !this.checkCurrentPlaceholder()) {
if(/*AscCommon.IS_GENERATE_SMARTART_AND_TEXT_ON_OPEN || */graphics.IsNoDrawingEmptyPlaceholder !== true && graphics.IsNoDrawingEmptyPlaceholderText !== true && this.content2 && !graphics.isPdf()) {
if(graphics.IsNoDrawingEmptyPlaceholder !== true && graphics.IsNoDrawingEmptyPlaceholderText !== true && this.content2 && !graphics.isPdf() || this.isSmartArtTextTestMode()) {
if(!graphics.isSupportTextDraw()) {
let _w2 = this.content2.XLimit;
let _h2 = this.content2.GetSummaryHeight();
Expand Down
4 changes: 0 additions & 4 deletions common/SmartArts/SmartArtTree.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@
"use strict";

(function (window) {
// const IS_DEBUG_DRAWING = true;
// const IS_ADD_HTML = false;
AscCommon.IS_GENERATE_SMARTART_AND_TEXT_ON_OPEN = false;

const LayoutNode = AscFormat.LayoutNode;
const Choose = AscFormat.Choose;
const If = AscFormat.If;
Expand Down

0 comments on commit e15c9e7

Please sign in to comment.