/// <summary>
            /// constructor
            /// </summary>
            /// <param name="styleNode"></param>
            /// <param name="nsm"></param>
            /// <param name="styles"></param>
            public StyleDefinition(XmlNode styleNode, XmlNamespaceManager nsm, Dictionary <string, StyleDefinition> styles)
            {
                m_Name = getAttributeValue(styleNode.ParentNode.ParentNode, "w:styleId");
                XmlNode child = styleNode.ParentNode.ParentNode.SelectSingleNode("./w:basedOn", nsm);

                m_LevelId = "0";
                m_NumId   = null;
                if (child != null)
                {
                    string basedOnName = getAttributeValue(child, ValAttrName);
                    if (styles.ContainsKey(basedOnName))
                    {
                        StyleDefinition basedOn = styles[basedOnName];
                        if (basedOn != null)
                        {
                            m_LevelId = basedOn.m_LevelId;
                            m_NumId   = basedOn.m_NumId;
                        }
                    }
                }
                child = styleNode.SelectSingleNode("./w:ilvl", nsm);
                if (child != null)
                {
                    m_LevelId = getAttributeValue(child, ValAttrName);
                }
                child = styleNode.SelectSingleNode("./w:numId", nsm);
                if (child != null)
                {
                    m_NumId = getAttributeValue(child, ValAttrName);
                }
            }
コード例 #2
0
ファイル: RichTextBox.cs プロジェクト: astorch/motoi
        /// <summary> Is invoked when the style definition has been changed. </summary>
        /// <param name="styleDefinition">New style definition</param>
        private void OnStyleDefinitionChanged(StyleDefinition styleDefinition)
        {
            if (styleDefinition == null)
            {
                return;
            }

            string styleName = styleDefinition.StyleName;

            byte[] styleData = styleDefinition.StyleData;
            if (styleData == null || styleData.Length == 0)
            {
                return;
            }

            // Convert style data to XML document
            XmlDocument xmlDocument = new XmlDocument();

            using (BufferedStream bufferedStream = new BufferedStream(new MemoryStream(styleData))) {
                xmlDocument.Load(bufferedStream);
            }

            // Register and apply style
            SyntaxHighlighter.AddXmlDescription(styleName, xmlDocument);
            DescriptionFile = styleName;

            // Force refresh
            SyntaxHighlighter.HighlightSyntax(styleName, Range);
        }
コード例 #3
0
 private static ComputedStyles Style(StyleDefinition definition)
 {
     return(Globals.UiStyles.StyleResolver.Resolve(new[]
     {
         definition
     }));
 }
コード例 #4
0
        private void SetFontWeightAndStyleToStyleDefinitionToApply(StyleDefinition result)
        {
            if (this.fontStyleListBox.SelectedValue != null && (DialogFontStyle)this.fontStyleListBox.SelectedValue != this.initialDialogFontStyle)
            {
                DialogFontStyle dialogFontStyle = (DialogFontStyle)this.fontStyleListBox.SelectedValue;
                switch (dialogFontStyle)
                {
                case DialogFontStyle.Regular:
                    result.SetPropertyValue(Span.FontStyleProperty, FontStyles.Normal);
                    result.SetPropertyValue(Span.FontWeightProperty, FontWeights.Normal);
                    break;

                case DialogFontStyle.Italic:
                    result.SetPropertyValue(Span.FontStyleProperty, FontStyles.Italic);
                    result.SetPropertyValue(Span.FontWeightProperty, FontWeights.Normal);
                    break;

                case DialogFontStyle.Bold:
                    result.SetPropertyValue(Span.FontStyleProperty, FontStyles.Normal);
                    result.SetPropertyValue(Span.FontWeightProperty, FontWeights.Bold);
                    break;

                case DialogFontStyle.BoldItalic:
                    result.SetPropertyValue(Span.FontStyleProperty, FontStyles.Italic);
                    result.SetPropertyValue(Span.FontWeightProperty, FontWeights.Bold);
                    break;

                default:
                    break;
                }
            }
        }
コード例 #5
0
        private void InitializeCurrentFontStyles(StyleDefinition styleDefinition)
        {
            UnderlineType underlineType = (UnderlineType)styleDefinition.GetPropertyValue(Span.UnderlineTypeProperty);

            this.radBtnUnderlineStyle.ToggleState = underlineType != UnderlineType.None ? ToggleState.On : ToggleState.Off;

            string fontFamiliy = (string)styleDefinition.GetPropertyValue(Span.FontFamilyProperty);

            this.radDropDownListFont.SuspendSelectionEvents = true;
            this.radDropDownListFont.Text                   = fontFamiliy;
            this.radDropDownListFont.SelectedValue          = fontFamiliy;
            this.radDropDownListFont.SuspendSelectionEvents = false;

            float fontSize = (float)styleDefinition.GetPropertyValue(Span.FontSizeProperty);

            fontSize = (float)Math.Round(Unit.DipToPoint(fontSize), 1);
            this.EnsureFontSize(fontSize.ToString());

            TextStyle fontStyle = (TextStyle)styleDefinition.GetPropertyValue(Span.FontStyleProperty);

            this.radBtnBoldStyle.ToggleState   = fontStyle.HasFlag(TextStyle.Bold) ? ToggleState.On : ToggleState.Off;
            this.radBtnItalicStyle.ToggleState = fontStyle.HasFlag(TextStyle.Italic) ? ToggleState.On : ToggleState.Off;

            bool strikeThrough = (bool)styleDefinition.GetPropertyValue(Span.StrikethroughProperty);

            this.radBtnStrikethrough.ToggleState = strikeThrough ? ToggleState.On : ToggleState.Off;
        }
コード例 #6
0
 private void RefreshVisualStyle()
 {
     m_styleDef = GetVisualStyle(VisualStyle);
     RowHeight  = m_styleDef.RowHeight;
     TextScale  = m_styleDef.TextScale;
     RefreshInternals();
 }
