private Inline CreateInlineToInsert()
        {
            Inline result;
            ImageInline imageInline = new ImageInline(this.originalImageInline);
            WrappingStyle? style = this.textWrappingProperties.GetWrappingStyle();

            if (style == null)
            {
                //create image inline
                result = imageInline;
            }
            else
            {
                FloatingImageBlock imageBlock = new FloatingImageBlock();
                imageBlock.ImageInline = imageInline;

                imageBlock.WrappingStyle = style.Value;
                imageBlock.TextWrap = this.textWrappingProperties.GetTextWrap();
                imageBlock.Margin = this.textWrappingProperties.GetMargin();
                imageBlock.VerticalPosition = this.positionProperties.GetVerticalPosition();
                imageBlock.HorizontalPosition = this.positionProperties.GetHorizontalPosition();
                imageBlock.AllowOverlap = this.positionProperties.GetAllowOverlap();

                result = imageBlock;
            }

            return result;
        }
        private void OK_Click(object sender, RoutedEventArgs e)
        {
            if (this.replaceCurrentImageCallback != null)
            {
                this.ImageEditorUI.ImageEditor.CommitTool();
                Inline reslut;
                ImageInline image = new ImageInline(this.ImageEditorUI.Image.Bitmap);
                image.CopyPropertiesFrom(this.originalImageInline);

                image.Size = new Size(image.Width * this.originalAspect.Width, image.Height * this.originalAspect.Height);
                if (this.isRotated)
                {
                    image.Size = new Size(image.Size.Height, image.Size.Width);
                }
                image.RotateAngle = this.originalRotateAngle;

                if (this.originalInline is FloatingImageBlock)
                {
                    FloatingImageBlock imageBlock = new FloatingImageBlock();
                    imageBlock.CopyPropertiesFrom(this.originalInline);
                    imageBlock.ImageInline = image;
                    reslut = imageBlock;
                }
                else
                {
                    reslut = image;
                }

                this.replaceCurrentImageCallback(this.originalInline, reslut);
            }

            this.Close();
        }