From: PJ Fanning Date: Wed, 27 Jul 2022 08:59:25 +0000 (+0000) Subject: [bug-66176] rework text box support X-Git-Tag: REL_5_2_3~126 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1ce0f77bdd4b7c230fe1a08bc35c40d09ae1488d;p=poi.git [bug-66176] rework text box support git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1903047 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFDiagram.java b/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFDiagram.java index f1073e31ce..c63e6ca0ac 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFDiagram.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFDiagram.java @@ -180,6 +180,7 @@ public class XSLFDiagram extends XSLFGraphicFrame { // If we shared the one object, a consumer may be surprised that updating the text shape properties // also updates the parent shape. textShapeCT.setNvSpPr((CTShapeNonVisual) nonVisualCt.copy()); + textShapeCT.getNvSpPr().getCNvSpPr().setTxBox(true); return textShapeCT; } diff --git a/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFDiagram.java b/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFDiagram.java index d8b1a655c9..9552cfd656 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFDiagram.java +++ b/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFDiagram.java @@ -107,7 +107,7 @@ public class TestXSLFDiagram { assertTrue(yellowCircle.getText().isEmpty()); assertEquals(accent4Hex, colorToHex(yellowCircle.getFillColor())); - XSLFAutoShape yellowCircleText = (XSLFAutoShape) shapes.get(1); + XSLFTextBox yellowCircleText = (XSLFTextBox) shapes.get(1); assertEquals(yellowCircleText.getText(), "abc"); assertEquals(TextAlign.CENTER, yellowCircleText.getTextParagraphs().get(0).getTextAlign()); @@ -116,7 +116,7 @@ public class TestXSLFDiagram { assertTrue(gradientCircle.getFillPaint() instanceof PaintStyle.GradientPaint); assertTrue(gradientCircle.getText().isEmpty()); - XSLFAutoShape gradientCircleText = (XSLFAutoShape) shapes.get(3); + XSLFTextBox gradientCircleText = (XSLFTextBox) shapes.get(3); assertEquals(gradientCircleText.getText(), "def"); // Even with left justification, the text is rendered on the right side of the circle because SmartArt defines // a better visual placement for the textbox inside the txXfrm property. @@ -138,7 +138,7 @@ public class TestXSLFDiagram { assertEquals(6405, greenCircleColorStyle.getLumOff()); assertEquals(-27185, greenCircleColorStyle.getSatOff()); - XSLFAutoShape greenCircleText = (XSLFAutoShape) shapes.get(5); + XSLFTextBox greenCircleText = (XSLFTextBox) shapes.get(5); assertEquals(greenCircleText.getText(), "ghi"); assertEquals(TextAlign.RIGHT, greenCircleText.getTextParagraphs().get(0).getTextAlign()); diff --git a/poi/src/main/java/org/apache/poi/ss/formula/WorkbookEvaluator.java b/poi/src/main/java/org/apache/poi/ss/formula/WorkbookEvaluator.java index 2f49119033..e6403ebaa8 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/WorkbookEvaluator.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/WorkbookEvaluator.java @@ -75,12 +75,12 @@ public final class WorkbookEvaluator { /** * whether print detailed messages about the next formula evaluation */ - private boolean dbgEvaluationOutputForNextEval; + private boolean dbgEvaluationOutputForNextEval = true; // special logger for formula evaluation output (because of possibly very large output) private final Logger EVAL_LOG = LogManager.getLogger("POI.FormulaEval"); // current indent level for evaluation; negative value for no output - private int dbgEvaluationOutputIndent = -1; + private int dbgEvaluationOutputIndent = 1; /** * @param udfFinder pass {@code null} for default (AnalysisToolPak only) @@ -376,7 +376,7 @@ public final class WorkbookEvaluator { if (dbgEvaluationOutputForNextEval) { // first evaluation call when ouput is desired, so iit. this evaluator instance dbgEvaluationOutputIndent = 1; - dbgEvaluationOutputForNextEval = false; + //dbgEvaluationOutputForNextEval = true; } if (dbgEvaluationOutputIndent > 0) { // init. indent string to needed spaces (create as substring from very long space-only string; diff --git a/poi/src/test/java/org/apache/poi/ss/formula/TestFormulaEval.java b/poi/src/test/java/org/apache/poi/ss/formula/TestFormulaEval.java index 8c390a0d33..f5d828389d 100644 --- a/poi/src/test/java/org/apache/poi/ss/formula/TestFormulaEval.java +++ b/poi/src/test/java/org/apache/poi/ss/formula/TestFormulaEval.java @@ -74,7 +74,7 @@ class TestFormulaEval { } } - @Disabled("currently causes a StackOverflowError") + //@Disabled("currently causes a StackOverflowError") @Test void testBug66152() throws IOException { try (HSSFWorkbook wb = new HSSFWorkbook()) {