コード例 #7
0
        /// <summary>
        /// The value of pre-cascade property has changed
        /// </summary>
        /// <param name="Stage"></param>
        /// <param name="Property"></param>
        private void Property_onChanged(EPropertyStage Stage, ICssProperty Property)
        {
            SetProperties.SetFlag(Property.CssName.Value, Property.HasValue);

            /*if (!Property.HasValue) SetProperties.Remove(Property.CssName);
             * else SetProperties.Add(Property.CssName);*/

            if (Property.CssName is null)
            {
                throw new Exception($"Cannot fire onChange events for unnamed property! (Name: {Property.CssName}");
            }
            StyleDefinition def = CssDefinitions.StyleDefinitions[Property.CssName];

            if (def is null)
            {
                throw new Exception($"Cannot find a definition for Css property: \"{Property.CssName}\"");
            }

            EPropertyDirtFlags Flags = def.Flags;
            StackTrace         Stack = null;

#if DEBUG
            //stack = new StackTrace(STACK_FRAME_OFFSET, true);
#endif
            Property_Changed?.Invoke(Stage, Property, Flags, Stack);
        }
        private void SetParagraphSpacings(StyleDefinition result)
        {
            if (this.radNumSpacingBefore.Value.HasValue)
            {
                double spacingBefore = Unit.PointToDip(this.radNumSpacingBefore.Value.Value);
                if (spacingBefore != this.initialProperties.SpacingBefore)
                {
                    result.SetPropertyValue(Paragraph.SpacingBeforeProperty, spacingBefore);
                }
            }

            if (this.radNumSpacingAfter.Value.HasValue)
            {
                double spacingAfter = Unit.PointToDip(this.radNumSpacingAfter.Value.Value);
                if (spacingAfter != this.initialProperties.SpacingAfter)
                {
                    result.SetPropertyValue(Paragraph.SpacingAfterProperty, spacingAfter);
                }
            }

            bool?automaticSpacingBefore = this.checkBoxAutomaticSpacingBefore.IsChecked;

            if (automaticSpacingBefore.HasValue && this.checkBoxAutomaticSpacingBefore.IsChecked != this.initialProperties.AutomaticSpacingBefore)
            {
                result.SetPropertyValue(Paragraph.AutomaticSpacingBeforeProperty, automaticSpacingBefore.Value);
            }

            bool?automaticSpacingAfter = this.checkBoxAutomaticSpacingAfter.IsChecked;

            if (automaticSpacingAfter.HasValue && automaticSpacingAfter != this.initialProperties.AutomaticSpacingAfter)
            {
                result.SetPropertyValue(Paragraph.AutomaticSpacingAfterProperty, automaticSpacingAfter);
            }
        }
 private void SetTextAlignment(StyleDefinition result)
 {
     if (comboAligment.SelectedValue != null && (RadTextAlignment)comboAligment.SelectedValue != this.initialProperties.TextAlignment)
     {
         result.SetPropertyValue(Paragraph.TextAlignmentProperty, (RadTextAlignment)comboAligment.SelectedValue);
     }
 }
コード例 #10
0
 private void RefreshVisualStyle()
 {
     m_styleDef = GetVisualStyle(VisualStyle);
     ItemSize   = m_styleDef.ItemSize;
     TextScale  = m_styleDef.TextScale;
     RefreshInternals();
 }
        private void DefaultButton_Click(object sender, RoutedEventArgs e)
        {
            ParagraphProperties paragraphProperties = new StyleDefinition(StyleType.Paragraph).ParagraphProperties;

            ParagraphPropertiesDialogInfo propertiesInfo = new ParagraphPropertiesDialogInfo()
            {
                TextAlignment          = paragraphProperties.TextAlignment,
                SpacingBefore          = paragraphProperties.SpacingBefore,
                SpacingAfter           = paragraphProperties.SpacingAfter,
                AutomaticSpacingBefore = paragraphProperties.AutomaticSpacingBefore,
                AutomaticSpacingAfter  = paragraphProperties.AutomaticSpacingAfter,
                LineSpacingType        = paragraphProperties.LineSpacingType,
                LineSpacing            = paragraphProperties.LineSpacing,
                Background             = paragraphProperties.Background,
                FlowDirection          = paragraphProperties.FlowDirection,
                RightIndent            = paragraphProperties.RightIndent,
                FirstLineIndent        = paragraphProperties.FirstLineIndent,
                LeftIndent             = paragraphProperties.LeftIndent
            };

            this.UpdateUICore(propertiesInfo);
            // When multiple paragraphs with different backgrounds are selected,
            // the initial value is the default one and this prevents ColorChanged event to be fired.
            // Thus, we need to set this flag manually.
            this.isBackgroundChanged = true;
        }
コード例 #12
0
 public StylesTreeItem(StyleDefinition definition) : this()
 {
     _styleRebuildedString = definition.RebuildFromParsedValuesRepository();
     _musicGenresIdxs      = definition.MusicTypesIdxs;
     _subStylesIdxs        = definition.MainStylesIdxs;
     _styleAlterationsIdxs = definition.StyleAlterationsIdxs;
 }
コード例 #13
0
        public void ApplyLayerStyle(RasterizeLayer layer, RasterizeLayerStyleDefinition layerStyleDef)
        {
            switch (layer)
            {
            case RasterizeLayer.OuterGlow:
                StyleDefinition.OuterGlow = layerStyleDef;
                break;

            case RasterizeLayer.InnerGlow:
                StyleDefinition.InnerGlow = layerStyleDef;
                break;

            case RasterizeLayer.Foreground:
                StyleDefinition.Foreground = layerStyleDef;
                break;

            case RasterizeLayer.Background:
                StyleDefinition.Background = layerStyleDef;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(layer), layer, null);
            }
            Style = StyleDefinition.Scale(Dim.SvgScale);
        }
コード例 #14
0
        public void LoadStyle(StyleDefinition style)
        {
            if (fontProvider != null)
            {
                fontProvider.palette = style.fontPalette;
            }
            if (fontSizeProvider != null)
            {
                fontSizeProvider.palette = style.fontSizePalette;
            }
            if (layoutElementSettingsProvider != null)
            {
                layoutElementSettingsProvider.palette = style.layoutSettingsPalette;
            }
            if (loadGroupSettings)
            {
                if (layoutGroupSettingsProvider != null)
                {
                    layoutGroupSettingsProvider.palette = style.layoutGroupSettingsPalette;
                }
            }



            Debug.Log("loaded style set " + style.name);
#if UNITY_EDITOR
            //  UnityEditor.EditorApplication.delayCall += UnityEditor.EditorApplication.RepaintHierarchyWindow;
            //EditorWindow view = EditorWindow.GetWindow<SceneView>();
            UnityEditor.EditorApplication.delayCall += Resubscribe;
            //view.Repaint();
#endif
        }
コード例 #15
0
 public Response <StyleDefinition> UpdateStyle([FromBody] StyleDefinition style)
 {
     return(GetResponse(() =>
     {
         return new EditorService(User).UpdateStyle(style);
     }));
 }
