Пример #1
0
        /// <summary>
        /// Stretch shapes in the list
        /// </summary>
        /// <param name="stretchShapes">The shapes to stretch</param>
        /// <param name="stretchAction">The function to use to stretch</param>
        /// <param name="defaultReferenceEdge">The function to return the default reference edge</param>
        /// <param name="stretchType">The type of stretch to perform</param>
        private void Stretch(PowerPoint.ShapeRange stretchShapes, GetAppropriateStretchAction stretchAction,
                             GetDefaultReferenceEdge defaultReferenceEdge, StretchType stretchType)
        {
            if (!ValidateSelection(stretchShapes))
            {
                return;
            }

            PowerPoint.Shape referenceShape = GetReferenceShape(stretchShapes, defaultReferenceEdge, stretchType);
            float            referenceEdge  = defaultReferenceEdge(new PPShape(referenceShape));

            for (int i = 1; i <= stretchShapes.Count; i++)
            {
                if (referenceShape.Equals(stretchShapes[i]))
                {
                    continue;
                }
                PPShape       stretchShape = new PPShape(stretchShapes[i]);
                StretchAction sa           = stretchAction(referenceEdge, stretchShape);
                sa(referenceEdge, stretchShape);
            }
        }