From 0097723bcb7422e0643db09c678d10fcad0aa157 Mon Sep 17 00:00:00 2001 From: Fedor Kobyakov Date: Wed, 30 Jul 2025 13:37:06 +0300 Subject: [PATCH] [ve] Move uniFillForegnd assign so it considers quickStyleVariation result; Fix bug 76061 --- visio/model/ooxmlApi/convertFunctions.js | 62 ++++++++++++------------ 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/visio/model/ooxmlApi/convertFunctions.js b/visio/model/ooxmlApi/convertFunctions.js index c0cdbb06fd..967f228064 100644 --- a/visio/model/ooxmlApi/convertFunctions.js +++ b/visio/model/ooxmlApi/convertFunctions.js @@ -213,28 +213,6 @@ uniFillForegnd: false } - let fillGradientEnabledCell = this.getCell("FillGradientEnabled"); - if (fillGradientEnabledCell !== undefined) { - fillGradientEnabled = fillGradientEnabledCell.calculateValue(this, pageInfo, - visioDocument.themes, undefined, true); - } else { - fillGradientEnabled = false; - } - - - // FillGradientDir and FillPattern can tell about gradient type - // if FillGradient Enabled - // FillGradientDir defines gradient type. If gradient is linear gradient type is complemented with angle. - // 13 FillGradientDir is path. path cant be set in interface. also like some radial gradient types witch cant be set in interface. - // FillGradientDir > 13 is linear like FillGradientDir = 0 - // - // if FillGradientEnabled Disabled - // FillPattern defines gradient type and colors define. There linear types with different predefined angles, rectandulat and radial gradient types. - // Rectangular and radial gradient types differs. There are two colors when i set three colors for gradient. Also FillPattern gradients are not listed in - // interface. Only true patterns. - // - // Its better to convert linear FillPattern gradients there. But FillPattern radial gradients seems to be - // not like FillGradientDir radial gradients but with different colors // Calculate fillForegnd without gradient anyway for handleQuickStyleVariation let fillForegndCell = this.getCell("FillForegnd"); @@ -260,14 +238,6 @@ uniFillForegndNoGradient = AscFormat.CreateUnfilFromRGB(255, 255, 255); } - if (fillGradientEnabled) { - uniFillForegnd = calculateGradient(this, pageInfo, - visioDocument.themes, themeValWasUsedFor, true); - } else { - uniFillForegnd = uniFillForegndNoGradient; - } - - let fillBkgndCell = this.getCell("FillBkgnd"); if (fillBkgndCell) { // AscCommon.consoleLog("FillBkgnd was found:", fillBkgndCell); @@ -339,10 +309,38 @@ lineUniFillNoGradient = newFills[1]; } + // FillGradientDir and FillPattern can tell about gradient type + // if FillGradient Enabled + // FillGradientDir defines gradient type. If gradient is linear gradient type is complemented with angle. + // 13 FillGradientDir is path. path cant be set in interface. also like some radial gradient types witch cant be set in interface. + // FillGradientDir > 13 is linear like FillGradientDir = 0 + // + // if FillGradientEnabled Disabled + // FillPattern defines gradient type and colors define. There linear types with different predefined angles, rectandulat and radial gradient types. + // Rectangular and radial gradient types differs. There are two colors when i set three colors for gradient. Also FillPattern gradients are not listed in + // interface. Only true patterns. + // + // Its better to convert linear FillPattern gradients there. But FillPattern radial gradients seems to be + // not like FillGradientDir radial gradients but with different colors + + let fillGradientEnabledCell = this.getCell("FillGradientEnabled"); + if (fillGradientEnabledCell !== undefined) { + fillGradientEnabled = fillGradientEnabledCell.calculateValue(this, pageInfo, + visioDocument.themes, undefined, true); + } else { + fillGradientEnabled = false; + } + + if (fillGradientEnabled) { + uniFillForegnd = calculateGradient(this, pageInfo, + visioDocument.themes, themeValWasUsedFor, true); + } else { + uniFillForegnd = uniFillForegndNoGradient; + } + let lineGradientEnabled; let lineGradientEnabledCell = this.getCell("LineGradientEnabled"); if (lineGradientEnabledCell !== undefined) { - // Line gradient uniFill is not supported for now so let's take middle color from gradient lineGradientEnabled = lineGradientEnabledCell.calculateValue(this, pageInfo, visioDocument.themes); } else { @@ -350,7 +348,7 @@ } if (lineGradientEnabled) { - // line gradient is not supported so let's take one color from gradient and apply it + // Line gradient uniFill is not supported for now so let's take middle color from gradient let lineGradientFill = calculateGradient(this, pageInfo, visioDocument.themes, themeValWasUsedFor, false); let colorIndex = Math.floor(lineGradientFill.fill.colors.length / 2);