コード例 #16
0
 public void ApplyStyle(StyleDefinition style)
 {
     if (style != null)
     {
         m_styleDef = style;
         RefreshInternals();
     }
 }
コード例 #17
0
        public StyleDefinition UpdateStyle(StyleDefinition style)
        {
            var dbStyle = Mapper.Map <DAL.Models.Style>(style);

            dbStyle = DbEditorService.UpdateStyle(dbStyle);

            return(Mapper.Map <UI.StyleDefinition>(dbStyle));
        }
コード例 #18
0
 public StylesTreeItem(StyleDefinition definition)
     : this()
 {
     _styleRebuildedString = definition.RebuildFromParsedValuesRepository();
     _musicGenresIdxs = definition.MusicTypesIdxs;
     _subStylesIdxs = definition.MainStylesIdxs;
     _styleAlterationsIdxs = definition.StyleAlterationsIdxs;
 }
コード例 #19
0
 private void SetPropertyToStyleDefinitionIfDifferent <T, V>(StyleDefinition result, StylePropertyDefinition <T, V> stylePropertyDefinition, T valueToSet, T valueToCompare)
     where V : DocumentElementPropertiesBase
 {
     if (valueToSet != null && !valueToSet.Equals(valueToCompare))
     {
         result.SetPropertyValue(stylePropertyDefinition, valueToSet);
     }
 }
コード例 #20
0
        public void AddNewStyle(StyleDefinition definition, string styleOriginalString)
        {
            var newStyle = new RealStylesTreeItem(definition, styleOriginalString);

            ComputeParents(newStyle);

            CreateOrUpdateStylesTreeItem(newStyle);
        }
コード例 #21
0
        public void AddNewStyle(StyleDefinition definition, string styleOriginalString)
        {
            var newStyle = new RealStylesTreeItem(definition, styleOriginalString);

            ComputeParents(newStyle);

            CreateOrUpdateStylesTreeItem(newStyle);
        }
コード例 #22
0
        private void RefreshVisualStyle()
        {
            if (m_visualStyle != MyGuiControlRadioButtonStyleEnum.Custom)
            {
                m_styleDef = GetVisualStyle(VisualStyle);
            }

            RefreshInternals();
        }
コード例 #23
0
 private void RefreshVisualStyle()
 {
     m_styleDef      = GetVisualStyle(VisualStyle);
     m_itemMargin    = m_styleDef.ItemMargin;
     m_showScrollbar = m_styleDef.ScrollbarEnabled;
     MinSize         = m_styleDef.Texture.MinSizeGui;
     MaxSize         = m_styleDef.Texture.MaxSizeGui;
     RefreshInternals();
 }
        private void SetFlowDirection(StyleDefinition result)
        {
            FlowDirection?flowDirection = this.GetFlowDirection();

            if (flowDirection.HasValue && flowDirection != this.initialProperties.FlowDirection)
            {
                result.SetPropertyValue(Paragraph.FlowDirectionProperty, flowDirection);
            }
        }
        private void SetBackground(StyleDefinition result)
        {
            Color backgroundColor = paragraphBackgroundColorSelector.SelectedColor;

            if (backgroundColor != this.initialProperties.Background && this.isBackgroundChanged)
            {
                result.SetPropertyValue(Paragraph.BackgroundProperty, backgroundColor);
            }
        }
コード例 #26
0
        private string[] GetStyle()
        {
            var def = new StyleDefinition()
            {
                BackgroundColor = "success"
            };

            return(def.GetPropertiesAsArray());
        }
コード例 #27
0
 /// <summary>
 /// Hilfsmethode zum Hinzufügen eines aktuell definierten Stils
 /// </summary>
 /// <param name="StyleKey"></param>
 /// <param name="Value"></param>
 /// <param name="IsInheritable"></param>
 void SetStyle(StyleKeys StyleKey, CssMeasure Value, bool IsInheritable)
 {
     CurrentStyles[StyleKey] = new StyleDefinition()
     {
         Key           = StyleKey,
         IsInheritable = IsInheritable,
         MeasuredValue = Value
     };
 }
コード例 #28
0
        private StyleDefinition GetDefinition()
        {
            var def =  new StyleDefinition(_musicGenresIdxs, _subStylesIdxs);
            foreach(var styleAlterationIdx in _styleAlterationsIdxs)
            {
                def.AddStyleAlterationIdx(styleAlterationIdx);
            }

            return def;
        }
コード例 #29
0
        public void AddDefinition(StyleDefinition definition)
        {
            foreach (var container in definition.Containers)
            {
                var selector = container.GetSelector();

                var selectorIndex = GetSelectorIndex(selector);

                UpdateSetters(selectorIndex, container);
            }
        }
        private void Apply_Click(object sender, RoutedEventArgs e)
        {
            StyleDefinition newStyle = this.GetParagraphStyleInfo();

            if (this.applyCallback != null)
            {
                this.applyCallback(newStyle);
            }

            this.Close();
        }
コード例 #31
0
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;
            StyleDefinition style = GetStyleDefinitionToApply();

            if (applyCallback != null)
            {
                applyCallback(style);
            }
            this.Close();
        }
コード例 #32
0
 private void SetFontSizeToStyleDefinitionToApply(StyleDefinition result)
 {
     if (fontSizeListBox.SelectedItem as double? != this.initialFontSize)
     {
         double fontsize;
         if (double.TryParse(this.fontSizeTextBox.Text, out fontsize))
         {
             result.SetPropertyValue(Span.FontSizeProperty, Unit.PointToDip(fontsize));
         }
     }
 }
コード例 #33
0
        private StyleDefinition GetDefinition()
        {
            var def = new StyleDefinition(_musicGenresIdxs, _subStylesIdxs);

            foreach (var styleAlterationIdx in _styleAlterationsIdxs)
            {
                def.AddStyleAlterationIdx(styleAlterationIdx);
            }

            return(def);
        }
コード例 #34
0
        private void AddTagger(RadDocument document)
        {
            CodeLanguage vbCodeLanguage = new CodeLanguage("VB");

            RegexTagger vbRegexTagger = MainWindow.GetVbTagger();

            document.CodeFormatter.RegisterCodeLanguage(vbCodeLanguage, vbRegexTagger);

            StyleDefinition vbKeywordStyle = new StyleDefinition("vbKeywordStyle", StyleType.Character);
            vbKeywordStyle.SpanProperties.ForeColor = Colors.Orange;

            document.CodeFormatter.RegisterClassificationType(ClassificationTypes.Keyword, vbCodeLanguage, vbKeywordStyle);
        }
