コード例 #1
0
ファイル: ActiveXShape.cs プロジェクト: JnS-Software-LLC/npoi
    /**
     * Create a new Placeholder and Initialize internal structures
     *
     * @return the Created <code>EscherContainerRecord</code> which holds shape data
     */
    protected EscherContainerRecord CreateSpContainer(int idx, bool IsChild) {
        _escherContainer = super.CreateSpContainer(idx, isChild);

        EscherSpRecord spRecord = _escherContainer.GetChildById(EscherSpRecord.RECORD_ID);
        spRecord.SetFlags(EscherSpRecord.FLAG_HAVEANCHOR | EscherSpRecord.FLAG_HASSHAPETYPE | EscherSpRecord.FLAG_OLESHAPE);

        SetShapeType(ShapeTypes.HostControl);
        SetEscherProperty(EscherProperties.BLIP__PICTUREID, idx);
        SetEscherProperty(EscherProperties.LINESTYLE__COLOR, 0x8000001);
        SetEscherProperty(EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x80008);
        SetEscherProperty(EscherProperties.SHADOWSTYLE__COLOR, 0x8000002);
        SetEscherProperty(EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, -1);

        EscherClientDataRecord cldata = new EscherClientDataRecord();
        cldata.SetOptions((short)0xF);
        _escherContainer.AddChildRecord(cldata); // TODO unit Test to prove GetChildRecords().add is wrong

        OEShapeAtom oe = new OEShapeAtom();

        //convert hslf into ddf
        MemoryStream out = new MemoryStream();
        try {
            oe.WriteOut(out);
        } catch(Exception e){
            throw new HSLFException(e);
        }
        cldata.SetRemainingData(out.ToArray());

        return _escherContainer;
    }
コード例 #2
0
ファイル: MovieShape.cs プロジェクト: 89sos98/npoi
    /**
     * Create a new Placeholder and Initialize internal structures
     *
     * @return the Created <code>EscherContainerRecord</code> which holds shape data
     */
    protected EscherContainerRecord CreateSpContainer(int idx, bool IsChild) {
        _escherContainer = super.CreateSpContainer(idx, isChild);

        SetEscherProperty(EscherProperties.PROTECTION__LOCKAGAINSTGROUPING, 0x1000100);
        SetEscherProperty(EscherProperties.FILL__NOFILLHITTEST, 0x10001);

        EscherClientDataRecord cldata = new EscherClientDataRecord();
        cldata.SetOptions((short)0xF);
        _escherContainer.AddChildRecord(cldata);

        OEShapeAtom oe = new OEShapeAtom();
        InteractiveInfo info = new InteractiveInfo();
        InteractiveInfoAtom infoAtom = info.GetInteractiveInfoAtom();
        infoAtom.SetAction(InteractiveInfoAtom.ACTION_MEDIA);
        infoAtom.SetHyperlinkType(InteractiveInfoAtom.LINK_NULL);

        AnimationInfo an = new AnimationInfo();
        AnimationInfoAtom anAtom = an.GetAnimationInfoAtom();
        anAtom.SetFlag(AnimationInfoAtom.Automatic, true);

        //convert hslf into ddf
        MemoryStream out = new MemoryStream();
        try {
            oe.WriteOut(out);
            an.WriteOut(out);
            info.WriteOut(out);
        } catch(Exception e){
            throw new HSLFException(e);
        }
        cldata.SetRemainingData(out.ToArray());

        return _escherContainer;
    }