mirror of https://github.com/apache/poi.git
#65228 - the method getCap() does not work correctly in xslf.usermodel.XSLFTextRun
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1889111 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
48d3c68270
commit
1d594451d8
|
@ -65,6 +65,7 @@ public final class CharacterPropertyFetcher<T> extends PropertyFetcher<T> {
|
||||||
|
|
||||||
if (!(sheet instanceof XSLFSlideMaster)) {
|
if (!(sheet instanceof XSLFSlideMaster)) {
|
||||||
fetchRunProp();
|
fetchRunProp();
|
||||||
|
fetchParagraphDefaultRunProp();
|
||||||
fetchShapeProp(shape);
|
fetchShapeProp(shape);
|
||||||
fetchThemeProp(shape);
|
fetchThemeProp(shape);
|
||||||
}
|
}
|
||||||
|
@ -78,6 +79,15 @@ public final class CharacterPropertyFetcher<T> extends PropertyFetcher<T> {
|
||||||
fetchProp(run.getRPr(false));
|
fetchProp(run.getRPr(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void fetchParagraphDefaultRunProp() {
|
||||||
|
if (!isSet()) {
|
||||||
|
CTTextParagraphProperties pr = run.getParagraph().getXmlObject().getPPr();
|
||||||
|
if (pr != null) {
|
||||||
|
fetchProp(pr.getDefRPr());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void fetchShapeProp(XSLFShape shape) {
|
private void fetchShapeProp(XSLFShape shape) {
|
||||||
if (!isSet()) {
|
if (!isSet()) {
|
||||||
shape.fetchShapeProperty(this);
|
shape.fetchShapeProperty(this);
|
||||||
|
|
|
@ -77,25 +77,7 @@ import org.apache.poi.sl.usermodel.TextShape;
|
||||||
import org.apache.poi.sl.usermodel.VerticalAlignment;
|
import org.apache.poi.sl.usermodel.VerticalAlignment;
|
||||||
import org.apache.poi.util.IOUtils;
|
import org.apache.poi.util.IOUtils;
|
||||||
import org.apache.poi.util.NullPrintStream;
|
import org.apache.poi.util.NullPrintStream;
|
||||||
import org.apache.poi.xslf.usermodel.XMLSlideShow;
|
import org.apache.poi.xslf.usermodel.*;
|
||||||
import org.apache.poi.xslf.usermodel.XSLFAutoShape;
|
|
||||||
import org.apache.poi.xslf.usermodel.XSLFGroupShape;
|
|
||||||
import org.apache.poi.xslf.usermodel.XSLFHyperlink;
|
|
||||||
import org.apache.poi.xslf.usermodel.XSLFNotes;
|
|
||||||
import org.apache.poi.xslf.usermodel.XSLFObjectShape;
|
|
||||||
import org.apache.poi.xslf.usermodel.XSLFPictureData;
|
|
||||||
import org.apache.poi.xslf.usermodel.XSLFPictureShape;
|
|
||||||
import org.apache.poi.xslf.usermodel.XSLFRelation;
|
|
||||||
import org.apache.poi.xslf.usermodel.XSLFShape;
|
|
||||||
import org.apache.poi.xslf.usermodel.XSLFSlide;
|
|
||||||
import org.apache.poi.xslf.usermodel.XSLFSlideLayout;
|
|
||||||
import org.apache.poi.xslf.usermodel.XSLFSlideMaster;
|
|
||||||
import org.apache.poi.xslf.usermodel.XSLFTable;
|
|
||||||
import org.apache.poi.xslf.usermodel.XSLFTableCell;
|
|
||||||
import org.apache.poi.xslf.usermodel.XSLFTableRow;
|
|
||||||
import org.apache.poi.xslf.usermodel.XSLFTextBox;
|
|
||||||
import org.apache.poi.xslf.usermodel.XSLFTextParagraph;
|
|
||||||
import org.apache.poi.xslf.usermodel.XSLFTextRun;
|
|
||||||
import org.apache.poi.xslf.util.DummyGraphics2d;
|
import org.apache.poi.xslf.util.DummyGraphics2d;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.Disabled;
|
import org.junit.jupiter.api.Disabled;
|
||||||
|
@ -1080,4 +1062,18 @@ class TestXSLFBugs {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void bug65228() throws IOException {
|
||||||
|
try (XMLSlideShow ppt = openSampleDocument("bug65228.pptx")) {
|
||||||
|
TextRun.TextCap act = ppt.getSlides().stream()
|
||||||
|
.flatMap(s -> s.getShapes().stream())
|
||||||
|
.filter(s -> "März 2021\u2026".equals(s.getShapeName()))
|
||||||
|
.map(XSLFTextShape.class::cast)
|
||||||
|
.flatMap(s -> s.getTextParagraphs().stream())
|
||||||
|
.flatMap(s -> s.getTextRuns().stream())
|
||||||
|
.map(XSLFTextRun::getTextCap)
|
||||||
|
.findFirst().orElse(null);
|
||||||
|
assertEquals(TextRun.TextCap.ALL, act);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class ImageHeaderEMF {
|
||||||
int top = LittleEndian.getInt(data, offset); offset += 4;
|
int top = LittleEndian.getInt(data, offset); offset += 4;
|
||||||
int right = LittleEndian.getInt(data, offset); offset += 4;
|
int right = LittleEndian.getInt(data, offset); offset += 4;
|
||||||
int bottom = LittleEndian.getInt(data, offset); offset += 4;
|
int bottom = LittleEndian.getInt(data, offset); offset += 4;
|
||||||
deviceBounds = new Rectangle(left, top, right-left, bottom-top);
|
deviceBounds = new Rectangle(left, top, right-left == -1 ? 0 : right-left, bottom-top == -1 ? 0 : bottom-top);
|
||||||
// ignore frame bounds
|
// ignore frame bounds
|
||||||
offset += 16;
|
offset += 16;
|
||||||
String signature = new String(data, offset, EMF_SIGNATURE.length(), LocaleUtil.CHARSET_1252);
|
String signature = new String(data, offset, EMF_SIGNATURE.length(), LocaleUtil.CHARSET_1252);
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue