mirror of https://github.com/apache/poi.git
reuse code
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1903737 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f6751ef514
commit
25f00ba7c2
|
@ -54,7 +54,7 @@ public class POIXMLTypeLoader {
|
|||
// DEFAULT_XML_OPTIONS.setUnsynchronized();
|
||||
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("http://schemas.openxmlformats.org/drawingml/2006/main", "a");
|
||||
map.put(XSSFRelation.NS_DRAWINGML, "a");
|
||||
map.put("http://schemas.openxmlformats.org/drawingml/2006/chart", "c");
|
||||
map.put("http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", "wp");
|
||||
map.put(PackageNamespaces.MARKUP_COMPATIBILITY, "ve");
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package org.apache.poi.xslf.model;
|
||||
|
||||
import static org.apache.poi.ooxml.util.XPathHelper.selectProperty;
|
||||
import static org.apache.poi.xssf.usermodel.XSSFRelation.NS_DRAWINGML;
|
||||
import static org.apache.poi.xssf.usermodel.XSSFRelation.NS_PRESENTATIONML;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
@ -46,7 +47,7 @@ public final class ParagraphPropertyFetcher<T> extends PropertyFetcher<T> {
|
|||
|
||||
|
||||
static final String PML_NS = NS_PRESENTATIONML;
|
||||
static final String DML_NS = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
||||
static final String DML_NS = NS_DRAWINGML;
|
||||
|
||||
private static final QName[] TX_BODY = { new QName(PML_NS, "txBody") };
|
||||
private static final QName[] LST_STYLE = { new QName(DML_NS, "lstStyle") };
|
||||
|
|
|
@ -26,12 +26,13 @@ import org.apache.poi.ooxml.POIXMLDocument;
|
|||
import org.apache.poi.ooxml.POIXMLRelation;
|
||||
import org.apache.poi.sl.usermodel.PictureData.PictureType;
|
||||
import org.apache.poi.util.Beta;
|
||||
import org.apache.poi.xssf.usermodel.XSSFRelation;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
@SuppressWarnings({"unused", "WeakerAccess"})
|
||||
@Beta
|
||||
public final class XSLFRelation extends POIXMLRelation {
|
||||
/* package */ static final String NS_DRAWINGML = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
||||
/* package */ static final String NS_DRAWINGML = XSSFRelation.NS_DRAWINGML;
|
||||
|
||||
/**
|
||||
* A map to lookup POIXMLRelation by its relation type
|
||||
|
|
|
@ -60,6 +60,7 @@ import org.openxmlformats.schemas.presentationml.x2006.main.CTPlaceholder;
|
|||
import org.openxmlformats.schemas.presentationml.x2006.main.CTShape;
|
||||
import org.openxmlformats.schemas.presentationml.x2006.main.STPlaceholderType;
|
||||
|
||||
import static org.apache.poi.xssf.usermodel.XSSFRelation.NS_DRAWINGML;
|
||||
import static org.apache.poi.xssf.usermodel.XSSFRelation.NS_PRESENTATIONML;
|
||||
|
||||
/**
|
||||
|
@ -73,7 +74,7 @@ public abstract class XSLFShape implements Shape<XSLFShape,XSLFTextParagraph> {
|
|||
T parse(XMLStreamReader reader) throws XmlException;
|
||||
}
|
||||
|
||||
static final String DML_NS = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
||||
static final String DML_NS = NS_DRAWINGML;
|
||||
static final String PML_NS = NS_PRESENTATIONML;
|
||||
|
||||
private static final QName[] NV_CONTAINER = {
|
||||
|
|
|
@ -24,6 +24,8 @@ import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShape;
|
|||
import org.apache.xmlbeans.XmlObject;
|
||||
import org.apache.poi.util.Internal;
|
||||
|
||||
import static org.apache.poi.xssf.usermodel.XSSFRelation.NS_DRAWINGML;
|
||||
|
||||
/**
|
||||
* Used internally to navigate the paragraph text style hierarchy within a shape and fetch properties
|
||||
*/
|
||||
|
@ -54,7 +56,7 @@ public abstract class ParagraphPropertyFetcher<T> {
|
|||
|
||||
XmlObject[] o = shape.selectPath(
|
||||
"declare namespace xdr='http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing' " +
|
||||
"declare namespace a='http://schemas.openxmlformats.org/drawingml/2006/main' " +
|
||||
"declare namespace a='" + NS_DRAWINGML + "' " +
|
||||
".//xdr:txBody/a:lstStyle/a:lvl" + (_level + 1) + "pPr"
|
||||
);
|
||||
if (o.length == 1) {
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package org.apache.poi.xddf.usermodel;
|
||||
|
||||
import static org.apache.poi.xssf.usermodel.XSSFRelation.NS_DRAWINGML;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
@ -38,7 +39,7 @@ import org.xmlunit.builder.Input;
|
|||
import org.xmlunit.diff.Diff;
|
||||
|
||||
class TestXDDFColor {
|
||||
private static final String XMLNS = "xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\"/>";
|
||||
private static final String XMLNS = "xmlns:a=\"" + NS_DRAWINGML + "\"/>";
|
||||
|
||||
@Test
|
||||
void testSchemeColor() throws IOException {
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
==================================================================== */
|
||||
package org.apache.poi.xssf.usermodel;
|
||||
|
||||
import static org.apache.poi.xssf.usermodel.XSSFRelation.NS_DRAWINGML;
|
||||
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
@ -165,7 +166,7 @@ class TestXSSFDrawing {
|
|||
// Ensure it got the right namespaces
|
||||
String xml = ctDrawing.toString();
|
||||
assertTrue(xml.contains("xmlns:xdr=\"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing\""));
|
||||
assertTrue(xml.contains("xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\""));
|
||||
assertTrue(xml.contains("xmlns:a=\"" + NS_DRAWINGML + '\"'));
|
||||
|
||||
checkRewrite(wb2);
|
||||
wb2.close();
|
||||
|
|
Loading…
Reference in New Issue