Search in sources :

Example 1 with ExControl

use of org.apache.poi.hslf.record.ExControl in project poi by apache.

the class ActiveXShape method getExControl.

/**
     * Document-level container that specifies information about an ActiveX control
     *
     * @return container that specifies information about an ActiveX control
     */
public ExControl getExControl() {
    int idx = getControlIndex();
    Document doc = getSheet().getSlideShow().getDocumentRecord();
    ExObjList lst = (ExObjList) doc.findFirstOfType(RecordTypes.ExObjList.typeID);
    if (lst == null) {
        return null;
    }
    for (Record ch : lst.getChildRecords()) {
        if (ch instanceof ExControl) {
            ExControl c = (ExControl) ch;
            if (c.getExOleObjAtom().getObjID() == idx) {
                return c;
            }
        }
    }
    return null;
}
Also used : ExObjList(org.apache.poi.hslf.record.ExObjList) ExControl(org.apache.poi.hslf.record.ExControl) HSLFEscherClientDataRecord(org.apache.poi.hslf.record.HSLFEscherClientDataRecord) Record(org.apache.poi.hslf.record.Record) EscherContainerRecord(org.apache.poi.ddf.EscherContainerRecord) AbstractEscherOptRecord(org.apache.poi.ddf.AbstractEscherOptRecord) EscherSpRecord(org.apache.poi.ddf.EscherSpRecord) Document(org.apache.poi.hslf.record.Document)

Example 2 with ExControl

use of org.apache.poi.hslf.record.ExControl in project poi by apache.

the class ActiveXShape method afterInsert.

@Override
protected void afterInsert(HSLFSheet sheet) {
    ExControl ctrl = getExControl();
    if (ctrl == null) {
        throw new NullPointerException("ExControl is not defined");
    }
    ctrl.getExControlAtom().setSlideId(sheet._getSheetNumber());
    String name = ctrl.getProgId() + "-" + getControlIndex() + '';
    byte[] data = StringUtil.getToUnicodeLE(name);
    EscherComplexProperty prop = new EscherComplexProperty(EscherProperties.GROUPSHAPE__SHAPENAME, false, data);
    AbstractEscherOptRecord opt = getEscherOptRecord();
    opt.addEscherProperty(prop);
}
Also used : ExControl(org.apache.poi.hslf.record.ExControl) EscherComplexProperty(org.apache.poi.ddf.EscherComplexProperty) AbstractEscherOptRecord(org.apache.poi.ddf.AbstractEscherOptRecord)

Aggregations

AbstractEscherOptRecord (org.apache.poi.ddf.AbstractEscherOptRecord)2 ExControl (org.apache.poi.hslf.record.ExControl)2 EscherComplexProperty (org.apache.poi.ddf.EscherComplexProperty)1 EscherContainerRecord (org.apache.poi.ddf.EscherContainerRecord)1 EscherSpRecord (org.apache.poi.ddf.EscherSpRecord)1 Document (org.apache.poi.hslf.record.Document)1 ExObjList (org.apache.poi.hslf.record.ExObjList)1 HSLFEscherClientDataRecord (org.apache.poi.hslf.record.HSLFEscherClientDataRecord)1 Record (org.apache.poi.hslf.record.Record)1