Skip to content
Snippets Groups Projects
Commit 971f3e69 authored by srosse's avatar srosse
Browse files

OO-1593: beautiful hotspot with transparency and theme1 embedded in docx

parent f72fe434
No related branches found
No related tags found
No related merge requests found
......@@ -1435,10 +1435,10 @@ public class OpenXMLDocument {
appendGraphicEllipse(spPrEl, size, element);
}
appendGraphicSolidFill(spPrEl, element.getStyle());
appendGraphicSolidFill_transparent(spPrEl, element.getStyle());
//spPrEl.appendChild(document.createElement("a:noFill"));
Element lnEl = (Element)spPrEl.appendChild(document.createElement("a:ln"));
lnEl.setAttribute("w", "38100");
//spPrEl.appendChild(document.createElement("a:noFill"));
spPrEl.appendChild(document.createElement("a:effectLst"));
//styles
......@@ -1455,22 +1455,16 @@ public class OpenXMLDocument {
/*
<a:solidFill>
<a:schemeClr val="accent3">
<a:lumMod val="60000" />
<a:lumOff val="40000" />
<a:alpha val="63000" />
</a:schemeClr>
</a:solidFill>
*/
private void appendGraphicSolidFill(Element parentEl, OpenXMLGraphic.Style style) {
private void appendGraphicSolidFill_transparent(Element parentEl, OpenXMLGraphic.Style style) {
Element solidFillEl = (Element)parentEl.appendChild(document.createElement("a:solidFill"));
Element schemeClrEl = (Element)solidFillEl.appendChild(document.createElement("a:schemeClr"));
schemeClrEl.setAttribute("val", style.name());
/*Element lumModEl = (Element)solidFillEl.appendChild(document.createElement("a:lumMod"));
lumModEl.setAttribute("val", "60000");
Element lumOffEl = (Element)solidFillEl.appendChild(document.createElement("a:lumOff"));
lumOffEl.setAttribute("val", "60000");*/
Element alphaEl = (Element)solidFillEl.appendChild(document.createElement("a:alpha"));
Element alphaEl = (Element)schemeClrEl.appendChild(document.createElement("a:alpha"));
alphaEl.setAttribute("val", "50000");
}
......@@ -1615,11 +1609,11 @@ public class OpenXMLDocument {
return filename;
}
private String generateId() {
protected String generateId() {
return "rId" + (++currentId);
}
private String generateSimpleId() {
protected String generateSimpleId() {
return Integer.toString(++currentId);
}
......
......@@ -67,6 +67,7 @@ public class OpenXMLDocumentWriter {
public static final String CT_NUMBERING = "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml";
public static final String CT_STYLES = "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml";
public static final String CT_HEADER = "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml";
public static final String CT_THEME = "application/vnd.openxmlformats-officedocument.theme+xml";
public void createDocument(ZipOutputStream out, OpenXMLDocument document)
......@@ -102,7 +103,7 @@ public class OpenXMLDocumentWriter {
//word/media
appendMedias(out, document);
/* word/theme/theme1.xml
// word/theme/theme1.xml
out.putNextEntry(new ZipEntry("word/theme/theme1.xml"));
try(InputStream in = OpenXMLDocumentWriter.class.getResourceAsStream("_resources/theme1.xml")) {
IOUtils.copy(in, out);
......@@ -110,7 +111,6 @@ public class OpenXMLDocumentWriter {
log.error("", e);
}
out.closeEntry();
*/
//word/numbering
ZipEntry numberingDocument = new ZipEntry("word/numbering.xml");
......@@ -234,6 +234,10 @@ public class OpenXMLDocumentWriter {
headerRef.getFilename(), writer);
}
}
addRelationship(document.generateId(), "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",
"theme/theme1.xml", writer);
writer.writeEndElement();// end Relationships
writer.writeEndDocument();
......@@ -375,11 +379,12 @@ public class OpenXMLDocumentWriter {
createContentTypesOverride("/word/document.xml", CT_WORD_DOCUMENT, writer);
createContentTypesOverride("/word/styles.xml", CT_STYLES, writer);
createContentTypesOverride("/word/numbering.xml", CT_NUMBERING, writer);
createContentTypesOverride("/word/theme/theme1.xml", CT_THEME, writer);
for(HeaderReference headerRef:document.getHeaders()) {
createContentTypesOverride("/word/" + headerRef.getFilename(), CT_HEADER, writer);
}
writer.writeEndElement();// end Types
writer.flush();
writer.close();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment