public ImagePropertiesSidebar(
     IHtmlEditorComponentContext editorContext,
     IBlogPostImageEditingContext imageEditingContext,
     CreateFileCallback createFileCallback)
 {
     _editorContext = editorContext;
     _dataContext = imageEditingContext;
     _createFileCallback = createFileCallback;
 }
Example #2
0
 public ImagePropertiesSidebar(
     IHtmlEditorComponentContext editorContext,
     IBlogPostImageEditingContext imageEditingContext,
     CreateFileCallback createFileCallback)
 {
     _editorContext      = editorContext;
     _dataContext        = imageEditingContext;
     _createFileCallback = createFileCallback;
 }
Example #3
0
 public ImagePropertiesSidebarHostControl(
     ISidebarContext sidebarContext,
     IHtmlEditorComponentContext editorContext,
     IBlogPostImageEditingContext imageEditingContext,
     CreateFileCallback createFileCallback)
 {
     // Instead of creating the image sidebar, we now create the manager for ribbon commands releated to image editing.
     _pictureEditingManager = new PictureEditingManager(editorContext, imageEditingContext, createFileCallback);
 }
 public ImagePropertiesSidebarHostControl(
     ISidebarContext sidebarContext,
     IHtmlEditorComponentContext editorContext,
     IBlogPostImageEditingContext imageEditingContext,
     CreateFileCallback createFileCallback)
 {
     // Instead of creating the image sidebar, we now create the manager for ribbon commands releated to image editing.
     _pictureEditingManager = new PictureEditingManager(editorContext, imageEditingContext, createFileCallback);
 }
Example #5
0
        public EmoticonsManager(IBlogPostImageEditingContext imageEditingContext, IEditingMode editingModeContext)
        {
            _imageEditingContext = imageEditingContext;
            _editingModeContext  = editingModeContext;
            _recentEmoticons     = RetrieveRecentEmoticons();
            _inlineImageUriTable = new Dictionary <Emoticon, Uri>();

            // This is a DEBUG only call.
            AssertEmoticonsManagerSetupCorrectly();
        }
        public PictureEditingManager(
            IHtmlEditorComponentContext editorContext,
            IBlogPostImageEditingContext imageEditingContext,
            CreateFileCallback createFileCallback)
        {
            _editorContext = editorContext;
            _imageEditingContext = imageEditingContext;
            _createFileCallback = createFileCallback;

            InitializeCommands();
        }
Example #7
0
        public PictureEditingManager(
            IHtmlEditorComponentContext editorContext,
            IBlogPostImageEditingContext imageEditingContext,
            CreateFileCallback createFileCallback)
        {
            _editorContext       = editorContext;
            _imageEditingContext = imageEditingContext;
            _createFileCallback  = createFileCallback;

            InitializeCommands();
        }
        public TypographicCharacterHandler(MarkupRange currentSelection, InsertHtml insertHtml, IBlogPostImageEditingContext imageEditingContext, IHTMLElement postBodyElement, char c, string htmlText, MarkupPointer blockBoundary)
        {
            _currentSelection = currentSelection.Clone();
            _currentSelection.Start.Gravity = _POINTER_GRAVITY.POINTER_GRAVITY_Right;
            _currentSelection.End.Gravity = _POINTER_GRAVITY.POINTER_GRAVITY_Left;
            _insertHtml = insertHtml;
            _imageEditingContext = imageEditingContext;
            _postBodyElement = postBodyElement;

            this.c = c;
            this.htmlText = htmlText;
            this.blockBoundary = blockBoundary;
        }
Example #9
0
        public TypographicCharacterHandler(MarkupRange currentSelection, InsertHtml insertHtml, IBlogPostImageEditingContext imageEditingContext, IHTMLElement postBodyElement, char c, string htmlText, MarkupPointer blockBoundary)
        {
            _currentSelection = currentSelection.Clone();
            _currentSelection.Start.Gravity = _POINTER_GRAVITY.POINTER_GRAVITY_Right;
            _currentSelection.End.Gravity   = _POINTER_GRAVITY.POINTER_GRAVITY_Left;
            _insertHtml          = insertHtml;
            _imageEditingContext = imageEditingContext;
            _postBodyElement     = postBodyElement;

            this.c             = c;
            this.htmlText      = htmlText;
            this.blockBoundary = blockBoundary;
        }
