Skip to content

Commit

Permalink
Merge pull request #57 from airslate-oss/ASP-21029-nested-cc-for-if
Browse files Browse the repository at this point in the history
[ASP-21029] improve sdt support
  • Loading branch information
alekseytatarynov authored Oct 31, 2022
2 parents 8430c04 + c050f26 commit a50f6b5
Show file tree
Hide file tree
Showing 33 changed files with 1,648 additions and 935 deletions.
6 changes: 1 addition & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ subprojects {
apply plugin: 'de.thetaphi.forbiddenapis'
apply plugin: 'com.github.spotbugs'

version = '5.2.3-AIRSLATE-13'
version = '5.2.3-AIRSLATE-25'
ext {
bouncyCastleVersion = '1.70'
commonsCodecVersion = '1.15'
Expand Down Expand Up @@ -617,10 +617,6 @@ rat {
// ignore svn conflict artifacts
"**/module-info.*",
// airslate fork files
"poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/ISDTContentBlock.java",
"poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/ISDTContentRun.java",
"poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/ISDTContentsBlock.java",
"poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/ISDTContentsRun.java",
"poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFSDTBlock.java",
"poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFSDTContentBlock.java",
"poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFSDTContentRun.java",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ Licensed to the Apache Software Foundation (ASF) under one or more

@Internal
public class ZipArchiveThresholdInputStream extends FilterInputStream {
// don't alert for expanded sizes smaller than 100k
private static final long GRACE_ENTRY_SIZE = 100*1024L;
// don't alert for expanded sizes smaller than 100MiB
private static final long GRACE_ENTRY_SIZE = 100*1024*1024L;

private static final String MAX_ENTRY_SIZE_MSG =
"Zip bomb detected! The file would exceed the max size of the expanded data in the zip-file.\n" +
Expand Down
22 changes: 12 additions & 10 deletions poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/IBody.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public interface IBody {
/**
* Return the Sdt Blocks
*/
public List<XWPFSDTBlock> getSdtBlocks();
List<XWPFSDTBlock> getSdtBlocks();

/**
* Returns the paragraph corresponding to the provided {@link CTP}.
Expand All @@ -96,10 +96,8 @@ public interface IBody {
* if there is a corresponding {@link XWPFSDTBlock} of the parameter ctSdtBlock in the
* Content Controls list of this header, the method will return this sdt block
* if there is no corresponding {@link XWPFSDTBlock} the method will return null
*
* @param ctSdtBlock
*/
public XWPFSDTBlock getSdtBlock(CTSdtBlock ctSdtBlock);
XWPFSDTBlock getSdtBlock(CTSdtBlock ctSdtBlock);

/**
* Returns the paragraph that of position pos
Expand All @@ -111,6 +109,14 @@ public interface IBody {
*/
XWPFTable getTableArray(int pos);

XWPFParagraph createParagraph();

XWPFTable createTable();

XWPFSDTBlock createSdt();

void setSDTBlock(int pos, XWPFSDTBlock sdt);

/**
* inserts a new paragraph at position of the cursor
*/
Expand All @@ -123,10 +129,8 @@ public interface IBody {

/**
* inserts a new SdtBlock at the cursor position.
*
* @param cursor
*/
public XWPFSDTBlock insertNewSdtBlock(XmlCursor cursor);
XWPFSDTBlock insertNewSdtBlock(XmlCursor cursor);

/**
* inserts a new Table at position pos
Expand All @@ -140,10 +144,8 @@ public interface IBody {

/**
* Remove element from BodyElements
* @param pos
* @return
*/
public boolean removeBodyElement(int pos);
boolean removeBodyElement(int pos);

/**
* Return XWPFDocument
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Licensed to the Apache Software Foundation (ASF) under one or more
public interface IBodyElement {
IBody getBody();

XWPFDocument getDocument();

POIXMLDocumentPart getPart();

BodyType getPartType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ Licensed to the Apache Software Foundation (ASF) under one or more

import org.apache.poi.ooxml.POIXMLDocumentPart;
import org.apache.poi.wp.usermodel.Paragraph;
import org.apache.xmlbeans.XmlCursor;

import java.util.List;

/**
* Simple interface describing both {@link XWPFParagraph}
Expand All @@ -26,7 +29,37 @@ Licensed to the Apache Software Foundation (ASF) under one or more
* TODO Should this be based on / extend {@link Paragraph}?
*/
public interface IRunBody {
public XWPFDocument getDocument();
XWPFDocument getDocument();

POIXMLDocumentPart getPart();

List<IRunElement> getIRuns();

List<XWPFRun> getRuns();

List<XWPFSDTRun> getSDTRuns();

XWPFHyperlinkRun insertNewHyperlinkRun(int pos, String uri);

XWPFHyperlinkRun createHyperlinkRun(String uri);

XWPFFieldRun insertNewFieldRun(int pos);

XWPFFieldRun createFieldRun();

XWPFRun insertNewRun(int pos);

XWPFRun createRun();

XWPFSDTRun insertNewSDTRunByCursor(XmlCursor cursor);

void setSDTRun(int pos, XWPFSDTRun sdt);

XWPFSDTRun createSdtRun();

boolean removeIRunElement(int irunPos);

boolean removeRun(int pos);

public POIXMLDocumentPart getPart();
boolean removeSdtRun(int irunPos);
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more
==================================================================== */
package org.apache.poi.xwpf.usermodel;

import org.apache.poi.ooxml.POIXMLDocumentPart;
import org.apache.poi.wp.usermodel.CharacterRun;

/**
Expand All @@ -26,4 +27,10 @@ Licensed to the Apache Software Foundation (ASF) under one or more
* <p>
* TODO Make this based on {@link CharacterRun}
*/
public interface IRunElement {}
public interface IRunElement {
IRunBody getParent();

XWPFDocument getDocument();

POIXMLDocumentPart getPart();
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit a50f6b5

Please sign in to comment.