Merge branch 'feature/diagram' into release/v9.0.0

# Conflicts:
#	common/Drawings/Format/Format.js
This commit is contained in:
Sergey Konovalov
2025-04-30 02:07:15 +03:00
3 changed files with 95 additions and 5 deletions

View File

@ -637,7 +637,7 @@
pWriter._WriteUInt2(2, this.lineEx.startSize);
pWriter._WriteUInt2(3, this.lineEx.end);
pWriter._WriteUInt2(4, this.lineEx.endSize);
// pWriter._WriteUInt2(5, this.lineEx.pattern);
pWriter._WriteUInt2(5, this.lineEx.pattern);
pWriter.WriteUChar(AscCommon.g_nodeAttributeEnd);
pWriter.EndRecord();
if (Object.keys(this.sketch).length > 0) {
@ -651,8 +651,9 @@
pWriter.EndRecord();
}
};
function CVariationClrScheme() {
CBaseNoIdObject.call(this);
CBaseFormatNoIdObject.call(this);
/**
*
* @type {*}
@ -664,7 +665,40 @@
*/
this.varColor = [];
}
InitClass(CVariationClrScheme, CBaseNoIdObject, 0);
InitClass(CVariationClrScheme, CBaseFormatNoIdObject, 0);
CVariationClrScheme.prototype.readAttribute = undefined;
/**
* Read children from stream for CVariationClrScheme
*
* @param {number} elementType - The type of the element to read
* @param {CBinaryFileReader} pReader - The binary reader
* @return {boolean} True if the element was read, false otherwise
*/
CVariationClrScheme.prototype.readChild = function(elementType, pReader) {
let handled = true;
if (0 <= elementType && elementType < 7) {
let varColor = new CVarColor();
varColor.unicolor = pReader.ReadUniColor();
this.varColor[elementType] = varColor;
} else {
handled = false;
}
return handled;
}
CVariationClrScheme.prototype.privateWriteAttributes = undefined;
/**
* Write children to stream for CLineStyle
*
* @param {CBinaryFileWriter} pWriter - The binary writer
*/
CVariationClrScheme.prototype.writeChildren = function(pWriter) {
for (let i = 0; i < this.varColor.length; i++) {
if (!this.varColor[i] || !this.varColor[i].unicolor) {
continue;
}
pWriter.WriteRecord1(i, this.varColor[i].unicolor, pWriter.WriteUniColor);
}
};
function CVarColor() {
CBaseNoIdObject.call(this);

View File

@ -3634,6 +3634,7 @@ function BinaryPPTYLoader()
this.ReadClrScheme = function(clrscheme)
{
const t = this;
var s = this.stream;
var _e = s.cur + s.GetULong() + 4;
@ -3652,8 +3653,45 @@ function BinaryPPTYLoader()
while (s.cur < _e)
{
var _rec = s.GetUChar();
clrscheme.addColor(_rec,this.ReadUniColor());
if (_rec === 20)
{
AscFormat.CBaseFormatNoIdObject.prototype.fromPPTY.call({
readChildren: AscFormat.CBaseFormatNoIdObject.prototype.readChildren,
readChild: function(elementType, pReader) {
if (elementType === 0) {
if (!clrscheme.clrSchemeExtLst) {
clrscheme.clrSchemeExtLst = new AscFormat.CClrSchemeExtLst();
}
clrscheme.clrSchemeExtLst.background = new AscFormat.CVarColor();
clrscheme.clrSchemeExtLst.background.unicolor = t.ReadUniColor();
return true;
}
return false;
}
}, this);
}
else if (_rec === 21)
{
AscFormat.CBaseFormatNoIdObject.prototype.fromPPTY.call({
readChildren: AscFormat.CBaseFormatNoIdObject.prototype.readChildren,
readChild: function(elementType, pReader) {
if (elementType === 0) {
if (!clrscheme.clrSchemeExtLst) {
clrscheme.clrSchemeExtLst = new AscFormat.CClrSchemeExtLst();
}
let variationClrScheme = new AscFormat.CVariationClrScheme();
variationClrScheme.fromPPTY(pReader);
clrscheme.clrSchemeExtLst.variationClrSchemeLst.push(variationClrScheme);
return true;
}
return false;
}
}, this);
}
else
{
clrscheme.addColor(_rec,this.ReadUniColor());
}
}
s.Seek2(_e);

View File

@ -1752,6 +1752,24 @@ function CBinaryFileWriter()
oThis.WriteRecord1(i, scheme.colors[i], oThis.WriteUniColor);
}
}
if (scheme.clrSchemeExtLst)
{
if (scheme.clrSchemeExtLst.background && scheme.clrSchemeExtLst.background.unicolor)
{
oThis.StartRecord(20);
oThis.WriteRecord1(0, scheme.clrSchemeExtLst.background.unicolor, oThis.WriteUniColor);
oThis.EndRecord();
}
if (scheme.clrSchemeExtLst.variationClrSchemeLst.length > 0)
{
oThis.StartRecord(21);
for (let i = 0; i < scheme.clrSchemeExtLst.variationClrSchemeLst.length; i++)
{
oThis.WriteRecordPPTY(0, scheme.clrSchemeExtLst.variationClrSchemeLst[i]);
}
oThis.EndRecord();
}
}
};
this.WriteClrMapOvr = function(clrmapovr)
{