internal ExtendedHtmlEditorMashallingHandler(IHtmlMarshallingTarget editorContext, IContentSourceSite sourceSite, IHtmlEditorHost blogEditor, OpenLiveWriter.Interop.Com.IDropTarget unhandledDropTarget)
     : base(editorContext)
 {
     _insertionSite = sourceSite;
     _blogEditor = blogEditor;
     _unhandledDropTarget = unhandledDropTarget;
 }
Example #2
0
 internal ExtendedHtmlEditorMashallingHandler(IHtmlMarshallingTarget editorContext, IContentSourceSite sourceSite, IHtmlEditorHost blogEditor, OpenLiveWriter.Interop.Com.IDropTarget unhandledDropTarget)
     : base(editorContext)
 {
     _insertionSite       = sourceSite;
     _blogEditor          = blogEditor;
     _unhandledDropTarget = unhandledDropTarget;
 }
Example #3
0
 public UrlContentSourcelFormatHandler(DataObjectMeister dataObject, DataFormatHandlerContext handlerContext, IHtmlMarshallingTarget editorContext, IContentSourceSite sourceSite)
     : base(dataObject, handlerContext, editorContext)
 {
     _contentSourceSite = sourceSite;
 }
 public EmbedFormatHandler(DataObjectMeister dataObject, DataFormatHandlerContext handlerContext, IHtmlMarshallingTarget editorContext, IContentSourceSite sourceSite)
     : base(dataObject, handlerContext, editorContext)
 {
     _contentSourceSite = sourceSite;
 }
        public static void PerformInsertion(IContentSourceSite sourceSite, ContentSourceInfo contentSource)
        {
            // record use of content-source (used to list source in MRU order on the sidebar)
            RecordContentSourceUsage(contentSource.Id);

            try
            {
                if (contentSource.Instance is SmartContentSource)
                {
                    SmartContentSource scSource = (SmartContentSource)contentSource.Instance;

                    IExtensionData extensionData = sourceSite.CreateExtensionData(Guid.NewGuid().ToString());

                    // SmartContentSource implementations *must* be stateless (see WinLive 126969), so we wrap up the
                    // internal smart content context and pass it in as a parameter to the CreateContent call.
                    ISmartContent sContent;
                    if (scSource is IInternalSmartContentSource)
                    {
                        sContent = new InternalSmartContent(extensionData, sourceSite as IInternalSmartContentContextSource, contentSource.Id);
                    }
                    else
                    {
                        sContent = new SmartContent(extensionData);
                    }

                    if (scSource.CreateContent(sourceSite.DialogOwner, sContent) == DialogResult.OK)
                    {
                        string content = scSource.GenerateEditorHtml(sContent, sourceSite);
                        if (content != null)
                        {
                            sourceSite.InsertContent(contentSource.Id, content, extensionData);
                            sourceSite.Focus();

                            if (ApplicationPerformance.ContainsEvent(MediaInsertForm.EventName))
                                ApplicationPerformance.EndEvent(MediaInsertForm.EventName);
                        }
                    }
                }
                else if (contentSource.Instance is ContentSource)
                {
                    ContentSource sSource = (ContentSource)contentSource.Instance;
                    string newContent = String.Empty; // default
                    try { if (sourceSite.SelectedHtml != null) newContent = sourceSite.SelectedHtml; }
                    catch { } // safely try to provide selected html
                    if (sSource.CreateContent(sourceSite.DialogOwner, ref newContent) == DialogResult.OK)
                    {
                        sourceSite.InsertContent(newContent, contentSource.Id == WebImageContentSource.ID);
                        sourceSite.Focus();
                    }
                }
            }
            catch (Exception ex)
            {
                DisplayContentRetreivalError(sourceSite.DialogOwner, ex, contentSource);
            }
        }
 public static IDynamicCommandMenuContext CreateDynamicCommandMenuContext(DynamicCommandMenuOptions options, CommandManager commandManager, IContentSourceSite sourceSite)
 {
     return new ContentSourceCommandMenuContext(options, commandManager, sourceSite);
 }
 public ContentSourceCommandMenuContext(DynamicCommandMenuOptions options, CommandManager commandManager, IContentSourceSite sourceSite)
 {
     _options = options;
     _commandManager = commandManager;
     _insertionSite = sourceSite;
 }
        public ContentSourceCommand(IContentSourceSite sourceSite, ContentSourceInfo contentSourceInfo, bool isBuiltInPlugin)
        {
            // copy references
            _insertionSite = sourceSite;
            _contentSourceInfo = contentSourceInfo;

            // tie this command to the content-source for execution
            // (we don't initialize other properties b/c this Command
            // is only use for decoupled lookup & execution not for
            // UI display. If we actually want to display this command
            // on a command bar, etc. we should fill in the other properties.
            this.Identifier = contentSourceInfo.Id;

            // For built in plugins, we will get these values from the ribbon
            if (contentSourceInfo.CanCreateNew && !isBuiltInPlugin)
            {
                this.MenuText = ((IMenuCommandObject)this).Caption;
                this.CommandBarButtonBitmapEnabled = contentSourceInfo.Image;
            }
        }