Example #10
0
        public PostEditorKeyboardHandler(BlogPostHtmlEditorControl blogPostHtmlEditorControl, IBlogPostImageEditingContext imageEditingContext, IEditingMode editingModeContext)
        {
            _blogPostHtmlEditorControl = blogPostHtmlEditorControl;
            _blogPostHtmlEditorControl.PostEditorEvent  += _blogPostHtmlEditorControl_PostEditorEvent;
            _blogPostHtmlEditorControl.KeyPress         += _blogPostHtmlEditorControl_KeyPress;
            _blogPostHtmlEditorControl.KeyDown          += _blogPostHtmlEditorControl_KeyDown;
            _blogPostHtmlEditorControl.SelectionChanged += _blogPostHtmlEditorControl_SelectionChanged;

            _imageEditingContext = imageEditingContext;
            _editingModeContext  = editingModeContext;

            _autoreplaceManager = new AutoreplaceManager();
            AutoreplaceSettings.SettingsChanged += AutoreplaceSettings_SettingsChanged;

            LastChanceKeyboardHook.BeforeKeyHandled += _keyHandled;
        }
        public PostEditorKeyboardHandler(BlogPostHtmlEditorControl blogPostHtmlEditorControl, IBlogPostImageEditingContext imageEditingContext, IEditingMode editingModeContext)
        {
            _blogPostHtmlEditorControl = blogPostHtmlEditorControl;
            _blogPostHtmlEditorControl.PostEditorEvent += _blogPostHtmlEditorControl_PostEditorEvent;
            _blogPostHtmlEditorControl.KeyPress += _blogPostHtmlEditorControl_KeyPress;
            _blogPostHtmlEditorControl.KeyDown += _blogPostHtmlEditorControl_KeyDown;
            _blogPostHtmlEditorControl.SelectionChanged += _blogPostHtmlEditorControl_SelectionChanged;

            _imageEditingContext = imageEditingContext;
            _editingModeContext = editingModeContext;

            _autoreplaceManager = new AutoreplaceManager();
            AutoreplaceSettings.SettingsChanged += AutoreplaceSettings_SettingsChanged;

            LastChanceKeyboardHook.BeforeKeyHandled += _keyHandled;
        }
        public BlogPostHtmlSourceEditorControl(IBlogPostSpellCheckingContext spellingContext, CommandManager commandManager, IBlogPostImageEditingContext editingContext)
        {
            this.spellingContext = spellingContext;
            this.editingContext = editingContext;
            InitializeComponent();

            sourceControl = new HtmlSourceEditorControl(spellingContext.SpellingChecker, commandManager, editingContext);
            sourceControl.EditorControl.TextChanged += new EventHandler(EditorControl_TextChanged);
            sourceControl.EditorControl.GotFocus += new EventHandler(EditorControl_GotFocus);
            BorderControl borderControl = new BorderControl();
            borderControl.SuppressBottomBorder = true;
            borderControl.Control = sourceControl.EditorControl;
            borderControl.Dock = DockStyle.Fill;
            panelSourceEditor.Controls.Add(borderControl);

            ColorizedResources.Instance.RegisterControlForBackColorUpdates(this);

            textBoxTitle.AccessibleName = Res.Get(StringId.PostEditorTitleRegion);
            sourceControl.EditorControl.AccessibleName = Res.Get(StringId.PostEditorBodyRegion);
        }
