Exemplo n.º 1
0
        protected virtual void DoSetDefaultParagraph(ParagraphStyleOptions options)
        {
            var book = options?.Book?.Document ?? Document;

            using (new UsingProcessor(() => book.BeginUpdate(), () => book.EndUpdate()))
                SetParagraphOptions(book.DefaultParagraphProperties, options);
        }
Exemplo n.º 2
0
 public SCBook SetDefaultParagraph(ParagraphStyleOptions options)
 {
     ExecuteSynchronized(options, () => DoSetDefaultParagraph(options));
     return(this);
 }
        protected virtual void SetParagraphOptions(ParagraphPropertiesBase style, ParagraphStyleOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options), "Options are not provided.");
            }

            if (style is CharacterPropertiesBase characterStyle)
            {
                this.SetCharacterOptions(characterStyle, options);
            }

            if (options.Alignment.HasValue)
            {
                style.Alignment = (DevExpress.XtraRichEdit.API.Native.ParagraphAlignment)options.Alignment.Value;
            }

            if (options.ContextualSpacing.HasValue)
            {
                style.ContextualSpacing = options.ContextualSpacing.Value;
            }

            if (options.FirstLineIdent.HasValue)
            {
                style.FirstLineIndent = options.FirstLineIdent.Value;
            }
            if (options.FirstLineIndentType.HasValue)
            {
                style.FirstLineIndentType = (DevExpress.XtraRichEdit.API.Native.ParagraphFirstLineIndent)options.FirstLineIndentType.Value;
            }

            if (options.KeepLinesTogether.HasValue)
            {
                style.KeepLinesTogether = options.KeepLinesTogether.Value;
            }

            if (options.KeepWithNext.HasValue)
            {
                style.KeepWithNext = options.KeepWithNext.Value;
            }

            if (options.LeftIndent.HasValue)
            {
                style.LeftIndent = options.LeftIndent.Value;
            }

            if (options.LineSpacing.HasValue)
            {
                style.LineSpacing = options.LineSpacing.Value;
            }

            if (options.LineSpacingMultiplier.HasValue)
            {
                style.LineSpacingMultiplier = options.LineSpacingMultiplier.Value;
            }

            if (options.LineSpacingType.HasValue)
            {
                style.LineSpacingType = (DevExpress.XtraRichEdit.API.Native.ParagraphLineSpacing)options.LineSpacingType.Value;
            }

            if (options.NumberingListIndex.HasValue && style is ParagraphStyle paragraphStyle)
            {
                paragraphStyle.NumberingListIndex = options.NumberingListIndex.Value;
            }

            if (options.OutlineLevel.HasValue)
            {
                style.OutlineLevel = options.OutlineLevel;
            }

            if (options.PageBreakBefore.HasValue)
            {
                style.PageBreakBefore = options.PageBreakBefore.Value;
            }

            if (options.RightIndent.HasValue)
            {
                style.RightIndent = options.RightIndent.Value;
            }

            if (options.RightToLeft.HasValue)
            {
                style.RightToLeft = options.RightToLeft.Value;
            }

            if (options.SpacingAfter.HasValue)
            {
                style.SpacingAfter = options.SpacingAfter.Value;
            }
            if (options.SpacingBefore.HasValue)
            {
                style.SpacingBefore = options.SpacingBefore.Value;
            }

            if (options.SuppressHyphenation.HasValue)
            {
                style.SuppressHyphenation = options.SuppressHyphenation.Value;
            }

            if (options.SuppressLineNumbers.HasValue)
            {
                style.SuppressLineNumbers = options.SuppressLineNumbers.Value;
            }

            if (options.WidowOrphanControl.HasValue)
            {
                style.WidowOrphanControl = options.WidowOrphanControl.Value;
            }
        }