コード例 #35
0
 public void ApplyStyle(StyleDefinition style)
 {
     m_styleDefinition = style;
     RefreshInternals();
 }
コード例 #36
0
        private void UpdateUI(StyleDefinition paragraphStyle)
        {
            this.comboAligment.SelectedValue = (RadTextAlignment)paragraphStyle.GetPropertyValue(Paragraph.TextAlignmentProperty);

            this.radNumSpacingBefore.Value = Unit.DipToPoint(((double?)paragraphStyle.GetPropertyValue(Paragraph.SpacingBeforeProperty)).Value);
            this.radNumSpacingAfter.Value = Unit.DipToPoint(((double?)paragraphStyle.GetPropertyValue(Paragraph.SpacingAfterProperty)).Value);

            this.checkBoxAutomaticSpacingBefore.IsChecked = ((bool?)paragraphStyle.GetPropertyValue(Paragraph.AutomaticSpacingBeforeProperty)).Value;
            this.checkBoxAutomaticSpacingAfter.IsChecked = ((bool?)paragraphStyle.GetPropertyValue(Paragraph.AutomaticSpacingAfterProperty)).Value;

            double leftIndent = Unit.DipToPoint(((double?)paragraphStyle.GetPropertyValue(Paragraph.LeftIndentProperty)).Value);
            this.radNumRightIndent.Value = Unit.DipToPoint(((double?)paragraphStyle.GetPropertyValue(Paragraph.RightIndentProperty)).Value);

            LineSpacingType lineSpacingType = ((LineSpacingType?)paragraphStyle.GetPropertyValue(Paragraph.LineSpacingTypeProperty)).Value;
            double lineSpacingValue = ((double?)paragraphStyle.GetPropertyValue(Paragraph.LineSpacingProperty)).Value;

            this.UpdateLineSpacingUI(lineSpacingType, lineSpacingValue);

            this.paragraphBackgroundColorSelector.SelectedColor = (Color)paragraphStyle.GetPropertyValue(Paragraph.BackgroundProperty);

            this.SetFlowDirection((FlowDirection)paragraphStyle.GetPropertyValue(Paragraph.FlowDirectionProperty));

            double firstIndentValue = Unit.DipToPoint(((double?)paragraphStyle.GetPropertyValue(Paragraph.FirstLineIndentProperty)).Value);

            // < 0 is hanging; 
            // > 0 is first line; 
            // 0 is none;
            if (firstIndentValue > 0)
            {
                this.radNumFirstIndent.Value = firstIndentValue;
                this.comboFirstIndentType.SelectedItem = this.firstLineIndentTypes[FirstLineIndentDialogTypes.FirstLine];
            }
            else if (firstIndentValue < 0)
            {
                this.comboFirstIndentType.SelectedItem = this.firstLineIndentTypes[FirstLineIndentDialogTypes.Hanging];
                leftIndent += firstIndentValue;
                this.radNumFirstIndent.Value = -firstIndentValue;
            }
            else
            {
                this.comboFirstIndentType.SelectedItem = this.firstLineIndentTypes[FirstLineIndentDialogTypes.None];
            }

            this.radNumLeftIndent.Value = leftIndent;
        }
コード例 #37
0
 public void ApplyStyle(StyleDefinition style)
 {
     m_useCustomStyle = true;
     m_customStyle = style;
     RefreshVisualStyle();
 }
コード例 #38
0
 private void RefreshVisualStyle()
 {
     m_styleDef = GetVisualStyle(VisualStyle);
     BackgroundTexture = m_styleDef.BackgroundTexture;
     ItemSize = m_styleDef.ItemTexture.SizeGui;
     m_itemStep = ItemSize + m_styleDef.ItemMargin.MarginStep;
     ItemTextScale = m_styleDef.ItemTextScale;
     BorderEnabled = m_styleDef.BorderEnabled;
     BorderColor = m_styleDef.BorderColor;
     if (!m_styleDef.FitSizeToItems)
         Size = m_styleDef.SizeOverride ?? BackgroundTexture.MinSizeGui;
     RefreshInternals();
 }
コード例 #39
0
 public void ApplyStyle(StyleDefinition style)
 {
     if (style != null)
     {
         m_styleDef = style;
         RefreshInternals();
     }
 }
コード例 #40
0
        private void DefaultButton_Click(object sender, RoutedEventArgs e)
        {
            ParagraphProperties paragraphProperties = new StyleDefinition(StyleType.Paragraph).ParagraphProperties;

            ParagraphPropertiesDialogInfo propertiesInfo = new ParagraphPropertiesDialogInfo()
            {
                TextAlignment = paragraphProperties.TextAlignment,
                SpacingBefore = paragraphProperties.SpacingBefore,
                SpacingAfter = paragraphProperties.SpacingAfter,
                AutomaticSpacingBefore = paragraphProperties.AutomaticSpacingBefore,
                AutomaticSpacingAfter = paragraphProperties.AutomaticSpacingAfter,
                LineSpacingType = paragraphProperties.LineSpacingType,
                LineSpacing = paragraphProperties.LineSpacing,
                Background = paragraphProperties.Background,
                FlowDirection = paragraphProperties.FlowDirection,
                RightIndent = paragraphProperties.RightIndent,
                FirstLineIndent = paragraphProperties.FirstLineIndent,
                LeftIndent = paragraphProperties.LeftIndent
            };

            this.UpdateUICore(propertiesInfo);
            // When multiple paragraphs with different backgrounds are selected, 
            // the initial value is the default one and this prevents ColorChanged event to be fired. 
            // Thus, we need to set this flag manually.
            this.isBackgroundChanged = true;
        }
