Exemple #1
0
        protected override void ExecuteAction(string ribbonId)
        {
            IMessageService     cropLabMessageService = MessageServiceFactory.GetCropLabMessageService();
            CropLabErrorHandler errorHandler          = CropLabErrorHandler.InitializeErrorHandler(cropLabMessageService);

            if (!ShapeUtil.IsSelectionShape(this.GetCurrentSelection()))
            {
                HandleInvalidSelectionError(CropLabErrorHandler.ErrorCodeSelectionIsInvalid, FeatureName, CropLabErrorHandler.SelectionTypePicture, 2, errorHandler);
                return;
            }
            ShapeRange shapeRange = this.GetCurrentSelection().ShapeRange;

            if (shapeRange.Count < 2)
            {
                HandleInvalidSelectionError(CropLabErrorHandler.ErrorCodeSelectionIsInvalid, FeatureName, CropLabErrorHandler.SelectionTypePicture, 2, errorHandler);
                return;
            }
            if (!ShapeUtil.IsAllPictureWithReferenceObject(shapeRange))
            {
                HandleErrorCode(CropLabErrorHandler.ErrorCodeSelectionMustBePicture, FeatureName, errorHandler);
                return;
            }

            bool hasChange = CropToSame.CropSelection(shapeRange);

            if (!hasChange)
            {
                HandleErrorCode(CropLabErrorHandler.ErrorCodeNoDimensionCropped, FeatureName, errorHandler);
            }
        }
        public void CropAndCompare(int testSlideNo, int expectedSlideNo)
        {
            // Execute the Crop To Same feature
            Microsoft.Office.Interop.PowerPoint.ShapeRange testShapes = GetShapes(testSlideNo, selectMultipleShapesNames);
            Microsoft.Office.Interop.PowerPoint.ShapeRange expShapes  = GetShapes(expectedSlideNo, selectMultipleShapesNames);
            CropToSame.CropSelection(testShapes);

            testShapes = GetShapes(testSlideNo, selectMultipleShapesNames);
            CheckShapes(testShapes, expShapes);
        }
Exemple #3
0
        public void CropAndCompare(int testSlideNo, int expectedSlideNo)
        {
            // Execute the Crop To Same feature
            var testShapes = GetShapes(testSlideNo, selectMultipleShapesNames);
            var expShapes  = GetShapes(expectedSlideNo, selectMultipleShapesNames);

            CropToSame.CropSelection(testShapes);

            testShapes = GetShapes(testSlideNo, selectMultipleShapesNames);
            CheckShapes(testShapes, expShapes);
        }