Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more

@Beta
public abstract class XSLFSheet extends POIXMLDocumentPart
implements XSLFShapeContainer, Sheet<XSLFShape,XSLFTextParagraph> {
implements XSLFShapeContainer, Sheet<XSLFShape,XSLFTextParagraph> {
private static final Logger LOG = PoiLogManager.getLogger(XSLFSheet.class);

private XSLFDrawing _drawing;
Expand All @@ -83,7 +83,7 @@ public abstract class XSLFSheet extends POIXMLDocumentPart
private XSLFTheme _theme;

private List<XSLFTextShape>_placeholders;
private Map<Integer, XSLFSimpleShape> _placeholderByIdMap;
private Map<Long, XSLFSimpleShape> _placeholderByIdMap;
private Map<Integer, XSLFSimpleShape> _placeholderByTypeMap;

private final SparseBitSet shapeIds = new SparseBitSet();
Expand Down Expand Up @@ -340,8 +340,8 @@ public Iterator<XSLFShape> iterator(){
@Override
public void addShape(XSLFShape shape) {
throw new UnsupportedOperationException(
"Adding a shape from a different container is not supported -"
+ " create it from scratch with the XSLFSheet.create* methods");
"Adding a shape from a different container is not supported -"
+ " create it from scratch with the XSLFSheet.create* methods");
}

/**
Expand Down Expand Up @@ -496,7 +496,7 @@ public XSLFSheet appendContent(XSLFSheet src){
return this;
}

/**
/**
* @return theme (shared styles) associated with this theme.
* By default returns {@code null} which means that this sheet is theme-less.
* Sheets that support the notion of themes (slides, masters, layouts, etc.) should override this
Expand All @@ -508,9 +508,9 @@ public XSLFTheme getTheme() {
}

getRelations().stream()
.filter(p -> p instanceof XSLFTheme)
.findAny()
.ifPresent(p -> _theme = (XSLFTheme)p);
.filter(p -> p instanceof XSLFTheme)
.findAny()
.ifPresent(p -> _theme = (XSLFTheme)p);

return _theme;
}
Expand All @@ -535,7 +535,7 @@ String mapSchemeColor(String schemeColor) {
protected XSLFTextShape getTextShapeByType(Placeholder type){
for(XSLFShape shape : this.getShapes()){
if(shape instanceof XSLFTextShape) {
XSLFTextShape txt = (XSLFTextShape)shape;
XSLFTextShape txt = (XSLFTextShape)shape;
if(txt.getTextType() == type) {
return txt;
}
Expand All @@ -553,7 +553,7 @@ public XSLFSimpleShape getPlaceholder(Placeholder ph) {
public XSLFSimpleShape getPlaceholder(CTPlaceholder ph) {
XSLFSimpleShape shape = null;
if(ph.isSetIdx()) {
shape = getPlaceholderById((int)ph.getIdx());
shape = getPlaceholderById(ph.getIdx());
}

if (shape == null && ph.isSetType()) {
Expand All @@ -575,8 +575,7 @@ private void initPlaceholders() {
if(ph != null) {
_placeholders.add(sShape);
if(ph.isSetIdx()) {
int idx = (int)ph.getIdx();
_placeholderByIdMap.put(idx, sShape);
_placeholderByIdMap.put(ph.getIdx(), sShape);
}
if(ph.isSetType()){
_placeholderByTypeMap.put(ph.getType().intValue(), sShape);
Expand All @@ -587,7 +586,7 @@ private void initPlaceholders() {
}
}

private XSLFSimpleShape getPlaceholderById(int id) {
private XSLFSimpleShape getPlaceholderById(long id) {
initPlaceholders();
return _placeholderByIdMap.get(id);
}
Expand Down Expand Up @@ -740,13 +739,13 @@ public void addChart(XSLFChart chart, Rectangle2D rect2D) {
}

protected String mapSchemeColor(CTColorMappingOverride cmapOver, String schemeColor) {
String slideColor = mapSchemeColor((cmapOver == null) ? null : cmapOver.getOverrideClrMapping(), schemeColor);
if (slideColor != null) {
return slideColor;
}
XSLFSheet master = (XSLFSheet)getMasterSheet();
String masterColor = (master == null) ? null : master.mapSchemeColor(schemeColor);
return (masterColor == null) ? schemeColor : masterColor;
String slideColor = mapSchemeColor((cmapOver == null) ? null : cmapOver.getOverrideClrMapping(), schemeColor);
if (slideColor != null) {
return slideColor;
}
XSLFSheet master = (XSLFSheet)getMasterSheet();
String masterColor = (master == null) ? null : master.mapSchemeColor(schemeColor);
return (masterColor == null) ? schemeColor : masterColor;
}

protected String mapSchemeColor(CTColorMapping cmap, String schemeColor) {
Expand Down