コード例 #41
0
        private void SetLineSpacingInStyle(StyleDefinition result)
        {
            string value = comboLineSpacing.SelectedValue.ToString();

            if (value == this.lineSpacingTypes[LineSpacingDialogTypes.Single])
            {
                result.SetPropertyValue(Paragraph.LineSpacingTypeProperty, LineSpacingType.Auto);
                result.SetPropertyValue(Paragraph.LineSpacingProperty, 1.0);
            }
            else if (value == this.lineSpacingTypes[LineSpacingDialogTypes.LineAndAHalf])
            {
                result.SetPropertyValue(Paragraph.LineSpacingTypeProperty, LineSpacingType.Auto);
                result.SetPropertyValue(Paragraph.LineSpacingProperty, 1.5);
            }
            else if (value == this.lineSpacingTypes[LineSpacingDialogTypes.Double])
            {
                result.SetPropertyValue(Paragraph.LineSpacingTypeProperty, LineSpacingType.Auto);
                result.SetPropertyValue(Paragraph.LineSpacingProperty, 2.0);
            }
            else if (value == this.lineSpacingTypes[LineSpacingDialogTypes.Exactly])
            {
                result.SetPropertyValue(Paragraph.LineSpacingTypeProperty, LineSpacingType.Exact);
                result.SetPropertyValue(Paragraph.LineSpacingProperty, Unit.PointToDip(this.radNumLineSpacing.Value ?? this.radNumLineSpacing.Minimum));
            }
            else if (value == this.lineSpacingTypes[LineSpacingDialogTypes.AtLeast])
            {
                result.SetPropertyValue(Paragraph.LineSpacingTypeProperty, LineSpacingType.AtLeast);
                result.SetPropertyValue(Paragraph.LineSpacingProperty, Unit.PointToDip(this.radNumLineSpacing.Value ?? this.radNumLineSpacing.Minimum));
            }
            else if (value == this.lineSpacingTypes[LineSpacingDialogTypes.Multiple])
            {
                result.SetPropertyValue(Paragraph.LineSpacingTypeProperty, LineSpacingType.Auto);
                result.SetPropertyValue(Paragraph.LineSpacingProperty, this.radNumLineSpacing.Value);
            }
            else
            {
                Debug.Assert(false, "Unknown lines spacing type selected");
            }
        }
コード例 #42
0
 private void SetFlowDirection(StyleDefinition result)
 {
     FlowDirection? flowDirection = this.GetFlowDirection();
     if (flowDirection.HasValue && flowDirection != this.initialProperties.FlowDirection)
     {
         result.SetPropertyValue(Paragraph.FlowDirectionProperty, flowDirection);
     }
 }
コード例 #43
0
 public void SetCustomStyle(StyleDefinition buttonStyle)
 {
     m_useCustomStyle = true;
     m_customStyle = buttonStyle;
     RefreshVisualStyle();
 }
コード例 #44
0
        private void SetIndents(StyleDefinition result)
        {
            if (this.radNumRightIndent.Value.HasValue)
            {
                double rightIndent = Unit.PointToDip(this.radNumRightIndent.Value.Value);
                if (rightIndent != this.initialProperties.RightIndent)
                {
                    result.SetPropertyValue(Paragraph.RightIndentProperty, rightIndent);
                }
            }

            if (this.isIndentationChanged)
            {
                double leftIndent = Unit.PointToDip(this.radNumLeftIndent.Value ?? 0);
                string firstIndentValue = this.comboFirstIndentType.SelectedValue.ToString();

                if (this.comboFirstIndentType.SelectedValue != null)
                {
                    double firstIndent = Unit.PointToDip(this.radNumFirstIndent.Value ?? this.radNumFirstIndent.Minimum);
                    if (firstIndentValue == this.firstLineIndentTypes[FirstLineIndentDialogTypes.FirstLine] && this.initialProperties.FirstLineIndent != firstIndent)
                    {
                        result.SetPropertyValue(Paragraph.FirstLineIndentProperty, firstIndent);
                    }
                    else if (firstIndentValue == this.firstLineIndentTypes[FirstLineIndentDialogTypes.Hanging])
                    {
                        // hanging indent is negative first indent
                        result.SetPropertyValue(Paragraph.FirstLineIndentProperty, -firstIndent);
                        leftIndent += firstIndent;
                    }
                    else
                    {
                        result.SetPropertyValue(Paragraph.FirstLineIndentProperty, 0);
                    }
                }

                if (leftIndent != this.initialProperties.LeftIndent)
                {
                    result.SetPropertyValue(Paragraph.LeftIndentProperty, leftIndent);
                }
            }
        }
コード例 #45
0
        private void SetParagraphSpacings(StyleDefinition result)
        {
            if (this.radNumSpacingBefore.Value.HasValue)
            {
                double spacingBefore = Unit.PointToDip(this.radNumSpacingBefore.Value.Value);
                if (spacingBefore != this.initialProperties.SpacingBefore)
                {
                    result.SetPropertyValue(Paragraph.SpacingBeforeProperty, spacingBefore);
                }
            }

            if (this.radNumSpacingAfter.Value.HasValue)
            {
                double spacingAfter = Unit.PointToDip(this.radNumSpacingAfter.Value.Value);
                if (spacingAfter != this.initialProperties.SpacingAfter)
                {
                    result.SetPropertyValue(Paragraph.SpacingAfterProperty, spacingAfter);
                }
            }

            bool? automaticSpacingBefore = this.checkBoxAutomaticSpacingBefore.IsChecked;
            if (automaticSpacingBefore.HasValue && this.checkBoxAutomaticSpacingBefore.IsChecked != this.initialProperties.AutomaticSpacingBefore)
            {
                result.SetPropertyValue(Paragraph.AutomaticSpacingBeforeProperty, automaticSpacingBefore.Value);
            }

            bool? automaticSpacingAfter = this.checkBoxAutomaticSpacingAfter.IsChecked;
            if (automaticSpacingAfter.HasValue && automaticSpacingAfter != this.initialProperties.AutomaticSpacingAfter)
            {
                result.SetPropertyValue(Paragraph.AutomaticSpacingAfterProperty, automaticSpacingAfter);
            }
        }
