Пример #1
0
        private void CopyButton_Click(object sender, RoutedEventArgs e)
        {
            Selection selection = this.GetCurrentSelection();

            if ((selection.Type != PpSelectionType.ppSelectionShapes &&
                 selection.Type != PpSelectionType.ppSelectionText) ||
                selection.ShapeRange.Count != 1)
            {
                MessageBox.Show(SyncLabText.ErrorCopySelectionInvalid, SyncLabText.ErrorDialogTitle);
                return;
            }

            Shape shape = selection.ShapeRange[1];

            if (shape.Type == MsoShapeType.msoSmartArt)
            {
                MessageBox.Show(SyncLabText.ErrorSmartArtUnsupported, SyncLabText.ErrorDialogTitle);
                return;
            }

            if (selection.HasChildShapeRange)
            {
                if (selection.ChildShapeRange.Count != 1)
                {
                    MessageBox.Show(SyncLabText.ErrorCopySelectionInvalid, SyncLabText.ErrorDialogTitle);
                    return;
                }
                shape = selection.ChildShapeRange[1];
            }

            bool canSyncPlaceHolder =
                shape.Type == MsoShapeType.msoPlaceholder &&
                ShapeUtil.CanCopyMsoPlaceHolder(shape, SyncFormatUtil.GetTemplateShapes());

            if (shape.Type != MsoShapeType.msoAutoShape &&
                shape.Type != MsoShapeType.msoLine &&
                shape.Type != MsoShapeType.msoPicture &&
                shape.Type != MsoShapeType.msoTextBox &&
                !canSyncPlaceHolder)
            {
                MessageBox.Show(SyncLabText.ErrorCopySelectionInvalid, SyncLabText.ErrorDialogTitle);
                return;
            }
            Dialog            = new SyncFormatDialog(shape);
            Dialog.ObjectName = shape.Name;
            bool?result = Dialog.ShowDialog();

            if (!result.HasValue || !(bool)result)
            {
                return;
            }
            AddFormatToList(shape, Dialog.ObjectName, Dialog.Formats);
            Dialog = null;
        }
        private void CopyButton_Click(object sender, RoutedEventArgs e)
        {
            Selection selection = this.GetCurrentSelection();

            if ((selection.Type != PpSelectionType.ppSelectionShapes &&
                 selection.Type != PpSelectionType.ppSelectionText) ||
                selection.ShapeRange.Count != 1)
            {
                MessageBox.Show(SyncLabText.ErrorCopySelectionInvalid, SyncLabText.ErrorDialogTitle);
                return;
            }

            Shape shape = selection.ShapeRange[1];

            if (shape.Type == MsoShapeType.msoSmartArt)
            {
                MessageBox.Show(SyncLabText.ErrorSmartArtUnsupported, SyncLabText.ErrorDialogTitle);
                return;
            }

            if (selection.HasChildShapeRange)
            {
                if (selection.ChildShapeRange.Count != 1)
                {
                    MessageBox.Show(SyncLabText.ErrorCopySelectionInvalid, SyncLabText.ErrorDialogTitle);
                    return;
                }
                shape = selection.ChildShapeRange[1];
            }

            if (!shape.IsNormalShape() &&
                !shape.IsPlaceholderSyncable())
            {
                MessageBox.Show(SyncLabText.ErrorCopySelectionInvalid, SyncLabText.ErrorDialogTitle);
                return;
            }
            Dialog            = new SyncFormatDialog(shape);
            Dialog.ObjectName = shape.Name;
            bool?result = Dialog.ShowThematicDialog();

            if (!result.HasValue || !(bool)result)
            {
                return;
            }
            AddFormatToList(shape, Dialog.ObjectName, Dialog.Formats);
            Dialog = null;
        }
Пример #3
0
        private void CopyButton_Click(object sender, RoutedEventArgs e)
        {
            var selection = this.GetCurrentSelection();

            if ((selection.Type != PpSelectionType.ppSelectionShapes &&
                 selection.Type != PpSelectionType.ppSelectionText) ||
                selection.ShapeRange.Count != 1)
            {
                MessageBox.Show(SyncLabText.ErrorCopySelectionInvalid, SyncLabText.ErrorDialogTitle);
                return;
            }

            var shape = selection.ShapeRange[1];

            if (selection.HasChildShapeRange)
            {
                if (selection.ChildShapeRange.Count != 1)
                {
                    MessageBox.Show(SyncLabText.ErrorCopySelectionInvalid, SyncLabText.ErrorDialogTitle);
                    return;
                }
                shape = selection.ChildShapeRange[1];
            }

            if (shape.Type != Microsoft.Office.Core.MsoShapeType.msoAutoShape &&
                shape.Type != Microsoft.Office.Core.MsoShapeType.msoLine &&
                shape.Type != Microsoft.Office.Core.MsoShapeType.msoTextBox)
            {
                MessageBox.Show(SyncLabText.ErrorCopySelectionInvalid, SyncLabText.ErrorDialogTitle);
                return;
            }
            Dialog            = new SyncFormatDialog(shape);
            Dialog.ObjectName = shape.Name;
            bool?result = Dialog.ShowDialog();

            if (!result.HasValue || !(bool)result)
            {
                return;
            }
            AddFormatToList(shape, Dialog.ObjectName, Dialog.Formats);
            Dialog = null;
        }