Example #13
0
        public BlogPostHtmlSourceEditorControl(IBlogPostSpellCheckingContext spellingContext, CommandManager commandManager, IBlogPostImageEditingContext editingContext)
        {
            this.spellingContext = spellingContext;
            this.editingContext  = editingContext;
            InitializeComponent();

            sourceControl = new HtmlSourceEditorControl(spellingContext.SpellingChecker, commandManager, editingContext);
            sourceControl.EditorControl.TextChanged += new EventHandler(EditorControl_TextChanged);
            sourceControl.EditorControl.GotFocus    += new EventHandler(EditorControl_GotFocus);
            BorderControl borderControl = new BorderControl();

            borderControl.SuppressBottomBorder = true;
            borderControl.Control = sourceControl.EditorControl;
            borderControl.Dock    = DockStyle.Fill;
            panelSourceEditor.Controls.Add(borderControl);

            ColorizedResources.Instance.RegisterControlForBackColorUpdates(this);

            textBoxTitle.AccessibleName = Res.Get(StringId.PostEditorTitleRegion);
            sourceControl.EditorControl.AccessibleName = Res.Get(StringId.PostEditorBodyRegion);
        }
        //ToDo: OLW Spell Checker
        //public BlogPostHtmlEditorControl(IMainFrameWindow mainFrameWindow, IStatusBar statusBar, MshtmlOptions options, IBlogPostImageEditingContext imageEditingContext, IBlogPostSidebarContext sidebarContext, IContentSourceSidebarContext sourceContext, SmartContentResizedListener resizedListener, IBlogPostSpellCheckingContext spellingContext, IImageReferenceFixer referenceFixer, IInternetSecurityManager internetSecurityManager, CommandManager commandManager, TemplateStrategy strategy, IEditingMode editingModeContext)  : base(mainFrameWindow, statusBar, options, internetSecurityManager, commandManager)
        public BlogPostHtmlEditorControl(IMainFrameWindow mainFrameWindow, IStatusBar statusBar, MshtmlOptions options, IBlogPostImageEditingContext imageEditingContext, IBlogPostSidebarContext sidebarContext, IContentSourceSidebarContext sourceContext, SmartContentResizedListener resizedListener, IImageReferenceFixer referenceFixer, IInternetSecurityManager internetSecurityManager, CommandManager commandManager, TemplateStrategy strategy, IEditingMode editingModeContext)
            : base(mainFrameWindow, statusBar, options, internetSecurityManager, commandManager)
        {
            _strategy = strategy;
            _imageEditingContext = imageEditingContext;
            _sidebarContext = sidebarContext;
            _sourceContext = sourceContext;
            _resizedListener = resizedListener;
            //ToDo: OLW Spell Checker
            //_spellingContext = spellingContext;

            //_spellingManager = new SpellingManager(CommandManager);
            _keyBoardHandler = new PostEditorKeyboardHandler(this, imageEditingContext, editingModeContext);
            _referenceFixer = referenceFixer;

            InitializeTableEditingManager();

            InitializeElementBehaviors();

            SelectionChanged += BlogPostHtmlEditorControl_SelectionChanged;
            KeyPress += new HtmlEventHandler(BlogPostHtmlEditorControl_KeyPress);
        }
Example #15
0
 public HtmlSourceEditorControl(ISpellingChecker spellingChecker, CommandManager commandManager, IBlogPostImageEditingContext editingContext)
     : base(spellingChecker, commandManager)
 {
     this.editingContext = editingContext;
 }