コード例 #46
0
        private void SetLineSpacingInStyle(StyleDefinition result)
        {
            if (this.comboLineSpacing.SelectedValue == null)
            {
                return;
            }

            string value = this.comboLineSpacing.SelectedValue.ToString();

            bool isLineSpacingChanged = this.radNumLineSpacing.Value != this.initialProperties.LineSpacing ||
                                        value != this.initialLineSpacingDialogType;

            if (isLineSpacingChanged)
            {
                double lineSpacing = Unit.PointToDip(this.radNumLineSpacing.Value ?? this.radNumLineSpacing.Minimum);

                if (value == this.lineSpacingTypes[LineSpacingDialogTypes.Single] && isLineSpacingChanged)
                {
                    result.SetPropertyValue(Paragraph.LineSpacingTypeProperty, LineSpacingType.Auto);
                    result.SetPropertyValue(Paragraph.LineSpacingProperty, 1.0);
                }
                else if (value == this.lineSpacingTypes[LineSpacingDialogTypes.LineAndAHalf] && isLineSpacingChanged)
                {
                    result.SetPropertyValue(Paragraph.LineSpacingTypeProperty, LineSpacingType.Auto);
                    result.SetPropertyValue(Paragraph.LineSpacingProperty, 1.5);
                }
                else if (value == this.lineSpacingTypes[LineSpacingDialogTypes.Double] && isLineSpacingChanged)
                {
                    result.SetPropertyValue(Paragraph.LineSpacingTypeProperty, LineSpacingType.Auto);
                    result.SetPropertyValue(Paragraph.LineSpacingProperty, 2.0);
                }
                else if (value == this.lineSpacingTypes[LineSpacingDialogTypes.Exactly] && isLineSpacingChanged)
                {
                    result.SetPropertyValue(Paragraph.LineSpacingTypeProperty, LineSpacingType.Exact);
                    result.SetPropertyValue(Paragraph.LineSpacingProperty, lineSpacing);
                }
                else if (value == this.lineSpacingTypes[LineSpacingDialogTypes.AtLeast] && isLineSpacingChanged)
                {
                    result.SetPropertyValue(Paragraph.LineSpacingTypeProperty, LineSpacingType.AtLeast);
                    result.SetPropertyValue(Paragraph.LineSpacingProperty, lineSpacing);
                }
                else if (value == this.lineSpacingTypes[LineSpacingDialogTypes.Multiple] && isLineSpacingChanged)
                {
                    result.SetPropertyValue(Paragraph.LineSpacingTypeProperty, LineSpacingType.Auto);
                    result.SetPropertyValue(Paragraph.LineSpacingProperty, this.radNumLineSpacing.Value);
                }
            }
        }
コード例 #47
0
 private void SetBackground(StyleDefinition result)
 {
     Color backgroundColor = paragraphBackgroundColorSelector.SelectedColor;
     if (backgroundColor != this.initialProperties.Background && this.isBackgroundChanged)
     {
         result.SetPropertyValue(Paragraph.BackgroundProperty, backgroundColor);
     }
 }
コード例 #48
0
 private void SetTextAlignment(StyleDefinition result)
 {
     if (comboAligment.SelectedValue != null && (RadTextAlignment)comboAligment.SelectedValue != this.initialProperties.TextAlignment)
     {
         result.SetPropertyValue(Paragraph.TextAlignmentProperty, (RadTextAlignment)comboAligment.SelectedValue);
     }
 }
コード例 #49
0
        private void RefreshInternals()
        {
            if (m_styleDef == null)
                m_styleDef = m_styles[(int) MyGuiControlSliderStyleEnum.Default];

            if (HasHighlight)
            {
                m_railTexture = m_styleDef.RailHighlightTexture;
                m_thumbTexture = m_styleDef.ThumbTexture.Highlight;
            }
            else
            {
                m_railTexture = m_styleDef.RailTexture;
                m_thumbTexture = m_styleDef.ThumbTexture.Normal;
            }

            MinSize = new Vector2(m_railTexture.MinSizeGui.X + m_labelSpaceWidth, Math.Max(m_railTexture.MinSizeGui.Y, m_label.Size.Y)) * DebugScale;
            MaxSize = new Vector2(m_railTexture.MaxSizeGui.X + m_labelSpaceWidth, Math.Max(m_railTexture.MaxSizeGui.Y, m_label.Size.Y)) * DebugScale;
            m_label.Position = new Vector2(Size.X * 0.5f, 0f);
        }
        /// <summary>
        /// count occurrences of numbered lists, save that as a hint on the numbered list node
        /// </summary>
        /// <param name="mainDoc"></param>
        /// <param name="nsm"></param>
        private static void HandleNumberedLists(XmlDocument mainDoc, XmlNamespaceManager nsm)
        {
            // count the number of different list numbering schemes
            XmlNodeList numberNodes = mainDoc.SelectNodes("/w:document/w:numbering/w:num", nsm);

            if (numberNodes.Count == 0)
            {
                return;
            }

            // initialize the abstract number list
            XmlNodeList abstractNumNodes = mainDoc.SelectNodes("/w:document/w:numbering/w:abstractNum", nsm);
            Dictionary<string, AbstractListNumberingDefinition> abstractListDefinitions = new Dictionary<string, AbstractListNumberingDefinition>(abstractNumNodes.Count);
            Dictionary<string, ListNumberingDefinition> instanceListDefinitions = new Dictionary<string, ListNumberingDefinition>(numberNodes.Count);

            // store the abstract list type definitions
            foreach (XmlNode abstractNumNode in abstractNumNodes)
            {
                AbstractListNumberingDefinition absNumDef = new AbstractListNumberingDefinition(abstractNumNode, nsm);

                abstractListDefinitions[absNumDef.ID] = absNumDef;
            }

            // now go through the abstract list definitions and update those that are linked to other styles
            foreach (KeyValuePair<string, AbstractListNumberingDefinition> absNumDef in abstractListDefinitions)
            {
                if (absNumDef.Value.HasLinkedStyle)
                {
                    // find the linked style
                    string linkStyleXPath = "/w:document/w:numbering/w:abstractNum/w:styleLink[@w:val=\"" + absNumDef.Value.LinkedStyleId + "\"]";
                    XmlNode linkedStyleNode = mainDoc.SelectSingleNode(linkStyleXPath, nsm);

                    if (linkedStyleNode != null)
                    {
                        absNumDef.Value.UpdateDefinitionFromLinkedStyle(linkedStyleNode.ParentNode, nsm);
                    }
                }
            }

            // instantiate the list number definitions
            foreach (XmlNode numNode in numberNodes)
            {
                ListNumberingDefinition listDef = new ListNumberingDefinition(numNode, nsm, abstractListDefinitions);

                instanceListDefinitions[listDef.ListNumberId] = listDef;
            }

            // Get styles with numbering definitions
            XmlNodeList stylesWithNumbers = mainDoc.SelectNodes("/w:document/w:styles/w:style/w:pPr/w:numPr", nsm);
            Dictionary<string, StyleDefinition> styleDefinitions = new Dictionary<string, StyleDefinition>(stylesWithNumbers.Count);
            foreach (XmlNode styleNode in stylesWithNumbers)
            {
                // Check to see if it is based on a style that is not in the definitions list yet?
                StyleDefinition styleDef = new StyleDefinition(styleNode, nsm, styleDefinitions);
                styleDefinitions[styleDef.Name] = styleDef;
            }

            XmlNodeList styleParagraphs = mainDoc.SelectNodes("//w:pPr/w:pStyle", nsm);
            foreach (XmlNode paragraph in styleParagraphs)
            {
                string styleName = getAttributeValue(paragraph, ValAttrName);
                if (!String.IsNullOrEmpty(styleName) && styleDefinitions.ContainsKey(styleName))
                {
                    XmlNode oldNode = paragraph.ParentNode.SelectSingleNode("./w:numPr", nsm);
                    if (oldNode == null)
                        styleDefinitions[styleName].AddNumbering(mainDoc, paragraph.ParentNode);
                }
            }

            XmlNodeList listNodes = mainDoc.SelectNodes("//w:numPr/w:ilvl", nsm);

            foreach (XmlNode node in listNodes)
            {
                string levelId = getAttributeValue(node, ValAttrName);
                XmlNode numIdNode = node.ParentNode.SelectSingleNode("./w:numId", nsm);

                if (!String.IsNullOrEmpty(levelId) && numIdNode != null)
                {
                    string numId = getAttributeValue(numIdNode, ValAttrName);

                    if (!String.IsNullOrEmpty(numId) && instanceListDefinitions.ContainsKey(numId) && instanceListDefinitions[numId].LevelExists(levelId))
                    {
                        XmlAttribute counterAttr = mainDoc.CreateAttribute("numString");

                        instanceListDefinitions[numId].IncrementCounter(levelId);
                        counterAttr.Value = instanceListDefinitions[numId].GetCurrentNumberString(levelId) + " ";

                        node.Attributes.Append(counterAttr);

                        string font = instanceListDefinitions[numId].GetFont(levelId);

                        if (!String.IsNullOrEmpty(font))
                        {
                            XmlAttribute fontAttr = mainDoc.CreateAttribute("numFont");

                            fontAttr.Value = font;

                            node.Attributes.Append(fontAttr);
                        }

                        if (instanceListDefinitions[numId].IsBullet(levelId))
                        {
                            XmlAttribute bulletAttr = mainDoc.CreateAttribute("isBullet");

                            bulletAttr.Value = "true";

                            node.Attributes.Append(bulletAttr);
                        }
                    }
                }
            }
        }
