Esempio n. 1
0
 internal static void Flush(IPointContext ctx, int index)
 {
     while (ctx.Sets.Count > index)
     {
         ctx.Sets.Pop().Execute(ctx);
     }
 }
Esempio n. 2
0
        public static object ExecuteCmd(this IPointContext ctx, IPointCommand[] cmds, out Action after)
        {
            var    frame        = ctx.Frame;
            var    afterActions = new List <Action>();
            Action action2      = null;

            foreach (var cmd in cmds)
            {
                if (cmd == null)
                {
                }
                else if (cmd.When <= When.Normal)
                {
                    cmd.Execute(ctx, ref action2); if (action2 != null)
                    {
                        afterActions.Add(action2); action2 = null;
                    }
                }
                else
                {
                    afterActions.Add(() => { cmd.Execute(ctx, ref action2); if (action2 != null)
                                             {
                                                 afterActions.Add(action2); action2 = null;
                                             }
                                     });
                }
            }
            after = afterActions.Count > 0 ? () => { foreach (var action in afterActions)
                                                     {
                                                         action?.Invoke();
                                                     }
            } : (Action)null;
            return(frame);
        }
Esempio n. 3
0
        //public static CommandRtn ExecuteRow(this IExcelContext ctx, When when, Collection<string> s, out Action after)
        //{
        //    var cr = CommandRtn.Normal;
        //    var afterActions = new List<Action>();
        //    foreach (var cmd in ctx.CmdRows.Where(x => (x.When & when) == when))
        //    {
        //        if (cmd == null) continue;
        //        var r = cmd.Func(ctx, s);
        //        if (cmd.Cmds != null && cmd.Cmds.Length > 0 && (r & CommandRtn.SkipCmds) != CommandRtn.SkipCmds)
        //        {
        //            ctx.Frame = ctx.ExecuteCmd(cmd.Cmds, out var action);
        //            if (action != null) afterActions.Add(action);
        //        }
        //        cr |= r;
        //    }
        //    after = afterActions.Count > 0 ? () => { foreach (var action in afterActions) action.Invoke(); } : (Action)null;
        //    return cr;
        //}

        //public static CommandRtn ExecuteCol(this IExcelContext ctx, Collection<string> s, object v, out Action after)
        //{
        //    var cr = CommandRtn.Normal;
        //    var afterActions = new List<Action>();
        //    foreach (var cmd in ctx.CmdCols)
        //    {
        //        if (cmd == null) continue;
        //        var r = cmd.Func(ctx, s, v);
        //        if (cmd.Cmds != null && cmd.Cmds.Length > 0 && (r & CommandRtn.SkipCmds) != CommandRtn.SkipCmds)
        //        {
        //            ctx.Frame = ctx.ExecuteCmd(cmd.Cmds, out var action);
        //            if (action != null) afterActions.Add(action);
        //        }
        //        cr |= r;
        //    }
        //    after = afterActions.Count > 0 ? () => { foreach (var action in afterActions) action?.Invoke(); } : (Action)null;
        //    return cr;
        //}

        #endregion

        #region Presentation

        public static void PresentationOpen(this IPointContext ctx, string path)
        {
            var ctx2 = (PointContext)ctx;

            ctx2.Doc = PresentationDocument.Open(path, true);
            ctx2.P   = ctx2.Doc.PresentationPart;
        }
Esempio n. 4
0
        public static void Sample(this IPointContext ctx)
        {
            var p = ((PointContext)ctx).P;

            var slideMasterIdList1 = new SlideMasterIdList(new SlideMasterId {
                Id = 2147483648U, RelationshipId = "rId1"
            });
            var slideIdList1 = new SlideIdList(new SlideId {
                Id = 256U, RelationshipId = "rId2"
            });
            var slideSize1 = new SlideSize {
                Cx = 9144000, Cy = 6858000, Type = SlideSizeValues.Screen4x3
            };
            var notesSize1 = new NotesSize {
                Cx = 6858000, Cy = 9144000
            };
            var defaultTextStyle1 = new DefaultTextStyle();

            p.Presentation.Append(slideMasterIdList1, slideIdList1, slideSize1, notesSize1, defaultTextStyle1);

            var slidePart1       = CreateSlidePart(p);
            var slideLayoutPart1 = CreateSlideLayoutPart(slidePart1);
            var slideMasterPart1 = CreateSlideMasterPart(slideLayoutPart1);
            var themePart1       = CreateTheme(slideMasterPart1);

            slideMasterPart1.AddPart(slideLayoutPart1, "rId1");
            p.AddPart(slideMasterPart1, "rId1");
            p.AddPart(themePart1, "rId5");
        }
Esempio n. 5
0
 void IPointCommand.Execute(IPointContext ctx, ref Action after) => ctx.PresentationOpen(Path);
Esempio n. 6
0
 void IPointCommand.Execute(IPointContext ctx, ref Action after) => ctx.Sets.Pop().Execute(ctx);
Esempio n. 7
0
 void IPointCommand.Execute(IPointContext ctx, ref Action after)
 {
     ctx.Frames.Push(ctx.Frame);
     ctx.ExecuteCmd(Cmds, out after); //action?.Invoke();
 }
Esempio n. 8
0
 void IPointCommand.Execute(IPointContext ctx, ref Action after) => ctx.Frame = ctx.Frames.Pop();
Esempio n. 9
0
 void IPointCommand.Execute(IPointContext ctx, ref Action after) => ctx.Flush();
Esempio n. 10
0
 void IPointCommand.Execute(IPointContext ctx, ref Action after) => ctx.CmdCols.Push(this);
Esempio n. 11
0
 void IPointCommand.Execute(IPointContext ctx, ref Action after) => Action(ctx);