Example #16
0
        public static ImagePropertiesInfo GetImagePropertiesInfo(IHTMLImgElement imgElement, IBlogPostImageEditingContext editorContext)
        {
            IHTMLElement      imgHtmlElement = (IHTMLElement)imgElement;
            string            imgSrc         = imgHtmlElement.getAttribute("src", 2) as string;
            BlogPostImageData imageData      = null;

            try
            {
                imageData = BlogPostImageDataList.LookupImageDataByInlineUri(editorContext.ImageList, new Uri(imgSrc));
            }
            catch (UriFormatException)
            {
                //this URI is probably relative web URL, so extract the image src letting the
                //DOM fill in the full URL for us based on the base URL.
                imgSrc = imgHtmlElement.getAttribute("src", 0) as string;
            }

            ImagePropertiesInfo info;

            if (imageData != null && imageData.GetImageSourceFile() != null)
            {
                //clone the image data to the sidebar doesn't change it (required for preserving image undo/redo state)
                imageData = (BlogPostImageData)imageData.Clone();
                //this is an attached local image
                info            = new BlogPostImagePropertiesInfo(imageData, new ImageDecoratorsList(editorContext.DecoratorsManager, imageData.ImageDecoratorSettings));
                info.ImgElement = imgHtmlElement;
            }
            else
            {
                //this is not an attached local image, so treat as a web image
                ImageDecoratorsList remoteImageDecoratorsList = new ImageDecoratorsList(editorContext.DecoratorsManager, new BlogPostSettingsBag());
                remoteImageDecoratorsList.AddDecorator(editorContext.DecoratorsManager.GetDefaultRemoteImageDecorators());

                //The source image size is unknown, so calculate the actual image size by removing
                //the size attributes, checking the size, and then placing the size attributes back
                string oldHeight = imgHtmlElement.getAttribute("height", 2) as string;
                string oldWidth  = imgHtmlElement.getAttribute("width", 2) as string;
                imgHtmlElement.removeAttribute("width", 0);
                imgHtmlElement.removeAttribute("height", 0);
                int width  = imgElement.width;
                int height = imgElement.height;

                if (!String.IsNullOrEmpty(oldHeight))
                {
                    imgHtmlElement.setAttribute("height", oldHeight, 0);
                }
                if (!String.IsNullOrEmpty(oldWidth))
                {
                    imgHtmlElement.setAttribute("width", oldWidth, 0);
                }

                info            = new ImagePropertiesInfo(new Uri(imgSrc), new Size(width, height), remoteImageDecoratorsList);
                info.ImgElement = imgHtmlElement;

                // Sets the correct inline image size and image size name for the remote image.
                if (!String.IsNullOrEmpty(oldWidth) && !String.IsNullOrEmpty(oldHeight))
                {
                    int inlineWidth, inlineHeight;
                    if (Int32.TryParse(oldWidth, NumberStyles.Integer, CultureInfo.InvariantCulture, out inlineWidth) &&
                        Int32.TryParse(oldHeight, NumberStyles.Integer, CultureInfo.InvariantCulture, out inlineHeight))
                    {
                        info.InlineImageSize = new Size(inlineWidth, inlineHeight);
                    }
                }

                // Sets the correct border style for the remote image.
                if (new HtmlBorderDecoratorSettings(imgHtmlElement).InheritBorder)
                {
                    if (!info.ImageDecorators.ContainsDecorator(HtmlBorderDecorator.Id))
                    {
                        info.ImageDecorators.AddDecorator(HtmlBorderDecorator.Id);
                    }
                }
                else if (new NoBorderDecoratorSettings(imgHtmlElement).NoBorder)
                {
                    if (!info.ImageDecorators.ContainsDecorator(NoBorderDecorator.Id))
                    {
                        info.ImageDecorators.AddDecorator(NoBorderDecorator.Id);
                    }
                }
            }

            //transfer image data properties
            if (imageData != null)
            {
                info.UploadSettings  = imageData.UploadInfo.Settings;
                info.UploadServiceId = imageData.UploadInfo.ImageServiceId;
                if (info.UploadServiceId == null)
                {
                    info.UploadServiceId = editorContext.ImageServiceId;
                }
            }

            return(info);
        }
Example #17
0
 internal ImageEditingPropertyHandler(IImagePropertyEditingContext propertyEditingContext, CreateFileCallback createFileCallback, IBlogPostImageEditingContext imageEditingContext)
 {
     _propertyEditingContext = propertyEditingContext;
     _imageInsertHandler     = new ImageInsertHandler();
     _editorContext          = imageEditingContext;
 }