コード例 #51
0
 private void RefreshVisualStyle()
 {
     m_styleDef = GetVisualStyle(VisualStyle);
     ItemSize = m_styleDef.ItemSize;
     TextScale = m_styleDef.TextScale;
     RefreshInternals();
 }
コード例 #52
0
        public StyleDefinition GetParagraphStyleInfo()
        {
            StyleDefinition result = new StyleDefinition(StyleType.Paragraph);

            this.SetTextAlignment(result);
            this.SetFlowDirection(result);
            this.SetParagraphSpacings(result);
            this.SetLineSpacingInStyle(result);
            this.SetBackground(result);
            this.SetIndents(result);

            return result;
        }
コード例 #53
0
 private void RefreshVisualStyle()
 {
     if (m_useCustomStyle)
     {
         m_styleDef = m_customStyle;
     }
     else
     {
         m_styleDef = GetVisualStyle(VisualStyle);
     }
     RefreshInternals();
 }
コード例 #54
0
 private void RefreshVisualStyle()
 {
     m_styleDef = GetVisualStyle(VisualStyle);
     RowHeight = m_styleDef.RowHeight;
     TextScale = m_styleDef.TextScale;
     RefreshInternals();
 }
コード例 #55
0
 private void RefreshVisualStyle()
 {
     m_styleDef = GetVisualStyle(VisualStyle);
     m_itemMargin = m_styleDef.ItemMargin;
     m_showScrollbar = m_styleDef.ScrollbarEnabled;
     MinSize = m_styleDef.Texture.MinSizeGui;
     MaxSize = m_styleDef.Texture.MaxSizeGui;
     RefreshInternals();
 }
コード例 #56
0
        public MyGuiControlImageButton(
            string name = "Button",
            Vector2? position = null,
            Vector2? size = null,
            Vector4? colorMask = null,
            MyGuiDrawAlignEnum originAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
            String toolTip = null,
            StringBuilder text = null,
            float textScale = MyGuiConstants.DEFAULT_TEXT_SCALE,
            MyGuiDrawAlignEnum textAlignment = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
            MyGuiControlHighlightType highlightType = MyGuiControlHighlightType.WHEN_ACTIVE,
            Action<MyGuiControlImageButton> onButtonClick = null,
            GuiSounds cueEnum = GuiSounds.MouseClick,
            float buttonScale = 1.0f,
            int? buttonIndex = null,
            bool activateOnMouseRelease = false)
            : base(position: position ?? Vector2.Zero,
                    size: size,
                    colorMask: colorMask ?? MyGuiConstants.BUTTON_BACKGROUND_COLOR,
                    toolTip: toolTip,
                    highlightType: highlightType,
                    originAlign: originAlign,
                    canHaveFocus: true)
        {
            m_styleDefinition = new StyleDefinition()
            {
                Active = new StateDefinition() { Texture = MyGuiConstants.TEXTURE_BUTTON_DEFAULT_NORMAL },
                Disabled = new StateDefinition() { Texture = MyGuiConstants.TEXTURE_BUTTON_DEFAULT_NORMAL },
                Normal = new StateDefinition() { Texture = MyGuiConstants.TEXTURE_BUTTON_DEFAULT_NORMAL },
                Highlight = new StateDefinition() { Texture = MyGuiConstants.TEXTURE_BUTTON_DEFAULT_HIGHLIGHT },
                ActiveHighlight = new StateDefinition() { Texture = MyGuiConstants.TEXTURE_BUTTON_DEFAULT_HIGHLIGHT },
            };

            Name = name ?? "Button";
            ButtonClicked = onButtonClick;
            Index = buttonIndex ?? 0;
            UpdateText();

            m_drawText.Clear().Append(text);
            TextScale = textScale;
            TextAlignment = textAlignment;

            m_cueEnum = cueEnum;
            m_activateOnMouseRelease = activateOnMouseRelease;

            ButtonScale = buttonScale;

            Size *= ButtonScale;
        }
コード例 #57
0
 private void RefreshVisualStyle()
 {
     m_styleDef = GetVisualStyle(VisualStyle);
     RefreshInternals();
 }
