コード例 #1
0
        private void PreviewHandler(Action <PowerPoint.ShapeRange> previewAction, int minNoOfSelectedShapes)
        {
            Focus();
            _previewCallBack = delegate
            {
                var selectedShapes = GetSelectedShapes();

                ModifySelectionAspectRatio();
                Preview(selectedShapes, previewAction, minNoOfSelectedShapes);
                _isPreviewed = true;
            };
            if (IsPreviewKeyPressed())
            {
                _previewCallBack.Invoke();
            }
        }
コード例 #2
0
        private void PreviewHandler(Action <PowerPoint.ShapeRange, float, float, bool> previewAction)
        {
            Focus();
            _previewCallBack = delegate
            {
                var selectedShapes = GetSelectedShapes();
                var slideWidth     = this.GetCurrentPresentation().SlideWidth;
                var slideHeight    = this.GetCurrentPresentation().SlideHeight;

                ModifySelectionAspectRatio();
                Preview(selectedShapes, slideWidth, slideHeight, previewAction);
                _isPreviewed = true;
            };
            if (IsPreviewKeyPressed())
            {
                _previewCallBack.Invoke();
            }
        }
コード例 #3
0
 private void Btn_MouseLeave(object sender, MouseEventArgs e)
 {
     TryReset();
     _previewCallBack = null;
 }
コード例 #4
0
 private void SnapAwayButton_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
 {
     Action<List<Shape>> positionsAction = (shapes) => PositionsLabMain.SnapAway(shapes);
     _previewCallBack = delegate
     {
         ExecutePositionsAction(positionsAction, true);
     };
     PreviewHandler();
 }
コード例 #5
0
        // Align right, bottom, vertical center, horizontal center
        public void ExecutePositionsAction(Action<PowerPoint.ShapeRange, float> positionsAction, float dimension, bool isPreview)
        {
            if (this.GetCurrentSelection().Type != PowerPoint.PpSelectionType.ppSelectionShapes)
            {
                if (!isPreview)
                {
                    ShowErrorMessageBox(ErrorMessageNoSelection);
                }
                return;
            }

            PowerPoint.ShapeRange simulatedShapes = null;

            try
            {
                var selectedShapes = this.GetCurrentSelection().ShapeRange;

                if (isPreview)
                {
                    SaveSelectedShapePositions(selectedShapes, allShapePos);
                }
                else
                {
                    UndoPreview();
                    _previewCallBack = null;
                    this.StartNewUndoEntry();
                }

                simulatedShapes = DuplicateShapes(selectedShapes);
                if (PositionsLabMain.AlignReference == PositionsLabMain.AlignReferenceObject.PowerpointDefaults)
                {
                    positionsAction.Invoke(selectedShapes, dimension);
                }
                else
                {
                    var simulatedPPShapes = ConvertShapeRangeToPPShapeList(simulatedShapes, 1);
                    var initialPositions = SaveOriginalPositions(simulatedPPShapes);

                    positionsAction.Invoke(simulatedShapes, dimension);

                    SyncShapes(selectedShapes, simulatedShapes, initialPositions);
                }
                if (isPreview)
                {
                    _previewIsExecuted = true;
                }
            }
            catch (Exception ex)
            {
                if (!isPreview)
                {
                    ShowErrorMessageBox(ex.Message, ex);
                }
            }
            finally
            {
                if (simulatedShapes != null)
                {
                    simulatedShapes.Delete();
                    GC.Collect();
                }
            }
        }
コード例 #6
0
 private void DistributeCenterButton_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
 {
     var slideWidth = this.GetCurrentPresentation().SlideWidth;
     var slideHeight = this.GetCurrentPresentation().SlideHeight;
     Action<List<PPShape>, float, float> positionsAction = (shapes, width, height) => PositionsLabMain.DistributeCenter(shapes, width, height);
     _previewCallBack = delegate
     {
         ExecutePositionsAction(positionsAction, slideWidth, slideHeight, true);
     };
     PreviewHandler();
 }
コード例 #7
0
 private void SwapPositionsButton_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
 {
     Action<List<PPShape>, bool> positionsAction = (shapes, isPreview) => PositionsLabMain.Swap(shapes, isPreview);
     _previewCallBack = delegate
     {
         ExecutePositionsAction(positionsAction, true, true);
     };
     PreviewHandler();
 }
