private void SetInitialValues()
        {
            StyleUIHelper helper = new StyleUIHelper(this.context.Owner);

            this.initialProperties = new ParagraphPropertiesDialogInfo();
            this.initialProperties.TextAlignment = helper.GetTextAlignmentOfParagraphStyle();

            this.initialProperties.AutomaticSpacingBefore = helper.GetAutomaticSpacingBeforeOfParagraphStyle();
            this.initialProperties.AutomaticSpacingAfter  = helper.GetAutomaticSpacingAfterOfParagraphStyle();

            this.initialProperties.LineSpacing     = helper.GetLineSpacingOfParagraphStyle();
            this.initialProperties.LineSpacingType = helper.GetLineSpacingTypeOfParagraphStyle();
            this.initialLineSpacingDialogType      = this.GetLineSpacingDialogType(initialProperties.LineSpacingType, initialProperties.LineSpacing);
            this.initialProperties.Background      = helper.GetBackgroundOfParagraphStyle();
            this.initialProperties.FlowDirection   = helper.GetFlowDirectionOfParagraphStyle();

            double?spacingBefore = helper.GetSpacingBeforeOfParagraphStyle();

            if (spacingBefore.HasValue)
            {
                this.initialProperties.SpacingBefore = spacingBefore.Value;
            }

            double?spacingAfter = helper.GetSpacingAfterOfParagraphStyle();

            if (spacingAfter.HasValue)
            {
                this.initialProperties.SpacingAfter = spacingAfter.Value;
            }

            double?rightIndent = helper.GetRightIndentOfParagraphStyle();

            if (rightIndent.HasValue)
            {
                this.initialProperties.RightIndent = rightIndent.Value;
            }

            double?firstLineIndent = helper.GetFirstLineIndentOfParagraphStyle();

            if (firstLineIndent.HasValue)
            {
                this.initialProperties.FirstLineIndent = firstLineIndent.Value;
            }

            double?leftIndent = helper.GetLeftIndentOfParagraphStyle();

            if (leftIndent.HasValue)
            {
                this.initialProperties.LeftIndent = leftIndent.Value;
            }
        }
Example #2
0
        private void ShowDialogInternal(StyleDefinition defaultStyle, Action <StyleDefinition> applyCallback, RadRichTextBox owner)
        {
            this.defaultStyle  = defaultStyle;
            this.applyCallback = applyCallback;
            this.SetOwner(owner);
            StyleUIHelper helper = new StyleUIHelper(owner);

            FontFamily fontFamily     = helper.GetFontFamilyOfSpanStyle();
            double?    fontSize       = helper.GetFontSizeOfSpanStyle();
            Color?     foreColor      = helper.GetForeColorOfSpanStyle();
            Color?     highlightColor = helper.GetHighlightColorOfSpanStyle();
            IUnderlineUIDecorationProvider underlineDecoration = helper.GetUnderlineDecoration();
            BaselineAlignment?baselineAlignment = helper.GetBaselineAlignment();
            FontWeight?       fontWeight        = helper.GetFontWeightOfSpanStyle();
            FontStyle?        fontStyle         = helper.GetFontStyleOfSpanStyle();
            bool?strikeThrough = helper.GetStrikeThroughOfSpanStyle();

            this.SetInitialValues(fontFamily, fontSize, foreColor, highlightColor, fontWeight, fontStyle, underlineDecoration, strikeThrough, baselineAlignment);
            this.SetFontPropertiesDialog(fontFamily, fontSize, foreColor, highlightColor, underlineDecoration, baselineAlignment, fontWeight, fontStyle, strikeThrough);

            this.ShowDialog();
        }
        private void UpdateItemsSelectedStates(RadRadialMenu radialMenu)
        {
            StyleUIHelper helper = new StyleUIHelper(this.Editor);
            var boldRadialMenuItem = radialMenu.Items.FirstOrDefault(i => i.Header.ToString() == "Bold");
            if (boldRadialMenuItem != null)
            {
                FontWeight? fontWeight = helper.GetFontWeightOfSpanStyle();
                var isBold = fontWeight.HasValue && fontWeight.Value == FontWeights.Bold;
                boldRadialMenuItem.IsSelected = isBold;
            }

            var textAlignmentRadialMenuItem = radialMenu.Items.FirstOrDefault(i => i.Header.ToString() == "Alignment");
            if (textAlignmentRadialMenuItem != null)
            {
                RadTextAlignment? textAlignment = helper.GetTextAlignmentOfParagraphStyle();
                foreach (var item in textAlignmentRadialMenuItem.ChildItems)
                {
                    if (item.Header.ToString() == textAlignment.ToString())
                    {
                        item.IsSelected = true;
                    }
                    else
                    {
                        item.IsSelected = false;
                    }
                }
            }
        }
        private void SetInitialValues()
        {
            StyleUIHelper helper = new StyleUIHelper(this.context.Owner);

            this.initialProperties = new ParagraphPropertiesDialogInfo();
            this.initialProperties.TextAlignment = helper.GetTextAlignmentOfParagraphStyle();

            this.initialProperties.AutomaticSpacingBefore = helper.GetAutomaticSpacingBeforeOfParagraphStyle();
            this.initialProperties.AutomaticSpacingAfter = helper.GetAutomaticSpacingAfterOfParagraphStyle();

            this.initialProperties.LineSpacing = helper.GetLineSpacingOfParagraphStyle();
            this.initialProperties.LineSpacingType = helper.GetLineSpacingTypeOfParagraphStyle();
            this.initialLineSpacingDialogType = this.GetLineSpacingDialogType(initialProperties.LineSpacingType, initialProperties.LineSpacing);
            this.initialProperties.Background = helper.GetBackgroundOfParagraphStyle();
            this.initialProperties.FlowDirection = helper.GetFlowDirectionOfParagraphStyle();

            double? spacingBefore = helper.GetSpacingBeforeOfParagraphStyle();
            if (spacingBefore.HasValue)
            {
                this.initialProperties.SpacingBefore = spacingBefore.Value;
            }

            double? spacingAfter = helper.GetSpacingAfterOfParagraphStyle();
            if (spacingAfter.HasValue)
            {
                this.initialProperties.SpacingAfter = spacingAfter.Value;
            }

            double? rightIndent = helper.GetRightIndentOfParagraphStyle();
            if (rightIndent.HasValue)
            {
                this.initialProperties.RightIndent = rightIndent.Value;
            }

            double? firstLineIndent = helper.GetFirstLineIndentOfParagraphStyle();
            if (firstLineIndent.HasValue)
            {
                this.initialProperties.FirstLineIndent = firstLineIndent.Value;
            }

            double? leftIndent = helper.GetLeftIndentOfParagraphStyle();
            if (leftIndent.HasValue)
            {
                this.initialProperties.LeftIndent = leftIndent.Value;
            }
        }