コード例 #58
0
        private RadDocument CreateDocument()
        {
            RadDocument document = new RadDocument();
            document.History.IsEnabled = false;

            RadDocumentEditor editor = new RadDocumentEditor(document);

            editor.Document.LayoutMode = DocumentLayoutMode.Paged;

            #region CreateCover

            StyleDefinition titleStyle = new StyleDefinition("Title", StyleType.Paragraph);
            titleStyle.ParagraphProperties.TextAlignment = RadTextAlignment.Center;
            titleStyle.SpanProperties.FontSize = 35;
            titleStyle.SpanProperties.ForeColor = Colors.CornflowerBlue;
            titleStyle.NextStyleName = RadDocumentDefaultStyles.NormalStyleName;

            editor.Document.StyleRepository.Add(titleStyle);
            editor.ChangeStyleName("Title");

            editor.Insert("Sample Word Document Test");
            editor.InsertSectionBreak(SectionBreakType.NextPage);

            #endregion

            #region CreateTOCSection

            editor.ChangeStyleName("Title");

            editor.Insert("Table of contents");

            editor.InsertField(new TableOfContentsField() { });
            editor.InsertSectionBreak(SectionBreakType.NextPage);

            #endregion

            #region Content

            editor.ChangeStyleName(RadDocumentDefaultStyles.GetHeadingStyleNameByIndex(1));
            editor.ChangeParagraphListStyle(DefaultListStyles.NumberedHierarchical);
            editor.Insert("Section A Heading");
            editor.InsertParagraph();
            editor.ChangeParagraphListStyle(null);

            editor.Insert("Lorem ipsum dolor sit amet, consectetur adipiscing elit. In in elementum ipsum. Duis vel vulputate massa, eget iaculis urna. Morbi feugiat, magna eget accumsan mollis, leo lectus porta diam, id sollicitudin mi tellus nec tortor. Nullam lacinia consequat blandit. Sed tincidunt pulvinar ultricies. Interdum et malesuada fames ac ante ipsum primis in faucibus. Praesent nec convallis nunc. Maecenas fermentum, dolor sed egestas aliquet, diam sem tempus nulla, sed vehicula ipsum metus ut odio. Proin commodo malesuada justo in mollis. Nullam et blandit est, ac dapibus tortor. Aliquam ligula mauris, sodales vitae gravida a, bibendum eget arcu.");
            editor.InsertParagraph();

            editor.ChangeStyleName(RadDocumentDefaultStyles.GetHeadingStyleNameByIndex(2));
            editor.ChangeParagraphListStyle(DefaultListStyles.Numbered);
            editor.ContinueListNumbering();
            editor.ChangeParagraphListLevel(1);
            editor.Insert("Subsection A1");

            editor.InsertParagraph();
            editor.ChangeParagraphListStyle(DefaultListStyles.None);

            editor.Insert("Proin sodales aliquam lorem ac laoreet. Integer diam lorem, cursus at arcu sed, ornare luctus diam. Maecenas a blandit sem. Donec quam nunc, euismod quis quam vel, pulvinar rhoncus urna.");
            editor.InsertParagraph();

            editor.ChangeStyleName(RadDocumentDefaultStyles.GetHeadingStyleNameByIndex(2));
            editor.ChangeParagraphListStyle(DefaultListStyles.Numbered);
            editor.ContinueListNumbering();
            editor.ChangeParagraphListLevel(1);
            editor.Insert("Subsection A2");
            editor.InsertParagraph();
            editor.ChangeParagraphListStyle(null);

            editor.Insert("Duis ornare magna mi, id commodo sem pulvinar et. Quisque adipiscing diam purus, nec posuere eros fringilla non. Nam a dictum lacus. In sit amet dignissim est. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Suspendisse potenti");
            #endregion

            editor.UpdateAllFields(FieldDisplayMode.Result);

            editor.Document.Sections.First.Headers.Default = this.CreateHeader();
            editor.Document.Sections.First.Footers.Default = this.CreateFooter();

            return document;
        }
コード例 #59
0
 public RealStylesTreeItem(StyleDefinition definition, string styleOriginalString)
     : base(definition)
 {
     _styleOriginalString = styleOriginalString;
 }
コード例 #60
0
        public StyleDefinition GetParagraphStyleInfo()
        {
            StyleDefinition result = new StyleDefinition(StyleType.Paragraph);

            if (comboAligment.SelectedValue != null)
            {
                result.SetPropertyValue(Paragraph.TextAlignmentProperty, (RadTextAlignment)comboAligment.SelectedValue);
            }

            result.SetPropertyValue(Paragraph.FlowDirectionProperty, this.GetFlowDirection());

            result.SetPropertyValue(Paragraph.SpacingBeforeProperty, Unit.PointToDip(this.radNumSpacingBefore.Value ?? this.radNumSpacingBefore.Minimum));
            result.SetPropertyValue(Paragraph.SpacingAfterProperty, Unit.PointToDip(this.radNumSpacingAfter.Value ?? this.radNumSpacingAfter.Minimum));
            result.SetPropertyValue(Paragraph.AutomaticSpacingBeforeProperty, this.checkBoxAutomaticSpacingBefore.IsChecked ?? false);
            result.SetPropertyValue(Paragraph.AutomaticSpacingAfterProperty, this.checkBoxAutomaticSpacingAfter.IsChecked ?? false);
            result.SetPropertyValue(Paragraph.RightIndentProperty, Unit.PointToDip(this.radNumRightIndent.Value ?? 0));

            this.SetLineSpacingInStyle(result);

            result.SetPropertyValue(Paragraph.BackgroundProperty, paragraphBackgroundColorSelector.SelectedColor);

            double leftIndent = Unit.PointToDip(this.radNumLeftIndent.Value ?? 0);
            string firstIndentValue = this.comboFirstIndentType.SelectedValue.ToString();
            if (this.comboFirstIndentType.SelectedValue != null)
            {
                if (firstIndentValue == this.firstLineIndentTypes[FirstLineIndentDialogTypes.FirstLine])
                {
                    result.SetPropertyValue(Paragraph.FirstLineIndentProperty, Unit.PointToDip(this.radNumFirstIndent.Value ?? this.radNumFirstIndent.Minimum));
                }
                else if (firstIndentValue == this.firstLineIndentTypes[FirstLineIndentDialogTypes.Hanging])
                {
                    // hanging indent is negative first indent
                    result.SetPropertyValue(Paragraph.FirstLineIndentProperty, -Unit.PointToDip(this.radNumFirstIndent.Value ?? this.radNumFirstIndent.Minimum));
                    leftIndent += Unit.PointToDip(this.radNumFirstIndent.Value ?? this.radNumFirstIndent.Minimum);
                }
                else
                {
                    result.SetPropertyValue(Paragraph.FirstLineIndentProperty, 0);
                }
            }
            result.SetPropertyValue(Paragraph.LeftIndentProperty, leftIndent);

            return result;
        }