コード例 #8
0
 private void AdjoinHorizontalButton_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
 {
     PositionsLabMain.AdjoinWithoutAligning();
     Action<List<PPShape>> positionsAction = (shapes) => PositionsLabMain.AdjoinHorizontal(shapes);
     _previewCallBack = delegate
     {
         ExecutePositionsAction(positionsAction, true);
     };
     PreviewHandler();
 }
コード例 #9
0
 private void AdjoinVerticalWithAlignButton_MouseEnter(object sender, MouseEventArgs e)
 {
     PositionsLabMain.AdjoinWithAligning();
     Action<List<PPShape>> positionsAction = (shapes) => PositionsLabMain.AdjoinVertical(shapes);
     _previewCallBack = delegate
     {
         ExecutePositionsAction(positionsAction, true);
     };
     PreviewHandler();
 }
コード例 #10
0
 private void AlignTopButton_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
 {
     Action<PowerPoint.ShapeRange> positionsAction = shapes => PositionsLabMain.AlignTop(shapes);
     _previewCallBack = delegate
     {
         ExecutePositionsAction(positionsAction, true);
     };
     PreviewHandler();
 }
コード例 #11
0
 private void AlignCenterButton_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
 {
     var slideHeight = this.GetCurrentPresentation().SlideHeight;
     var slideWidth = this.GetCurrentPresentation().SlideWidth;
     Action<PowerPoint.ShapeRange, float, float> positionsAction = (shapes, height, width) => PositionsLabMain.AlignCenter(shapes, height, width);
     _previewCallBack = delegate
     {
         ExecutePositionsAction(positionsAction, slideHeight, slideWidth, true);
     };
     PreviewHandler();
 }
コード例 #12
0
 private void UndoPreview(object sender, System.Windows.Input.MouseEventArgs e)
 {
     UndoPreview();
     _previewCallBack = null;
 }
コード例 #13
0
        public void ExecutePositionsAction(Action<List<Shape>> positionsAction, bool isPreview)
        {
            if (this.GetCurrentSelection().Type != PowerPoint.PpSelectionType.ppSelectionShapes)
            {
                if (!isPreview)
                {
                    ShowErrorMessageBox(ErrorMessageNoSelection);
                }
                return;
            }

            try
            {
                var selectedShapes = this.GetCurrentSelection().ShapeRange;

                if (isPreview)
                {
                    SaveSelectedShapePositions(selectedShapes, allShapePos);
                }
                else
                {
                    UndoPreview();
                    _previewCallBack = null;
                    this.StartNewUndoEntry();
                }

                positionsAction.Invoke(ConvertShapeRangeToShapeList(selectedShapes, 1));

                GC.Collect();

                if (isPreview)
                {
                    _previewIsExecuted = true;
                }
            }
            catch (Exception ex)
            {
                if (!isPreview)
                {
                    ShowErrorMessageBox(ex.Message, ex);
                }
            }
        }
コード例 #14
0
        private void PreviewHandler(Action<PowerPoint.ShapeRange, float, float, bool> previewAction)
        {
            Focus();
            _previewCallBack = delegate
            {
                var selectedShapes = GetSelectedShapes();
                var slideWidth = this.GetCurrentPresentation().SlideWidth;
                var slideHeight = this.GetCurrentPresentation().SlideHeight;

                ModifySelectionAspectRatio();
                Preview(selectedShapes, slideWidth, slideHeight, previewAction);
                _isPreviewed = true;
            };
            if (IsPreviewKeyPressed())
            {
                _previewCallBack.Invoke();
            }
        }
コード例 #15
0
        private void PreviewHandler(Action<PowerPoint.ShapeRange> previewAction, int minNoOfSelectedShapes)
        {
            Focus();
            _previewCallBack = delegate
            {
                var selectedShapes = GetSelectedShapes();

                ModifySelectionAspectRatio();
                Preview(selectedShapes, previewAction, minNoOfSelectedShapes);
                _isPreviewed = true;
            };
            if (IsPreviewKeyPressed())
            {
                _previewCallBack.Invoke();
            }
        }
コード例 #16
0
 private void Btn_MouseLeave(object sender, MouseEventArgs e)
 {
     TryReset();
     _previewCallBack = null;
 }