org.ttzero.excel.reader.BIFF8Drawings Maven / Gradle / Ivy
/*
* Copyright (c) 2017-2021, [email protected] All Rights Reserved.
*
* Licensed 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.ttzero.excel.reader;
import org.ttzero.excel.entity.e3.Block;
import org.ttzero.excel.entity.e3.odraw.ArtDggContainerParser;
import org.ttzero.excel.entity.e3.odraw.ArtSpContainerParser;
import org.ttzero.excel.util.FileUtil;
import org.ttzero.excel.util.StringUtil;
import java.io.Closeable;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
/**
* @author guanquan.wang at 2021-07-06 13:54
*/
public class BIFF8Drawings implements Drawings, Closeable {
/**
* Lazy to parse the Worksheet and Dimension info
*/
public static class BIFF8Picture extends Picture {
private Consumer consumer;
@Override
public Sheet getSheet() {
if (sheet == null) {
consumer.accept(this);
}
return sheet;
}
@Override
public Dimension getDimension() {
if (dimension == null) {
consumer.accept(this);
}
return dimension;
}
@Override
public String toString() {
return background ? "Background picture [" + localPath + "]" + (sheet != null ? " in worksheet " + sheet.getName() : "") + (StringUtil.isNotEmpty(srcUrl) ? " from internet url " + srcUrl : "")
: "Picture [" + localPath + "]" + (sheet != null ? " in worksheet " + sheet.getName() + " at " + dimension : "") + (StringUtil.isNotEmpty(srcUrl) ? " from internet url " + srcUrl : "");
}
}
/**
* Source
*/
private List pictures;
/**
* Mark parse flag
*/
private boolean parsed;
/**
* Sector block
*/
private final Block block;
private Sheet[] sheets;
BIFF8Drawings(Block block, Sheet[] sheets) {
this.block = block;
this.sheets = sheets;
}
@Override
public List