[bug-66176] rework text box support

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1903047 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2022-07-27 08:59:25 +00:00
parent cee18e78b5
commit 1ce0f77bdd
4 changed files with 8 additions and 7 deletions

View File

@ -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;
}

View File

@ -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());

View File

@ -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;

View File

@ -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()) {