mirror of https://github.com/apache/poi.git
- a few findbugs/sonar fixes
- removed obsolete openxml4j signature classes git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1704964 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
11f1887784
commit
84857ab688
|
@ -61,7 +61,8 @@ public final class EscherBSERecord extends EscherRecord {
|
||||||
int pos = offset + 8;
|
int pos = offset + 8;
|
||||||
field_1_blipTypeWin32 = data[pos];
|
field_1_blipTypeWin32 = data[pos];
|
||||||
field_2_blipTypeMacOS = data[pos + 1];
|
field_2_blipTypeMacOS = data[pos + 1];
|
||||||
System.arraycopy( data, pos + 2, field_3_uid = new byte[16], 0, 16 );
|
field_3_uid = new byte[16];
|
||||||
|
System.arraycopy( data, pos + 2, field_3_uid, 0, 16 );
|
||||||
field_4_tag = LittleEndian.getShort( data, pos + 18 );
|
field_4_tag = LittleEndian.getShort( data, pos + 18 );
|
||||||
field_5_size = LittleEndian.getInt( data, pos + 20 );
|
field_5_size = LittleEndian.getInt( data, pos + 20 );
|
||||||
field_6_ref = LittleEndian.getInt( data, pos + 24 );
|
field_6_ref = LittleEndian.getInt( data, pos + 24 );
|
||||||
|
@ -90,12 +91,12 @@ public final class EscherBSERecord extends EscherRecord {
|
||||||
public int serialize(int offset, byte[] data, EscherSerializationListener listener) {
|
public int serialize(int offset, byte[] data, EscherSerializationListener listener) {
|
||||||
listener.beforeRecordSerialize( offset, getRecordId(), this );
|
listener.beforeRecordSerialize( offset, getRecordId(), this );
|
||||||
|
|
||||||
if (_remainingData == null)
|
if (_remainingData == null) {
|
||||||
_remainingData = new byte[0];
|
_remainingData = new byte[0];
|
||||||
|
}
|
||||||
|
|
||||||
LittleEndian.putShort( data, offset, getOptions() );
|
LittleEndian.putShort( data, offset, getOptions() );
|
||||||
LittleEndian.putShort( data, offset + 2, getRecordId() );
|
LittleEndian.putShort( data, offset + 2, getRecordId() );
|
||||||
if (_remainingData == null) _remainingData = new byte[0];
|
|
||||||
int blipSize = field_12_blipRecord == null ? 0 : field_12_blipRecord.getRecordSize();
|
int blipSize = field_12_blipRecord == null ? 0 : field_12_blipRecord.getRecordSize();
|
||||||
int remainingBytes = _remainingData.length + 36 + blipSize;
|
int remainingBytes = _remainingData.length + 36 + blipSize;
|
||||||
LittleEndian.putInt( data, offset + 4, remainingBytes );
|
LittleEndian.putInt( data, offset + 4, remainingBytes );
|
||||||
|
@ -117,8 +118,6 @@ public final class EscherBSERecord extends EscherRecord {
|
||||||
{
|
{
|
||||||
bytesWritten = field_12_blipRecord.serialize( offset + 44, data, new NullEscherSerializationListener() );
|
bytesWritten = field_12_blipRecord.serialize( offset + 44, data, new NullEscherSerializationListener() );
|
||||||
}
|
}
|
||||||
if (_remainingData == null)
|
|
||||||
_remainingData = new byte[0];
|
|
||||||
System.arraycopy( _remainingData, 0, data, offset + 44 + bytesWritten, _remainingData.length );
|
System.arraycopy( _remainingData, 0, data, offset + 44 + bytesWritten, _remainingData.length );
|
||||||
int pos = offset + 8 + 36 + _remainingData.length + bytesWritten;
|
int pos = offset + 8 + 36 + _remainingData.length + bytesWritten;
|
||||||
|
|
||||||
|
@ -184,7 +183,9 @@ public final class EscherBSERecord extends EscherRecord {
|
||||||
* 16 byte MD4 checksum.
|
* 16 byte MD4 checksum.
|
||||||
*/
|
*/
|
||||||
public void setUid(byte[] uid) {
|
public void setUid(byte[] uid) {
|
||||||
field_3_uid = uid;
|
if (uid != null && uid.length == 16) {
|
||||||
|
System.arraycopy(uid, 0, field_3_uid, 0, field_3_uid.length);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -306,7 +307,11 @@ public final class EscherBSERecord extends EscherRecord {
|
||||||
* Any remaining data in this record.
|
* Any remaining data in this record.
|
||||||
*/
|
*/
|
||||||
public void setRemainingData(byte[] remainingData) {
|
public void setRemainingData(byte[] remainingData) {
|
||||||
_remainingData = remainingData;
|
if (remainingData == null) {
|
||||||
|
_remainingData = null;
|
||||||
|
} else {
|
||||||
|
_remainingData = remainingData.clone();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|
|
@ -74,9 +74,10 @@ public class EscherBitmapBlip extends EscherBlipRecord {
|
||||||
return field_1_UID;
|
return field_1_UID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUID( byte[] field_1_UID )
|
public void setUID( byte[] field_1_UID ) {
|
||||||
{
|
if (field_1_UID != null && field_1_UID.length == 16) {
|
||||||
this.field_1_UID = field_1_UID;
|
System.arraycopy(field_1_UID, 0, this.field_1_UID , 0, 16);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte getMarker()
|
public byte getMarker()
|
||||||
|
|
|
@ -70,7 +70,11 @@ public class EscherBlipRecord extends EscherRecord { // TODO - instantiable supe
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPictureData(byte[] pictureData) {
|
public void setPictureData(byte[] pictureData) {
|
||||||
field_pictureData = pictureData;
|
if (pictureData == null) {
|
||||||
|
field_pictureData = null;
|
||||||
|
} else {
|
||||||
|
field_pictureData = pictureData.clone();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|
|
@ -333,8 +333,11 @@ public class EscherClientAnchorRecord
|
||||||
/**
|
/**
|
||||||
* Any remaining data in the record
|
* Any remaining data in the record
|
||||||
*/
|
*/
|
||||||
public void setRemainingData( byte[] remainingData )
|
public void setRemainingData( byte[] remainingData ) {
|
||||||
{
|
if (remainingData == null) {
|
||||||
this.remainingData = remainingData;
|
this.remainingData = null;
|
||||||
|
} else {
|
||||||
|
this.remainingData = remainingData.clone();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,14 +85,17 @@ public class DocumentInputStream extends InputStream implements LittleEndianInpu
|
||||||
delegate = new NDocumentInputStream(document);
|
delegate = new NDocumentInputStream(document);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int available() {
|
public int available() {
|
||||||
return delegate.available();
|
return delegate.available();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
delegate.close();
|
delegate.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void mark(int ignoredReadlimit) {
|
public void mark(int ignoredReadlimit) {
|
||||||
delegate.mark(ignoredReadlimit);
|
delegate.mark(ignoredReadlimit);
|
||||||
}
|
}
|
||||||
|
@ -102,18 +105,22 @@ public class DocumentInputStream extends InputStream implements LittleEndianInpu
|
||||||
*
|
*
|
||||||
* @return <code>true</code> always
|
* @return <code>true</code> always
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean markSupported() {
|
public boolean markSupported() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int read() throws IOException {
|
public int read() throws IOException {
|
||||||
return delegate.read();
|
return delegate.read();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int read(byte[] b) throws IOException {
|
public int read(byte[] b) throws IOException {
|
||||||
return read(b, 0, b.length);
|
return read(b, 0, b.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int read(byte[] b, int off, int len) throws IOException {
|
public int read(byte[] b, int off, int len) throws IOException {
|
||||||
return delegate.read(b, off, len);
|
return delegate.read(b, off, len);
|
||||||
}
|
}
|
||||||
|
@ -123,46 +130,57 @@ public class DocumentInputStream extends InputStream implements LittleEndianInpu
|
||||||
* last called on this input stream. If mark() has not been called this
|
* last called on this input stream. If mark() has not been called this
|
||||||
* method repositions the stream to its beginning.
|
* method repositions the stream to its beginning.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void reset() {
|
public void reset() {
|
||||||
delegate.reset();
|
delegate.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public long skip(long n) throws IOException {
|
public long skip(long n) throws IOException {
|
||||||
return delegate.skip(n);
|
return delegate.skip(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public byte readByte() {
|
public byte readByte() {
|
||||||
return delegate.readByte();
|
return delegate.readByte();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public double readDouble() {
|
public double readDouble() {
|
||||||
return delegate.readDouble();
|
return delegate.readDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public short readShort() {
|
public short readShort() {
|
||||||
return (short) readUShort();
|
return (short) readUShort();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readFully(byte[] buf) {
|
@Override
|
||||||
readFully(buf, 0, buf.length);
|
public void readFully(byte[] buf) {
|
||||||
}
|
readFully(buf, 0, buf.length);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void readFully(byte[] buf, int off, int len) {
|
public void readFully(byte[] buf, int off, int len) {
|
||||||
delegate.readFully(buf, off, len);
|
delegate.readFully(buf, off, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public long readLong() {
|
public long readLong() {
|
||||||
return delegate.readLong();
|
return delegate.readLong();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int readInt() {
|
public int readInt() {
|
||||||
return delegate.readInt();
|
return delegate.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int readUShort() {
|
public int readUShort() {
|
||||||
return delegate.readUShort();
|
return delegate.readUShort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int readUByte() {
|
public int readUByte() {
|
||||||
return delegate.readUByte();
|
return delegate.readUByte();
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,8 @@ public class ZipContentTypeManager extends ContentTypeManager {
|
||||||
super(in, pkg);
|
super(in, pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@SuppressWarnings("resource")
|
||||||
|
@Override
|
||||||
public boolean saveImpl(Document content, OutputStream out) {
|
public boolean saveImpl(Document content, OutputStream out) {
|
||||||
ZipOutputStream zos = null;
|
ZipOutputStream zos = null;
|
||||||
if (out instanceof ZipOutputStream)
|
if (out instanceof ZipOutputStream)
|
||||||
|
|
|
@ -1,69 +0,0 @@
|
||||||
/* ====================================================================
|
|
||||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
contributor license agreements. See the NOTICE file distributed with
|
|
||||||
this work for additional information regarding copyright ownership.
|
|
||||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
(the "License"); you may not use this file except in compliance with
|
|
||||||
the License. You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
==================================================================== */
|
|
||||||
|
|
||||||
package org.apache.poi.openxml4j.opc.internal.signature;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
|
|
||||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
||||||
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
|
|
||||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
|
||||||
import org.apache.poi.openxml4j.opc.internal.ContentType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Digital certificate part.
|
|
||||||
*
|
|
||||||
* @author Julien Chable
|
|
||||||
* @version 0.1
|
|
||||||
*/
|
|
||||||
public final class DigitalCertificatePart extends PackagePart {
|
|
||||||
|
|
||||||
public DigitalCertificatePart() throws InvalidFormatException{
|
|
||||||
super(null, null, new ContentType(""));
|
|
||||||
// TODO: Review constructor
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void close() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void flush() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected InputStream getInputStreamImpl() throws IOException {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected OutputStream getOutputStreamImpl() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean load(InputStream ios) throws InvalidFormatException {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean save(OutputStream zos) throws OpenXML4JException {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
/* ====================================================================
|
|
||||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
contributor license agreements. See the NOTICE file distributed with
|
|
||||||
this work for additional information regarding copyright ownership.
|
|
||||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
(the "License"); you may not use this file except in compliance with
|
|
||||||
the License. You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
==================================================================== */
|
|
||||||
|
|
||||||
package org.apache.poi.openxml4j.opc.internal.signature;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a digital signature origin part.
|
|
||||||
*
|
|
||||||
* @author Julien Chable
|
|
||||||
* @version 0.1
|
|
||||||
*/
|
|
||||||
public final class DigitalSignatureOriginPart {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,63 +0,0 @@
|
||||||
/* ====================================================================
|
|
||||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
contributor license agreements. See the NOTICE file distributed with
|
|
||||||
this work for additional information regarding copyright ownership.
|
|
||||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
(the "License"); you may not use this file except in compliance with
|
|
||||||
the License. You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
==================================================================== */
|
|
||||||
|
|
||||||
package org.apache.poi.openxml4j.opc.signature;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
|
|
||||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
||||||
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
|
|
||||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
|
||||||
import org.apache.poi.openxml4j.opc.internal.ContentType;
|
|
||||||
|
|
||||||
public final class PackageDigitalSignature extends PackagePart {
|
|
||||||
|
|
||||||
public PackageDigitalSignature() throws InvalidFormatException {
|
|
||||||
super(null, null, new ContentType(""));
|
|
||||||
// TODO: Review constructor
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void close() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void flush() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected InputStream getInputStreamImpl() throws IOException {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected OutputStream getOutputStreamImpl() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean load(InputStream ios) throws InvalidFormatException {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean save(OutputStream zos) throws OpenXML4JException {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
/* ====================================================================
|
|
||||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
contributor license agreements. See the NOTICE file distributed with
|
|
||||||
this work for additional information regarding copyright ownership.
|
|
||||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
(the "License"); you may not use this file except in compliance with
|
|
||||||
the License. You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
==================================================================== */
|
|
||||||
|
|
||||||
package org.apache.poi.openxml4j.opc.signature;
|
|
||||||
|
|
||||||
public final class PackageDigitalSignatureManager {
|
|
||||||
|
|
||||||
}
|
|
|
@ -124,6 +124,7 @@ public final class Comment2000 extends RecordContainer {
|
||||||
case 0: authorRecord = cs; break;
|
case 0: authorRecord = cs; break;
|
||||||
case 1: commentRecord = cs; break;
|
case 1: commentRecord = cs; break;
|
||||||
case 2: authorInitialsRecord = cs; break;
|
case 2: authorInitialsRecord = cs; break;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
} else if (r instanceof Comment2000Atom){
|
} else if (r instanceof Comment2000Atom){
|
||||||
commentAtom = (Comment2000Atom)r;
|
commentAtom = (Comment2000Atom)r;
|
||||||
|
|
|
@ -133,10 +133,17 @@ public class CurrentUserAtom
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grab the contents
|
// Grab the contents
|
||||||
_contents = new byte[docProps.getSize()];
|
int len = docProps.getSize();
|
||||||
|
_contents = new byte[len];
|
||||||
InputStream in = dir.createDocumentInputStream("Current User");
|
InputStream in = dir.createDocumentInputStream("Current User");
|
||||||
in.read(_contents);
|
int readLen = in.read(_contents);
|
||||||
|
in.close();
|
||||||
|
|
||||||
|
if (len != readLen) {
|
||||||
|
throw new IOException("Current User input stream ended prematurely - expected "+len+" bytes - received "+readLen+" bytes");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// See how long it is. If it's under 28 bytes long, we can't
|
// See how long it is. If it's under 28 bytes long, we can't
|
||||||
// read it
|
// read it
|
||||||
if(_contents.length < 28) {
|
if(_contents.length < 28) {
|
||||||
|
|
|
@ -113,6 +113,7 @@ public class ExEmbed extends RecordContainer {
|
||||||
case 0x1: menuName = cs; break;
|
case 0x1: menuName = cs; break;
|
||||||
case 0x2: progId = cs; break;
|
case 0x2: progId = cs; break;
|
||||||
case 0x3: clipboardName = cs; break;
|
case 0x3: clipboardName = cs; break;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,6 @@ import java.util.ArrayList;
|
||||||
public abstract class RecordContainer extends Record
|
public abstract class RecordContainer extends Record
|
||||||
{
|
{
|
||||||
protected Record[] _children;
|
protected Record[] _children;
|
||||||
private Boolean changingChildRecordsLock = Boolean.TRUE;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return any children
|
* Return any children
|
||||||
|
@ -58,14 +57,12 @@ public abstract class RecordContainer extends Record
|
||||||
* Finds the location of the given child record
|
* Finds the location of the given child record
|
||||||
*/
|
*/
|
||||||
private int findChildLocation(Record child) {
|
private int findChildLocation(Record child) {
|
||||||
// Synchronized as we don't want things changing
|
int i=0;
|
||||||
// as we're doing our search
|
for(Record r : _children) {
|
||||||
synchronized(changingChildRecordsLock) {
|
if (r.equals(child)) {
|
||||||
for(int i=0; i<_children.length; i++) {
|
return i;
|
||||||
if(_children[i].equals(child)) {
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -75,14 +72,12 @@ public abstract class RecordContainer extends Record
|
||||||
* @param newChild The child record to add
|
* @param newChild The child record to add
|
||||||
*/
|
*/
|
||||||
private void appendChild(Record newChild) {
|
private void appendChild(Record newChild) {
|
||||||
synchronized(changingChildRecordsLock) {
|
// Copy over, and pop the child in at the end
|
||||||
// Copy over, and pop the child in at the end
|
Record[] nc = new Record[(_children.length + 1)];
|
||||||
Record[] nc = new Record[(_children.length + 1)];
|
System.arraycopy(_children, 0, nc, 0, _children.length);
|
||||||
System.arraycopy(_children, 0, nc, 0, _children.length);
|
// Switch the arrays
|
||||||
// Switch the arrays
|
nc[_children.length] = newChild;
|
||||||
nc[_children.length] = newChild;
|
_children = nc;
|
||||||
_children = nc;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -92,18 +87,15 @@ public abstract class RecordContainer extends Record
|
||||||
* @param position
|
* @param position
|
||||||
*/
|
*/
|
||||||
private void addChildAt(Record newChild, int position) {
|
private void addChildAt(Record newChild, int position) {
|
||||||
synchronized(changingChildRecordsLock) {
|
// Firstly, have the child added in at the end
|
||||||
// Firstly, have the child added in at the end
|
appendChild(newChild);
|
||||||
appendChild(newChild);
|
|
||||||
|
|
||||||
// Now, have them moved to the right place
|
// Now, have them moved to the right place
|
||||||
moveChildRecords( (_children.length-1), position, 1 );
|
moveChildRecords( (_children.length-1), position, 1 );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Moves <i>number</i> child records from <i>oldLoc</i>
|
* Moves {@code number} child records from {@code oldLoc} to {@code newLoc}.
|
||||||
* to <i>newLoc</i>. Caller must have the changingChildRecordsLock
|
|
||||||
* @param oldLoc the current location of the records to move
|
* @param oldLoc the current location of the records to move
|
||||||
* @param newLoc the new location for the records
|
* @param newLoc the new location for the records
|
||||||
* @param number the number of records to move
|
* @param number the number of records to move
|
||||||
|
@ -162,9 +154,7 @@ public abstract class RecordContainer extends Record
|
||||||
* Add a new child record onto a record's list of children.
|
* Add a new child record onto a record's list of children.
|
||||||
*/
|
*/
|
||||||
public void appendChildRecord(Record newChild) {
|
public void appendChildRecord(Record newChild) {
|
||||||
synchronized(changingChildRecordsLock) {
|
appendChild(newChild);
|
||||||
appendChild(newChild);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -173,16 +163,14 @@ public abstract class RecordContainer extends Record
|
||||||
* @param after
|
* @param after
|
||||||
*/
|
*/
|
||||||
public void addChildAfter(Record newChild, Record after) {
|
public void addChildAfter(Record newChild, Record after) {
|
||||||
synchronized(changingChildRecordsLock) {
|
// Decide where we're going to put it
|
||||||
// Decide where we're going to put it
|
int loc = findChildLocation(after);
|
||||||
int loc = findChildLocation(after);
|
if(loc == -1) {
|
||||||
if(loc == -1) {
|
throw new IllegalArgumentException("Asked to add a new child after another record, but that record wasn't one of our children!");
|
||||||
throw new IllegalArgumentException("Asked to add a new child after another record, but that record wasn't one of our children!");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add one place after the supplied record
|
|
||||||
addChildAt(newChild, loc+1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add one place after the supplied record
|
||||||
|
addChildAt(newChild, loc+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -191,16 +179,14 @@ public abstract class RecordContainer extends Record
|
||||||
* @param before
|
* @param before
|
||||||
*/
|
*/
|
||||||
public void addChildBefore(Record newChild, Record before) {
|
public void addChildBefore(Record newChild, Record before) {
|
||||||
synchronized(changingChildRecordsLock) {
|
// Decide where we're going to put it
|
||||||
// Decide where we're going to put it
|
int loc = findChildLocation(before);
|
||||||
int loc = findChildLocation(before);
|
if(loc == -1) {
|
||||||
if(loc == -1) {
|
throw new IllegalArgumentException("Asked to add a new child before another record, but that record wasn't one of our children!");
|
||||||
throw new IllegalArgumentException("Asked to add a new child before another record, but that record wasn't one of our children!");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add at the place of the supplied record
|
|
||||||
addChildAt(newChild, loc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add at the place of the supplied record
|
||||||
|
addChildAt(newChild, loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -216,22 +202,20 @@ public abstract class RecordContainer extends Record
|
||||||
public void moveChildrenBefore(Record firstChild, int number, Record before) {
|
public void moveChildrenBefore(Record firstChild, int number, Record before) {
|
||||||
if(number < 1) { return; }
|
if(number < 1) { return; }
|
||||||
|
|
||||||
synchronized(changingChildRecordsLock) {
|
// Decide where we're going to put them
|
||||||
// Decide where we're going to put them
|
int newLoc = findChildLocation(before);
|
||||||
int newLoc = findChildLocation(before);
|
if(newLoc == -1) {
|
||||||
if(newLoc == -1) {
|
throw new IllegalArgumentException("Asked to move children before another record, but that record wasn't one of our children!");
|
||||||
throw new IllegalArgumentException("Asked to move children before another record, but that record wasn't one of our children!");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Figure out where they are now
|
|
||||||
int oldLoc = findChildLocation(firstChild);
|
|
||||||
if(oldLoc == -1) {
|
|
||||||
throw new IllegalArgumentException("Asked to move a record that wasn't a child!");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Actually move
|
|
||||||
moveChildRecords(oldLoc, newLoc, number);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Figure out where they are now
|
||||||
|
int oldLoc = findChildLocation(firstChild);
|
||||||
|
if(oldLoc == -1) {
|
||||||
|
throw new IllegalArgumentException("Asked to move a record that wasn't a child!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Actually move
|
||||||
|
moveChildRecords(oldLoc, newLoc, number);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -239,25 +223,22 @@ public abstract class RecordContainer extends Record
|
||||||
*/
|
*/
|
||||||
public void moveChildrenAfter(Record firstChild, int number, Record after) {
|
public void moveChildrenAfter(Record firstChild, int number, Record after) {
|
||||||
if(number < 1) { return; }
|
if(number < 1) { return; }
|
||||||
|
// Decide where we're going to put them
|
||||||
synchronized(changingChildRecordsLock) {
|
int newLoc = findChildLocation(after);
|
||||||
// Decide where we're going to put them
|
if(newLoc == -1) {
|
||||||
int newLoc = findChildLocation(after);
|
throw new IllegalArgumentException("Asked to move children before another record, but that record wasn't one of our children!");
|
||||||
if(newLoc == -1) {
|
|
||||||
throw new IllegalArgumentException("Asked to move children before another record, but that record wasn't one of our children!");
|
|
||||||
}
|
|
||||||
// We actually want after this though
|
|
||||||
newLoc++;
|
|
||||||
|
|
||||||
// Figure out where they are now
|
|
||||||
int oldLoc = findChildLocation(firstChild);
|
|
||||||
if(oldLoc == -1) {
|
|
||||||
throw new IllegalArgumentException("Asked to move a record that wasn't a child!");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Actually move
|
|
||||||
moveChildRecords(oldLoc, newLoc, number);
|
|
||||||
}
|
}
|
||||||
|
// We actually want after this though
|
||||||
|
newLoc++;
|
||||||
|
|
||||||
|
// Figure out where they are now
|
||||||
|
int oldLoc = findChildLocation(firstChild);
|
||||||
|
if(oldLoc == -1) {
|
||||||
|
throw new IllegalArgumentException("Asked to move a record that wasn't a child!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Actually move
|
||||||
|
moveChildRecords(oldLoc, newLoc, number);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -149,6 +149,8 @@ public final class TextRulerAtom extends RecordAtom {
|
||||||
val = LittleEndian.getShort(_data, pos); pos += 2;
|
val = LittleEndian.getShort(_data, pos); pos += 2;
|
||||||
textOffsets[bits[i]-8] = val;
|
textOffsets[bits[i]-8] = val;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,6 +133,9 @@ public final class HSLFFreeformShape extends HSLFAutoShape implements FreeformSh
|
||||||
isClosed = true;
|
isClosed = true;
|
||||||
numPoints++;
|
numPoints++;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
logger.log(POILogger.WARN, "Ignoring invalid segment type "+type);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
it.next();
|
it.next();
|
||||||
|
|
|
@ -319,7 +319,7 @@ public abstract class HSLFSheet implements HSLFShapeContainer, Sheet<HSLFShape,H
|
||||||
for (HSLFShape shape : getShapes()) {
|
for (HSLFShape shape : getShapes()) {
|
||||||
if(shape instanceof HSLFTextShape){
|
if(shape instanceof HSLFTextShape){
|
||||||
HSLFTextShape tx = (HSLFTextShape)shape;
|
HSLFTextShape tx = (HSLFTextShape)shape;
|
||||||
if (tx != null && tx.getRunType() == type) {
|
if (tx.getRunType() == type) {
|
||||||
return tx;
|
return tx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,7 @@ public abstract class HSLFSimpleShape extends HSLFShape implements SimpleShape<H
|
||||||
} else {
|
} else {
|
||||||
int rgb = new Color(color.getBlue(), color.getGreen(), color.getRed(), 0).getRGB();
|
int rgb = new Color(color.getBlue(), color.getGreen(), color.getRed(), 0).getRGB();
|
||||||
setEscherProperty(opt, EscherProperties.LINESTYLE__COLOR, rgb);
|
setEscherProperty(opt, EscherProperties.LINESTYLE__COLOR, rgb);
|
||||||
setEscherProperty(opt, EscherProperties.LINESTYLE__NOLINEDRAWDASH, color == null ? 0x180010 : 0x180018);
|
setEscherProperty(opt, EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x180018);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,6 +332,9 @@ public abstract class HSLFSimpleShape extends HSLFShape implements SimpleShape<H
|
||||||
infoAtom.setJump(InteractiveInfoAtom.JUMP_NONE);
|
infoAtom.setJump(InteractiveInfoAtom.JUMP_NONE);
|
||||||
infoAtom.setHyperlinkType(InteractiveInfoAtom.LINK_SlideNumber);
|
infoAtom.setHyperlinkType(InteractiveInfoAtom.LINK_SlideNumber);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
logger.log(POILogger.WARN, "Ignore unknown hyperlink type : "+link.getTitle());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
infoAtom.setHyperlinkID(link.getId());
|
infoAtom.setHyperlinkID(link.getId());
|
||||||
|
|
|
@ -180,6 +180,8 @@ public final class HSLFSlide extends HSLFSheet implements Slide<HSLFShape,HSLFTe
|
||||||
case EscherContainerRecord.SP_CONTAINER:
|
case EscherContainerRecord.SP_CONTAINER:
|
||||||
spr = c.getChildById(EscherSpRecord.RECORD_ID);
|
spr = c.getChildById(EscherSpRecord.RECORD_ID);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if(spr != null) spr.setShapeId(allocateShapeId());
|
if(spr != null) spr.setShapeId(allocateShapeId());
|
||||||
}
|
}
|
||||||
|
|
|
@ -659,7 +659,7 @@ public final class HSLFSlideShow implements SlideShow<HSLFShape,HSLFTextParagrap
|
||||||
|
|
||||||
// if the removed slide had notes - remove references to them too
|
// if the removed slide had notes - remove references to them too
|
||||||
|
|
||||||
int notesId = (removedSlide != null) ? removedSlide.getSlideRecord().getSlideAtom().getNotesID() : 0;
|
int notesId = removedSlide.getSlideRecord().getSlideAtom().getNotesID();
|
||||||
if (notesId != 0) {
|
if (notesId != 0) {
|
||||||
SlideListWithText nslwt = _documentRecord.getNotesSlideListWithText();
|
SlideListWithText nslwt = _documentRecord.getNotesSlideListWithText();
|
||||||
records = new ArrayList<Record>();
|
records = new ArrayList<Record>();
|
||||||
|
|
|
@ -38,7 +38,6 @@ import org.apache.poi.hslf.record.UserEditAtom;
|
||||||
import org.apache.poi.hssf.record.crypto.Biff8EncryptionKey;
|
import org.apache.poi.hssf.record.crypto.Biff8EncryptionKey;
|
||||||
import org.apache.poi.poifs.crypt.Decryptor;
|
import org.apache.poi.poifs.crypt.Decryptor;
|
||||||
import org.apache.poi.poifs.crypt.EncryptionInfo;
|
import org.apache.poi.poifs.crypt.EncryptionInfo;
|
||||||
import org.apache.poi.poifs.crypt.Encryptor;
|
|
||||||
import org.apache.poi.poifs.crypt.cryptoapi.CryptoAPIDecryptor;
|
import org.apache.poi.poifs.crypt.cryptoapi.CryptoAPIDecryptor;
|
||||||
import org.apache.poi.poifs.crypt.cryptoapi.CryptoAPIEncryptor;
|
import org.apache.poi.poifs.crypt.cryptoapi.CryptoAPIEncryptor;
|
||||||
import org.apache.poi.util.BitField;
|
import org.apache.poi.util.BitField;
|
||||||
|
@ -95,8 +94,8 @@ public class HSLFSlideShowEncrypted {
|
||||||
}
|
}
|
||||||
assert(r instanceof DocumentEncryptionAtom);
|
assert(r instanceof DocumentEncryptionAtom);
|
||||||
this.dea = (DocumentEncryptionAtom)r;
|
this.dea = (DocumentEncryptionAtom)r;
|
||||||
|
decryptInit();
|
||||||
|
|
||||||
CryptoAPIDecryptor dec = (CryptoAPIDecryptor)dea.getEncryptionInfo().getDecryptor();
|
|
||||||
String pass = Biff8EncryptionKey.getCurrentUserPassword();
|
String pass = Biff8EncryptionKey.getCurrentUserPassword();
|
||||||
if(!dec.verifyPassword(pass != null ? pass : Decryptor.DEFAULT_PASSWORD)) {
|
if(!dec.verifyPassword(pass != null ? pass : Decryptor.DEFAULT_PASSWORD)) {
|
||||||
throw new EncryptedPowerPointFileException("PowerPoint file is encrypted. The correct password needs to be set via Biff8EncryptionKey.setCurrentUserPassword()");
|
throw new EncryptedPowerPointFileException("PowerPoint file is encrypted. The correct password needs to be set via Biff8EncryptionKey.setCurrentUserPassword()");
|
||||||
|
@ -342,10 +341,11 @@ public class HSLFSlideShowEncrypted {
|
||||||
// create password record
|
// create password record
|
||||||
if (dea == null) {
|
if (dea == null) {
|
||||||
dea = new DocumentEncryptionAtom();
|
dea = new DocumentEncryptionAtom();
|
||||||
|
enc = null;
|
||||||
}
|
}
|
||||||
|
encryptInit();
|
||||||
EncryptionInfo ei = dea.getEncryptionInfo();
|
EncryptionInfo ei = dea.getEncryptionInfo();
|
||||||
byte salt[] = ei.getVerifier().getSalt();
|
byte salt[] = ei.getVerifier().getSalt();
|
||||||
Encryptor enc = ei.getEncryptor();
|
|
||||||
if (salt == null) {
|
if (salt == null) {
|
||||||
enc.confirmPassword(password);
|
enc.confirmPassword(password);
|
||||||
} else {
|
} else {
|
||||||
|
@ -396,11 +396,12 @@ public class HSLFSlideShowEncrypted {
|
||||||
|
|
||||||
recordMap.put(pdr.getLastOnDiskOffset(), r);
|
recordMap.put(pdr.getLastOnDiskOffset(), r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(uea != null && pph != null && uea.getPersistPointersOffset() == pph.getLastOnDiskOffset());
|
||||||
|
|
||||||
recordMap.put(pph.getLastOnDiskOffset(), pph);
|
recordMap.put(pph.getLastOnDiskOffset(), pph);
|
||||||
recordMap.put(uea.getLastOnDiskOffset(), uea);
|
recordMap.put(uea.getLastOnDiskOffset(), uea);
|
||||||
|
|
||||||
assert(uea != null && pph != null && uea.getPersistPointersOffset() == pph.getLastOnDiskOffset());
|
|
||||||
|
|
||||||
if (duplicatedCount == 0 && obsoleteOffsets.isEmpty()) {
|
if (duplicatedCount == 0 && obsoleteOffsets.isEmpty()) {
|
||||||
return records;
|
return records;
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,8 +221,15 @@ public final class HSLFSlideShowImpl extends POIDocument {
|
||||||
(DocumentEntry)directory.getEntry("PowerPoint Document");
|
(DocumentEntry)directory.getEntry("PowerPoint Document");
|
||||||
|
|
||||||
// Grab the document stream
|
// Grab the document stream
|
||||||
_docstream = new byte[docProps.getSize()];
|
int len = docProps.getSize();
|
||||||
directory.createDocumentInputStream("PowerPoint Document").read(_docstream);
|
_docstream = new byte[len];
|
||||||
|
InputStream is = directory.createDocumentInputStream("PowerPoint Document");
|
||||||
|
int readLen = is.read(_docstream);
|
||||||
|
is.close();
|
||||||
|
|
||||||
|
if (len != readLen) {
|
||||||
|
throw new IOException("Document input stream ended prematurely - expected "+len+" bytes - received "+readLen+" bytes");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -374,11 +381,16 @@ public final class HSLFSlideShowImpl extends POIDocument {
|
||||||
HSLFSlideShowEncrypted decryptData = new HSLFSlideShowEncrypted(getDocumentEncryptionAtom());
|
HSLFSlideShowEncrypted decryptData = new HSLFSlideShowEncrypted(getDocumentEncryptionAtom());
|
||||||
|
|
||||||
DocumentEntry entry = (DocumentEntry)directory.getEntry("Pictures");
|
DocumentEntry entry = (DocumentEntry)directory.getEntry("Pictures");
|
||||||
byte[] pictstream = new byte[entry.getSize()];
|
int len = entry.getSize();
|
||||||
|
byte[] pictstream = new byte[len];
|
||||||
DocumentInputStream is = directory.createDocumentInputStream(entry);
|
DocumentInputStream is = directory.createDocumentInputStream(entry);
|
||||||
is.read(pictstream);
|
int readLen = is.read(pictstream);
|
||||||
is.close();
|
is.close();
|
||||||
|
|
||||||
|
if (len != readLen) {
|
||||||
|
throw new IOException("Picture stream ended prematurely - expected "+len+" bytes - received "+readLen+" bytes");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
// An empty picture record (length 0) will take up 8 bytes
|
// An empty picture record (length 0) will take up 8 bytes
|
||||||
|
@ -507,7 +519,9 @@ public final class HSLFSlideShowImpl extends POIDocument {
|
||||||
}
|
}
|
||||||
cos.close();
|
cos.close();
|
||||||
|
|
||||||
assert(usr != null && ptr != null);
|
if (usr == null || ptr == null) {
|
||||||
|
throw new HSLFException("UserEditAtom or PersistPtr can't be determined.");
|
||||||
|
}
|
||||||
|
|
||||||
Map<Integer,Integer> persistIds = new HashMap<Integer,Integer>();
|
Map<Integer,Integer> persistIds = new HashMap<Integer,Integer>();
|
||||||
for (Map.Entry<Integer,Integer> entry : ptr.getSlideLocationsLookup().entrySet()) {
|
for (Map.Entry<Integer,Integer> entry : ptr.getSlideLocationsLookup().entrySet()) {
|
||||||
|
@ -540,7 +554,7 @@ public final class HSLFSlideShowImpl extends POIDocument {
|
||||||
// Update and write out the Current User atom
|
// Update and write out the Current User atom
|
||||||
int oldLastUserEditAtomPos = (int)currentUser.getCurrentEditOffset();
|
int oldLastUserEditAtomPos = (int)currentUser.getCurrentEditOffset();
|
||||||
Integer newLastUserEditAtomPos = oldToNewPositions.get(oldLastUserEditAtomPos);
|
Integer newLastUserEditAtomPos = oldToNewPositions.get(oldLastUserEditAtomPos);
|
||||||
if(usr == null || newLastUserEditAtomPos == null || usr.getLastOnDiskOffset() != newLastUserEditAtomPos) {
|
if(newLastUserEditAtomPos == null || usr.getLastOnDiskOffset() != newLastUserEditAtomPos) {
|
||||||
throw new HSLFException("Couldn't find the new location of the last UserEditAtom that used to be at " + oldLastUserEditAtomPos);
|
throw new HSLFException("Couldn't find the new location of the last UserEditAtom that used to be at " + oldLastUserEditAtomPos);
|
||||||
}
|
}
|
||||||
currentUser.setCurrentEditOffset(usr.getLastOnDiskOffset());
|
currentUser.setCurrentEditOffset(usr.getLastOnDiskOffset());
|
||||||
|
|
|
@ -21,18 +21,49 @@ import static org.apache.poi.hslf.record.RecordTypes.OutlineTextRefAtom;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.poi.hslf.model.PPFont;
|
import org.apache.poi.hslf.model.PPFont;
|
||||||
import org.apache.poi.hslf.model.textproperties.*;
|
import org.apache.poi.hslf.model.textproperties.BitMaskTextProp;
|
||||||
|
import org.apache.poi.hslf.model.textproperties.FontAlignmentProp;
|
||||||
|
import org.apache.poi.hslf.model.textproperties.IndentProp;
|
||||||
|
import org.apache.poi.hslf.model.textproperties.ParagraphFlagsTextProp;
|
||||||
|
import org.apache.poi.hslf.model.textproperties.TextAlignmentProp;
|
||||||
|
import org.apache.poi.hslf.model.textproperties.TextPFException9;
|
||||||
|
import org.apache.poi.hslf.model.textproperties.TextProp;
|
||||||
|
import org.apache.poi.hslf.model.textproperties.TextPropCollection;
|
||||||
import org.apache.poi.hslf.model.textproperties.TextPropCollection.TextPropType;
|
import org.apache.poi.hslf.model.textproperties.TextPropCollection.TextPropType;
|
||||||
import org.apache.poi.hslf.record.*;
|
import org.apache.poi.hslf.record.ColorSchemeAtom;
|
||||||
|
import org.apache.poi.hslf.record.EscherTextboxWrapper;
|
||||||
|
import org.apache.poi.hslf.record.FontCollection;
|
||||||
|
import org.apache.poi.hslf.record.MasterTextPropAtom;
|
||||||
|
import org.apache.poi.hslf.record.OutlineTextRefAtom;
|
||||||
|
import org.apache.poi.hslf.record.PPDrawing;
|
||||||
|
import org.apache.poi.hslf.record.Record;
|
||||||
|
import org.apache.poi.hslf.record.RecordContainer;
|
||||||
|
import org.apache.poi.hslf.record.RecordTypes;
|
||||||
|
import org.apache.poi.hslf.record.SlideListWithText;
|
||||||
|
import org.apache.poi.hslf.record.SlidePersistAtom;
|
||||||
|
import org.apache.poi.hslf.record.StyleTextProp9Atom;
|
||||||
|
import org.apache.poi.hslf.record.StyleTextPropAtom;
|
||||||
|
import org.apache.poi.hslf.record.TextBytesAtom;
|
||||||
|
import org.apache.poi.hslf.record.TextCharsAtom;
|
||||||
|
import org.apache.poi.hslf.record.TextHeaderAtom;
|
||||||
|
import org.apache.poi.hslf.record.TextRulerAtom;
|
||||||
|
import org.apache.poi.hslf.record.TextSpecInfoAtom;
|
||||||
import org.apache.poi.sl.draw.DrawPaint;
|
import org.apache.poi.sl.draw.DrawPaint;
|
||||||
import org.apache.poi.sl.usermodel.AutoNumberingScheme;
|
import org.apache.poi.sl.usermodel.AutoNumberingScheme;
|
||||||
import org.apache.poi.sl.usermodel.PaintStyle;
|
import org.apache.poi.sl.usermodel.PaintStyle;
|
||||||
import org.apache.poi.sl.usermodel.PaintStyle.SolidPaint;
|
import org.apache.poi.sl.usermodel.PaintStyle.SolidPaint;
|
||||||
import org.apache.poi.sl.usermodel.TextParagraph;
|
import org.apache.poi.sl.usermodel.TextParagraph;
|
||||||
import org.apache.poi.util.*;
|
import org.apache.poi.util.LocaleUtil;
|
||||||
|
import org.apache.poi.util.POILogFactory;
|
||||||
|
import org.apache.poi.util.POILogger;
|
||||||
|
import org.apache.poi.util.StringUtil;
|
||||||
|
import org.apache.poi.util.Units;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class represents a run of text in a powerpoint document. That
|
* This class represents a run of text in a powerpoint document. That
|
||||||
|
@ -906,12 +937,16 @@ public final class HSLFTextParagraph implements TextParagraph<HSLFShape,HSLFText
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator<HSLFTextRun> runIter = htp.getTextRuns().iterator();
|
Iterator<HSLFTextRun> runIter = htp.getTextRuns().iterator();
|
||||||
HSLFTextRun htr = runIter.next();
|
if (runIter.hasNext()) {
|
||||||
htr.setText("");
|
HSLFTextRun htr = runIter.next();
|
||||||
assert (htr != null);
|
htr.setText("");
|
||||||
while (runIter.hasNext()) {
|
while (runIter.hasNext()) {
|
||||||
runIter.next();
|
runIter.next();
|
||||||
runIter.remove();
|
runIter.remove();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
HSLFTextRun trun = new HSLFTextRun(htp);
|
||||||
|
htp.addTextRun(trun);
|
||||||
}
|
}
|
||||||
|
|
||||||
return appendText(paragraphs, text, false);
|
return appendText(paragraphs, text, false);
|
||||||
|
|
Loading…
Reference in New Issue