Esempio n. 1
0
        private static void ConvertToPathGeometriesViaProxy(BaseFrameworkElement frameworkElement, List <PathGeometry> pathList)
        {
            TextEditProxy    editProxy      = TextEditProxyFactory.CreateEditProxy(frameworkElement);
            IViewTextBoxBase editingElement = editProxy.EditingElement;
            UIElement        uiElement      = editingElement.PlatformSpecificObject as UIElement;

            if (uiElement == null)
            {
                return;
            }
            frameworkElement.DesignerContext.ActiveView.AddLiveControl((IViewControl)editingElement);
            editProxy.ForceLoadOnInstantiate = true;
            editProxy.Instantiate();
            Rect computedTightBounds = frameworkElement.GetComputedTightBounds();

            editingElement.Width  = computedTightBounds.Width;
            editingElement.Height = computedTightBounds.Height;
            if (uiElement is RichTextBox)
            {
                PathConversionHelper.ConvertRichTextBoxToGeometry(uiElement as RichTextBox, pathList);
            }
            else if (uiElement is TextBox)
            {
                PathConversionHelper.ConvertTextBoxToGeometry(uiElement as TextBox, pathList);
            }
            frameworkElement.DesignerContext.ActiveView.RemoveLiveControl((IViewControl)editingElement);
        }
            public TextBoxRangeElement Instantiate(TextEditProxy textEditProxy, SceneViewModel viewModel, ITypeId targetType)
            {
                ControlTextRangeElement textRangeElement = (ControlTextRangeElement)this.Instantiate(viewModel, targetType);

                textRangeElement.TextEditProxy = textEditProxy;
                return((TextBoxRangeElement)textRangeElement);
            }
Esempio n. 3
0
            public RichTextBoxRangeElement Instantiate(TextEditProxy textEditProxy, SceneViewModel viewModel, ITypeId targetType)
            {
                RichTextBoxRangeElement textBoxRangeElement = (RichTextBoxRangeElement)this.Instantiate(viewModel, targetType);

                textBoxRangeElement.TextEditProxy = textEditProxy;
                return(textBoxRangeElement);
            }
Esempio n. 4
0
        public void Undo()
        {
            TextEditProxy textEditProxy = this.designerContext.ActiveSceneViewModel.TextSelectionSet.TextEditProxy;

            if (textEditProxy != null)
            {
                if (textEditProxy.EditingElement.CanUndo)
                {
                    if (!textEditProxy.EditingElement.CanRedo)
                    {
                        textEditProxy.Serialize();
                        textEditProxy.UpdateDocumentModel();
                        textEditProxy.EditingElement.Undo();
                    }
                    else
                    {
                        textEditProxy.EditingElement.Undo();
                        return;
                    }
                }
                else
                {
                    this.designerContext.ActiveView.TryExitTextEditMode();
                }
                if (!this.UndoService.CanUndo)
                {
                    return;
                }
            }
            this.UndoService.Undo();
            this.OnUndoRedoEditTransaction();
        }
Esempio n. 5
0
 public static TextRangeElement CreateTextRangeElementFromProxy(TextEditProxy proxy)
 {
     if (proxy.SupportsParagraphProperties)
     {
         ITypeId targetType = PlatformTypes.Inline;
         return((TextRangeElement)RichTextBoxParagraphsRangeElement.Factory.Instantiate(proxy, proxy.TextSource.ViewModel, targetType));
     }
     if (proxy.SupportsRangeProperties)
     {
         ITypeId targetType = PlatformTypes.Inline;
         return((TextRangeElement)RichTextBoxRangeElement.Factory.Instantiate(proxy, proxy.TextSource.ViewModel, targetType));
     }
     if (PlatformTypes.TextBox.IsAssignableFrom((ITypeId)proxy.TextSource.Type) || PlatformTypes.AccessText.IsAssignableFrom((ITypeId)proxy.TextSource.Type))
     {
         return((TextRangeElement)TextBoxRangeElement.Factory.Instantiate(proxy, proxy.TextSource.ViewModel, (ITypeId)proxy.TextSource.Type));
     }
     return((TextRangeElement)ControlTextRangeElement.Factory.Instantiate(proxy, proxy.TextSource.ViewModel, (ITypeId)proxy.TextSource.Type));
 }
Esempio n. 6
0
        public void Redo()
        {
            TextEditProxy textEditProxy = this.designerContext.ActiveSceneViewModel.TextSelectionSet.TextEditProxy;

            if (textEditProxy != null)
            {
                if (textEditProxy.EditingElement.CanRedo)
                {
                    textEditProxy.EditingElement.Redo();
                    return;
                }
                this.designerContext.ActiveView.TryExitTextEditMode();
                if (!this.UndoService.CanRedo)
                {
                    return;
                }
            }
            this.UndoService.Redo();
            this.OnUndoRedoEditTransaction();
        }