Example #18
0
        internal static void UpdateImageSource(ImagePropertiesInfo imgProperties, IHTMLElement imgElement, IBlogPostImageEditingContext editorContext, ImageInsertHandler imageInsertHandler, ImageDecoratorInvocationSource invocationSource)
        {
            ISupportingFile oldImageFile = null;

            try
            {
                oldImageFile = editorContext.SupportingFileService.GetFileByUri(new Uri((string)imgElement.getAttribute("src", 2)));
            }
            catch (UriFormatException) { }
            if (oldImageFile != null) //then this is a known supporting image file
            {
                using (new WaitCursor())
                {
                    BlogPostImageData imageData = BlogPostImageDataList.LookupImageDataByInlineUri(editorContext.ImageList, oldImageFile.FileUri);
                    if (imageData != null)
                    {
                        //Create a new ImageData object based on the image data attached to the current image src file.
                        BlogPostImageData newImageData = (BlogPostImageData)imageData.Clone();

                        //initialize some handlers for creating files based on the image's existing ISupportingFile objects
                        //This is necessary so that the new image files are recognized as being updates to an existing image
                        //which allows the updates to be re-uploaded back to the same location.
                        CreateImageFileHandler inlineFileCreator = new CreateImageFileHandler(editorContext.SupportingFileService,
                                                                                              newImageData.InlineImageFile != null ? newImageData.InlineImageFile.SupportingFile : null);
                        CreateImageFileHandler linkedFileCreator = new CreateImageFileHandler(editorContext.SupportingFileService,
                                                                                              newImageData.LinkedImageFile != null ? newImageData.LinkedImageFile.SupportingFile : null);

                        //re-write the image files on disk using the latest settings
                        imageInsertHandler.WriteImages(imgProperties, true, invocationSource, new CreateFileCallback(inlineFileCreator.CreateFileCallback), new CreateFileCallback(linkedFileCreator.CreateFileCallback), editorContext.EditorOptions);

                        //update the ImageData file references
                        Size imageSizeWithBorder = imgProperties.InlineImageSizeWithBorder;

                        //force a refresh of the image size values in the DOM by setting the new size attributes
                        imgElement.setAttribute("width", imageSizeWithBorder.Width, 0);
                        imgElement.setAttribute("height", imageSizeWithBorder.Height, 0);

                        newImageData.InlineImageFile.SupportingFile = inlineFileCreator.ImageSupportingFile;
                        newImageData.InlineImageFile.Height         = imageSizeWithBorder.Height;
                        newImageData.InlineImageFile.Width          = imageSizeWithBorder.Width;
                        if (imgProperties.LinkTarget == LinkTargetType.IMAGE)
                        {
                            newImageData.LinkedImageFile = new ImageFileData(linkedFileCreator.ImageSupportingFile, imgProperties.LinkTargetImageSize.Width, imgProperties.LinkTargetImageSize.Height, ImageFileRelationship.Linked);
                        }
                        else
                        {
                            newImageData.LinkedImageFile = null;
                        }

                        //assign the image decorators applied during WriteImages
                        //Note: this is a clone so the sidebar doesn't affect the decorator values for the newImageData image src file
                        newImageData.ImageDecoratorSettings = (BlogPostSettingsBag)imgProperties.ImageDecorators.SettingsBag.Clone();

                        //update the upload settings
                        newImageData.UploadInfo.ImageServiceId = imgProperties.UploadServiceId;

                        //save the new image data in the image list
                        editorContext.ImageList.AddImage(newImageData);
                    }
                    else
                    {
                        Debug.Fail("imageData could not be located");
                    }
                }
            }

            if (imgProperties.LinkTarget == LinkTargetType.NONE)
            {
                imgProperties.RemoveLinkTarget();
            }
        }
        internal static void UpdateImageSource(ImagePropertiesInfo imgProperties, IHTMLElement imgElement, IBlogPostImageEditingContext editorContext, ImageInsertHandler imageInsertHandler, ImageDecoratorInvocationSource invocationSource)
        {
            ISupportingFile oldImageFile = null;
            try
            {
                oldImageFile = editorContext.SupportingFileService.GetFileByUri(new Uri((string)imgElement.getAttribute("src", 2)));
            }
            catch (UriFormatException) { }
            if (oldImageFile != null) //then this is a known supporting image file
            {
                using (new WaitCursor())
                {
                    BlogPostImageData imageData = BlogPostImageDataList.LookupImageDataByInlineUri(editorContext.ImageList, oldImageFile.FileUri);
                    if (imageData != null)
                    {
                        //Create a new ImageData object based on the image data attached to the current image src file.
                        BlogPostImageData newImageData = (BlogPostImageData)imageData.Clone();

                        //initialize some handlers for creating files based on the image's existing ISupportingFile objects
                        //This is necessary so that the new image files are recognized as being updates to an existing image
                        //which allows the updates to be re-uploaded back to the same location.
                        CreateImageFileHandler inlineFileCreator = new CreateImageFileHandler(editorContext.SupportingFileService,
                                                                                              newImageData.InlineImageFile != null ? newImageData.InlineImageFile.SupportingFile : null);
                        CreateImageFileHandler linkedFileCreator = new CreateImageFileHandler(editorContext.SupportingFileService,
                                                                                              newImageData.LinkedImageFile != null ? newImageData.LinkedImageFile.SupportingFile : null);

                        //re-write the image files on disk using the latest settings
                        imageInsertHandler.WriteImages(imgProperties, true, invocationSource, new CreateFileCallback(inlineFileCreator.CreateFileCallback), new CreateFileCallback(linkedFileCreator.CreateFileCallback), editorContext.EditorOptions);

                        //update the ImageData file references
                        Size imageSizeWithBorder = imgProperties.InlineImageSizeWithBorder;

                        //force a refresh of the image size values in the DOM by setting the new size attributes
                        imgElement.setAttribute("width", imageSizeWithBorder.Width, 0);
                        imgElement.setAttribute("height", imageSizeWithBorder.Height, 0);

                        newImageData.InlineImageFile.SupportingFile = inlineFileCreator.ImageSupportingFile;
                        newImageData.InlineImageFile.Height = imageSizeWithBorder.Height;
                        newImageData.InlineImageFile.Width = imageSizeWithBorder.Width;
                        if (imgProperties.LinkTarget == LinkTargetType.IMAGE)
                        {
                            newImageData.LinkedImageFile = new ImageFileData(linkedFileCreator.ImageSupportingFile, imgProperties.LinkTargetImageSize.Width, imgProperties.LinkTargetImageSize.Height, ImageFileRelationship.Linked);
                        }
                        else
                            newImageData.LinkedImageFile = null;

                        //assign the image decorators applied during WriteImages
                        //Note: this is a clone so the sidebar doesn't affect the decorator values for the newImageData image src file
                        newImageData.ImageDecoratorSettings = (BlogPostSettingsBag)imgProperties.ImageDecorators.SettingsBag.Clone();

                        //update the upload settings
                        newImageData.UploadInfo.ImageServiceId = imgProperties.UploadServiceId;

                        //save the new image data in the image list
                        editorContext.ImageList.AddImage(newImageData);
                    }
                    else
                        Debug.Fail("imageData could not be located");
                }
            }

            if (imgProperties.LinkTarget == LinkTargetType.NONE)
            {
                imgProperties.RemoveLinkTarget();
            }
        }
        public static ImagePropertiesInfo GetImagePropertiesInfo(IHTMLImgElement imgElement, IBlogPostImageEditingContext editorContext)
        {
            IHTMLElement imgHtmlElement = (IHTMLElement)imgElement;
            string imgSrc = imgHtmlElement.getAttribute("src", 2) as string;
            BlogPostImageData imageData = null;
            try
            {
                imageData = BlogPostImageDataList.LookupImageDataByInlineUri(editorContext.ImageList, new Uri(imgSrc));
            }
            catch (UriFormatException)
            {
                //this URI is probably relative web URL, so extract the image src letting the
                //DOM fill in the full URL for us based on the base URL.
                imgSrc = imgHtmlElement.getAttribute("src", 0) as string;
            }

            ImagePropertiesInfo info;
            if (imageData != null && imageData.GetImageSourceFile() != null)
            {
                //clone the image data to the sidebar doesn't change it (required for preserving image undo/redo state)
                imageData = (BlogPostImageData)imageData.Clone();
                //this is an attached local image
                info = new BlogPostImagePropertiesInfo(imageData, new ImageDecoratorsList(editorContext.DecoratorsManager, imageData.ImageDecoratorSettings));
                info.ImgElement = imgHtmlElement;
            }
            else
            {
                //this is not an attached local image, so treat as a web image
                ImageDecoratorsList remoteImageDecoratorsList = new ImageDecoratorsList(editorContext.DecoratorsManager, new BlogPostSettingsBag());
                remoteImageDecoratorsList.AddDecorator(editorContext.DecoratorsManager.GetDefaultRemoteImageDecorators());

                //The source image size is unknown, so calculate the actual image size by removing
                //the size attributes, checking the size, and then placing the size attributes back
                string oldHeight = imgHtmlElement.getAttribute("height", 2) as string;
                string oldWidth = imgHtmlElement.getAttribute("width", 2) as string;
                imgHtmlElement.removeAttribute("width", 0);
                imgHtmlElement.removeAttribute("height", 0);
                int width = imgElement.width;
                int height = imgElement.height;

                if (!String.IsNullOrEmpty(oldHeight))
                    imgHtmlElement.setAttribute("height", oldHeight, 0);
                if (!String.IsNullOrEmpty(oldWidth))
                    imgHtmlElement.setAttribute("width", oldWidth, 0);
                Uri infoUri;
                if (Uri.TryCreate(imgSrc, UriKind.Absolute, out infoUri))
                {
                    info = new ImagePropertiesInfo(infoUri, new Size(width, height), remoteImageDecoratorsList);
                }
                else
                {
                    info = new ImagePropertiesInfo(new Uri("http://www.example.com"), new Size(width, height), remoteImageDecoratorsList);
                }
                info.ImgElement = imgHtmlElement;

                // Sets the correct inline image size and image size name for the remote image.
                if (!String.IsNullOrEmpty(oldWidth) && !String.IsNullOrEmpty(oldHeight))
                {
                    int inlineWidth, inlineHeight;
                    if (Int32.TryParse(oldWidth, NumberStyles.Integer, CultureInfo.InvariantCulture, out inlineWidth) &&
                        Int32.TryParse(oldHeight, NumberStyles.Integer, CultureInfo.InvariantCulture, out inlineHeight))
                    {
                        info.InlineImageSize = new Size(inlineWidth, inlineHeight);
                    }
                }

                // Sets the correct border style for the remote image.
                if (new HtmlBorderDecoratorSettings(imgHtmlElement).InheritBorder)
                {
                    if (!info.ImageDecorators.ContainsDecorator(HtmlBorderDecorator.Id))
                        info.ImageDecorators.AddDecorator(HtmlBorderDecorator.Id);
                }
                else if (new NoBorderDecoratorSettings(imgHtmlElement).NoBorder)
                {
                    if (!info.ImageDecorators.ContainsDecorator(NoBorderDecorator.Id))
                        info.ImageDecorators.AddDecorator(NoBorderDecorator.Id);
                }
            }

            //transfer image data properties
            if (imageData != null)
            {
                info.UploadSettings = imageData.UploadInfo.Settings;
                info.UploadServiceId = imageData.UploadInfo.ImageServiceId;
                if (info.UploadServiceId == null)
                {
                    info.UploadServiceId = editorContext.ImageServiceId;
                }
            }

            return info;
        }
 internal ImageEditingPropertyHandler(IImagePropertyEditingContext propertyEditingContext, CreateFileCallback createFileCallback, IBlogPostImageEditingContext imageEditingContext)
 {
     _propertyEditingContext = propertyEditingContext;
     _imageInsertHandler = new ImageInsertHandler();
     _editorContext = imageEditingContext;
 }
 public HtmlSourceEditorControl(ISpellingChecker spellingChecker, CommandManager commandManager, IBlogPostImageEditingContext editingContext)
     : base(spellingChecker, commandManager)
 {
     this.editingContext = editingContext;
 }
        public EmoticonsManager(IBlogPostImageEditingContext imageEditingContext, IEditingMode editingModeContext)
        {
            _imageEditingContext = imageEditingContext;
            _editingModeContext = editingModeContext;
            _recentEmoticons = RetrieveRecentEmoticons();
            _inlineImageUriTable = new Dictionary<Emoticon, Uri>();

            // This is a DEBUG only call.
            AssertEmoticonsManagerSetupCorrectly();
        }
Example #24
0
 //ToDo: OLW Spell Checker
 //public HtmlSourceEditorControl(ISpellingChecker spellingChecker, CommandManager commandManager, IBlogPostImageEditingContext editingContext)
 //    : base(spellingChecker, commandManager)
 public HtmlSourceEditorControl(CommandManager commandManager, IBlogPostImageEditingContext editingContext)
     : base(commandManager)
 {
     this.editingContext = editingContext;
 }
 //ToDo: OLW Spell Checker
 //public HtmlSourceEditorControl(ISpellingChecker spellingChecker, CommandManager commandManager, IBlogPostImageEditingContext editingContext)
 //    : base(spellingChecker, commandManager)
 public HtmlSourceEditorControl(CommandManager commandManager, IBlogPostImageEditingContext editingContext)
     : base(commandManager)
 {
     this.editingContext = editingContext;
 }
Example #26
0
 public EmoticonsGalleryCommand(CommandId commandId, IBlogPostImageEditingContext imageEditingContext)
     : base(commandId, false)
 {
     AllowSelection       = false;
     _imageEditingContext = imageEditingContext;
 }