Beispiel #1
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider serviceProvider, object value)
 {
     string cssText = null;
     if (value != null)
     {
         cssText = (string) value;
     }
     StyledElement instance = (StyledElement) context.Instance;
     StyleBuilderDialog dialog = new StyleBuilderDialog(serviceProvider, instance.Owner.Url, null, cssText);
     IMxUIService service = (IMxUIService) serviceProvider.GetService(typeof(IMxUIService));
     if (service.ShowDialog(dialog) == DialogResult.OK)
     {
         cssText = dialog.CssText;
     }
     return cssText;
 }
Beispiel #2
0
        protected virtual bool HandleCommand(Command command)
        {
            bool flag = false;
            if (command.CommandGroup == typeof(WebCommands))
            {
                ComboBoxToolBarButton commandUI;
                switch (command.CommandID)
                {
                    case 1:
                        this._editor.GlyphsVisible = !this._editor.GlyphsVisible;
                        flag = true;
                        goto Label_09DA;

                    case 2:
                        this._editor.BordersVisible = !this._editor.BordersVisible;
                        flag = true;
                        goto Label_09DA;

                    case 3:
                        this._editor.GridVisible = !this._editor.GridVisible;
                        flag = true;
                        goto Label_09DA;

                    case 4:
                        this._editor.SnapEnabled = !this._editor.SnapEnabled;
                        flag = true;
                        goto Label_09DA;

                    case 100:
                        this._editor.TextFormatting.ToggleBold();
                        flag = true;
                        goto Label_09DA;

                    case 0x65:
                        this._editor.TextFormatting.ToggleItalics();
                        flag = true;
                        goto Label_09DA;

                    case 0x66:
                        this._editor.TextFormatting.ToggleUnderline();
                        flag = true;
                        goto Label_09DA;

                    case 0x67:
                        this._editor.TextFormatting.ToggleSuperscript();
                        flag = true;
                        goto Label_09DA;

                    case 0x68:
                        this._editor.TextFormatting.ToggleSubscript();
                        flag = true;
                        goto Label_09DA;

                    case 0x69:
                        this._editor.TextFormatting.ToggleStrikethrough();
                        flag = true;
                        goto Label_09DA;

                    case 0x6a:
                    {
                        ColorDialog dialog2 = new ColorDialog();
                        if (dialog2.ShowDialog() == DialogResult.OK)
                        {
                            this._editor.TextFormatting.ForeColor = dialog2.Color;
                        }
                        flag = true;
                        goto Label_09DA;
                    }
                    case 0x6b:
                    {
                        ColorDialog dialog = new ColorDialog();
                        if (dialog.ShowDialog() == DialogResult.OK)
                        {
                            this._editor.TextFormatting.BackColor = dialog.Color;
                        }
                        flag = true;
                        goto Label_09DA;
                    }
                    case 0x6c:
                        this._editor.TextFormatting.SetAlignment(Alignment.Left);
                        flag = true;
                        goto Label_09DA;

                    case 0x6d:
                        this._editor.TextFormatting.SetAlignment(Alignment.Right);
                        flag = true;
                        goto Label_09DA;

                    case 110:
                        this._editor.TextFormatting.SetAlignment(Alignment.Center);
                        flag = true;
                        goto Label_09DA;

                    case 0x6f:
                        this._editor.TextFormatting.SetTextFormat(TextFormat.OrderedList);
                        flag = true;
                        goto Label_09DA;

                    case 0x70:
                        this._editor.TextFormatting.SetTextFormat(TextFormat.UnorderedList);
                        flag = true;
                        goto Label_09DA;

                    case 0x71:
                        this._editor.TextFormatting.Indent();
                        flag = true;
                        goto Label_09DA;

                    case 0x72:
                        this._editor.TextFormatting.Unindent();
                        flag = true;
                        goto Label_09DA;

                    case 0x73:
                    case 0x74:
                    case 0x75:
                    case 0x76:
                    case 0x77:
                    case 0x7c:
                    case 0x7d:
                    case 0x7e:
                    case 0x7f:
                    case 0x80:
                    case 0x81:
                    case 0x8b:
                    case 230:
                        goto Label_09DA;

                    case 120:
                        commandUI = (ComboBoxToolBarButton) command.CommandUI;
                        this._editor.TextFormatting.SetTextFormat((TextFormat) commandUI.ComboBox.SelectedIndex);
                        flag = true;
                        goto Label_09DA;

                    case 0x79:
                        commandUI = (ComboBoxToolBarButton) command.CommandUI;
                        this._editor.TextFormatting.FontName = commandUI.ComboBox.Text;
                        flag = true;
                        goto Label_09DA;

                    case 0x7a:
                        commandUI = (ComboBoxToolBarButton) command.CommandUI;
                        this._editor.TextFormatting.FontSize = (FontSize) int.Parse(commandUI.ComboBox.Text);
                        flag = true;
                        goto Label_09DA;

                    case 0x7b:
                    {
                        IList elements = this._editor.Selection.Elements;
                        if ((elements != null) && (elements.Count != 0))
                        {
                            Element element = elements[0] as Element;
                            if (element != null)
                            {
                                IStyle style = new InlineStyle(element.Peer.GetStyle());
                                StyleBuilderDialog dialog3 = new StyleBuilderDialog(this._serviceProvider, this._editor.Url, element.ToString(), style);
                                ((IMxUIService) this._serviceProvider.GetService(typeof(IMxUIService))).ShowDialog(dialog3);
                            }
                        }
                        flag = true;
                        goto Label_09DA;
                    }
                    case 130:
                    case 0x83:
                    case 0x84:
                    case 0x85:
                    case 0x86:
                    case 0x87:
                    case 0x88:
                    case 0x89:
                    case 0x8a:
                        this._editor.TextFormatting.SetTextFormat((TextFormat) (command.CommandID - 130));
                        flag = true;
                        goto Label_09DA;

                    case 140:
                        this._editor.Selection.ToggleAbsolutePosition();
                        flag = true;
                        goto Label_09DA;

                    case 0x8d:
                        this._editor.Selection.BringToFront();
                        flag = true;
                        goto Label_09DA;

                    case 0x8e:
                        this._editor.Selection.SendToBack();
                        flag = true;
                        goto Label_09DA;

                    case 0x8f:
                        this._editor.Selection.AlignLeft();
                        flag = true;
                        goto Label_09DA;

                    case 0x90:
                        this._editor.Selection.AlignHorizontalCenter();
                        flag = true;
                        goto Label_09DA;

                    case 0x91:
                        this._editor.Selection.AlignRight();
                        flag = true;
                        goto Label_09DA;

                    case 0x92:
                        this._editor.Selection.AlignTop();
                        flag = true;
                        goto Label_09DA;

                    case 0x93:
                        this._editor.Selection.AlignVerticalCenter();
                        flag = true;
                        goto Label_09DA;

                    case 0x94:
                        this._editor.Selection.AlignBottom();
                        flag = true;
                        goto Label_09DA;

                    case 0x95:
                        this._editor.Selection.MatchWidth();
                        flag = true;
                        goto Label_09DA;

                    case 150:
                        this._editor.Selection.MatchHeight();
                        flag = true;
                        goto Label_09DA;

                    case 0x97:
                        this._editor.Selection.MatchSize();
                        flag = true;
                        goto Label_09DA;

                    case 0x98:
                        this._editor.Selection.ToggleLock();
                        flag = true;
                        goto Label_09DA;

                    case 200:
                    {
                        string initialDescription = null;
                        if (this._editor.Selection.SelectionType == EditorSelectionType.TextSelection)
                        {
                            initialDescription = this._editor.Selection.Text;
                        }
                        InsertHyperlinkDialog form = new InsertHyperlinkDialog(initialDescription, this._serviceProvider);
                        IUIService service = (IUIService) this._serviceProvider.GetService(typeof(IUIService));
                        if (service.ShowDialog(form) == DialogResult.OK)
                        {
                            this._editor.Document.InsertHyperlink(form.Url, form.Description);
                        }
                        flag = true;
                        goto Label_09DA;
                    }
                    case 0xc9:
                        this._editor.Selection.RemoveHyperlink();
                        flag = true;
                        goto Label_09DA;

                    case 0xca:
                        this._editor.Selection.WrapSelectionInSpan();
                        flag = true;
                        goto Label_09DA;

                    case 0xcb:
                        this._editor.Selection.WrapSelectionInDiv();
                        flag = true;
                        goto Label_09DA;

                    case 220:
                    {
                        InsertTableDialog dialog5 = new InsertTableDialog(this._serviceProvider);
                        IUIService service3 = (IUIService) this._serviceProvider.GetService(typeof(IUIService));
                        if (service3.ShowDialog(dialog5) == DialogResult.OK)
                        {
                            this._editor.Document.InsertHtml(dialog5.HtmlTableString);
                        }
                        flag = true;
                        goto Label_09DA;
                    }
                    case 0xdd:
                    {
                        EditorTable tableEditor = this._editor.Selection.TableEditor;
                        if (tableEditor != null)
                        {
                            tableEditor.InsertTableRow();
                        }
                        flag = true;
                        goto Label_09DA;
                    }
                    case 0xde:
                    {
                        EditorTable table2 = this._editor.Selection.TableEditor;
                        if (table2 != null)
                        {
                            table2.InsertTableColumn();
                        }
                        flag = true;
                        goto Label_09DA;
                    }
                    case 0xdf:
                    {
                        EditorTable table3 = this._editor.Selection.TableEditor;
                        if (table3 != null)
                        {
                            table3.DeleteTableRow();
                        }
                        flag = true;
                        goto Label_09DA;
                    }
                    case 0xe0:
                    {
                        EditorTable table4 = this._editor.Selection.TableEditor;
                        if (table4 != null)
                        {
                            table4.DeleteTableColumn();
                        }
                        flag = true;
                        goto Label_09DA;
                    }
                    case 0xe1:
                    {
                        EditorTable table5 = this._editor.Selection.TableEditor;
                        if (table5 != null)
                        {
                            table5.MergeLeft();
                        }
                        flag = true;
                        goto Label_09DA;
                    }
                    case 0xe2:
                    {
                        EditorTable table6 = this._editor.Selection.TableEditor;
                        if (table6 != null)
                        {
                            table6.MergeRight();
                        }
                        flag = true;
                        goto Label_09DA;
                    }
                    case 0xe3:
                    {
                        EditorTable table7 = this._editor.Selection.TableEditor;
                        if (table7 != null)
                        {
                            table7.MergeUp();
                        }
                        flag = true;
                        goto Label_09DA;
                    }
                    case 0xe4:
                    {
                        EditorTable table8 = this._editor.Selection.TableEditor;
                        if (table8 != null)
                        {
                            table8.MergeDown();
                        }
                        flag = true;
                        goto Label_09DA;
                    }
                    case 0xe5:
                    {
                        EditorTable table9 = this._editor.Selection.TableEditor;
                        if (table9 != null)
                        {
                            table9.SplitHorizontal();
                        }
                        flag = true;
                        goto Label_09DA;
                    }
                    case 0xe7:
                    {
                        EditorTable table10 = this._editor.Selection.TableEditor;
                        if (table10 != null)
                        {
                            table10.SplitVertical();
                        }
                        flag = true;
                        goto Label_09DA;
                    }
                    case 260:
                    {
                        EditorSelection selection = this._editor.Selection;
                        QuickTagEditDialog dialog6 = new QuickTagEditDialog(this._serviceProvider);
                        string outerHtml = selection.GetOuterHtml();
                        dialog6.TagText = outerHtml;
                        IUIService service4 = (IUIService) this._serviceProvider.GetService(typeof(IUIService));
                        if (service4.ShowDialog(dialog6) == DialogResult.OK)
                        {
                            string tagText = dialog6.TagText;
                            if (string.Compare(tagText, outerHtml) != 0)
                            {
                                selection.SetOuterHtml(tagText);
                            }
                        }
                        flag = true;
                        goto Label_09DA;
                    }
                }
            }
            else if (command.CommandGroup == typeof(GlobalCommands))
            {
                switch (command.CommandID)
                {
                    case 100:
                        this._editor.Undo();
                        flag = true;
                        goto Label_09DA;

                    case 0x65:
                        this._editor.Redo();
                        flag = true;
                        goto Label_09DA;

                    case 0x66:
                        this._editor.Cut();
                        flag = true;
                        goto Label_09DA;

                    case 0x67:
                        this._editor.Copy();
                        flag = true;
                        goto Label_09DA;

                    case 0x68:
                        this._editor.Paste();
                        flag = true;
                        goto Label_09DA;

                    case 0x69:
                        goto Label_09DA;

                    case 0x6a:
                        this._editor.SelectAll();
                        flag = true;
                        goto Label_09DA;

                    case 3:
                    {
                        IDesignerHost host = (IDesignerHost) this._serviceProvider.GetService(typeof(IDesignerHost));
                        if (host.Loading)
                        {
                            flag = true;
                        }
                        goto Label_09DA;
                    }
                }
            }
            Label_09DA:
            if (flag)
            {
                this._commandManager.UpdateCommands(false);
            }
            return flag;
        }
Beispiel #3
0
 protected StyleEditingGroup(StyleBuilderDialog owner, Microsoft.Matrix.Packages.Web.Html.Css.CssAttributes cssAttributes, string groupName, Image image)
     : base(groupName, image)
 {
     this._owner = owner;
     this._cssAttributes = cssAttributes;
 }
Beispiel #4
0
 public FontStyleEditingGroup(StyleBuilderDialog owner, CssAttributes cssAttributes, Image image)
     : base(owner, cssAttributes, "Font", image)
 {
 }
Beispiel #5
0
 public BackgroundStyleEditingGroup(StyleBuilderDialog owner, CssAttributes cssAttributes, Image image)
     : base(owner, cssAttributes, "Background", image)
 {
 }