Exemple #1
0
        public static Spread ReadXml(XmlReader reader)
        {
            Spread result = new Spread();

            if (reader.HasAttributes)
            {
                result.Self = System.Convert.ToString(reader.GetAttribute("Self"));
                result.FlattenerOverride       = (SpreadFlattenerLevel?)Parser.ParseEnum <SpreadFlattenerLevel>(reader.GetAttribute("FlattenerOverride"));
                result.AllowPageShuffle        = Parser.ParseBoolean(reader.GetAttribute("AllowPageShuffle"));
                result.ItemTransform           = System.Convert.ToString(reader.GetAttribute("ItemTransform"));
                result.ShowMasterItems         = Parser.ParseBoolean(reader.GetAttribute("ShowMasterItems"));
                result.PageCount               = System.Convert.ToInt32(reader.GetAttribute("PageCount"));
                result.BindingLocation         = System.Convert.ToInt32(reader.GetAttribute("BindingLocation"));
                result.PageTransitionType      = (PageTransitionTypeOptions?)Parser.ParseEnum <PageTransitionTypeOptions>(reader.GetAttribute("PageTransitionType"));
                result.PageTransitionDirection = (PageTransitionDirectionOptions)Parser.ParseEnum <PageTransitionDirectionOptions>(reader.GetAttribute("PageTransitionDirection"));
                result.PageTransitionDuration  = (PageTransitionDurationOptions)Parser.ParseEnum <PageTransitionDurationOptions>(reader.GetAttribute("PageTransitionDuration"));
            }

            if (reader.IsEmptyElement)
            {
                return(result);
            }

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    if ((string)reader.Name == "Properties")
                    {
                        while (reader.Read())
                        {
                            if ((string)reader.Name == "")
                            {
                            }
                            else if ((string)reader.Name == "Properties")
                            {
                                if (reader.NodeType == XmlNodeType.EndElement)
                                {
                                    break;
                                }
                            }
                            else
                            {
                                if (reader.NodeType == XmlNodeType.Element)
                                {
                                    Debug.WriteLine("Unrecognized element: {0} in element: {1}", reader.Name, "Spread - Properties");
                                }
                            }
                        }
                    }
                    else if ((string)reader.Name == "FlattenerPreference")
                    {
                        result.FlattenerPreference = FlattenerPreference.ReadXml(reader);
                    }
                    else if ((string)reader.Name == "Page")
                    {
                        result.Children.Add(Page.ReadXml(reader));
                    }
                    else if ((string)reader.Name == "TextFrame")
                    {
                        result.Children.Add(TextFrame.ReadXml(reader));
                    }
                    else if ((string)reader.Name == "Rectangle")
                    {
                        result.Children.Add(Rectangle.ReadXml(reader));
                    }
                    else
                    {
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            Debug.WriteLine("Unrecognized element: {0} in element: {1}", reader.Name, "Spread");
                        }
                    }
                }
            }

            return(result);
        }
        public static FlattenerPreference ReadXml(XmlReader reader)
        {
            FlattenerPreference fp = new FlattenerPreference();

            if (reader.HasAttributes)
            {
                fp.LineArtAndTextResolution    = (double)Parser.ParseDouble(reader.GetAttribute("LineArtAndTextResolution"));
                fp.GradientAndMeshResolution   = (double)Parser.ParseDouble(reader.GetAttribute("GradientAndMeshResolution"));
                fp.ClipComplexRegions          = Convert.ToBoolean(reader.GetAttribute("ClipComplexRegions"));
                fp.ConvertAllStrokesToOutlines = Convert.ToBoolean(reader.GetAttribute("ConvertAllStrokesToOutlines"));
                fp.ConvertAllTextToOutlines    = Convert.ToBoolean(reader.GetAttribute("ConvertAllTextToOutlines"));
            }

            if (reader.IsEmptyElement)
            {
                return(fp);
            }

            if (!reader.IsEmptyElement)
            {
                while (reader.Read())
                {
                    switch (reader.Name)
                    {
                    case "Properties":
                        while (reader.Read())
                        {
                            switch (reader.Name)
                            {
                            case "RasterVectorBalance":
                                fp.RasterVectorBalance = RasterVectorBalance.ReadXml(reader);
                                break;

                            default:
                                if (reader.NodeType == XmlNodeType.Element)
                                {
                                    Debug.WriteLine("Unrecognized element: {0} in element: {1}", reader.Name, "FlattenerPreference - Properties");
                                }
                                break;
                            }
                            if (reader.Name == "Properties" & reader.NodeType == XmlNodeType.EndElement)
                            {
                                break;
                            }
                        }
                        break;

                    default:
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            Debug.WriteLine("Unrecognized element: {0} in element: {1}", reader.Name, "FlattenerPreference");
                        }
                        break;
                    }
                    if (reader.Name == "FlattenerPreference" & reader.NodeType == XmlNodeType.EndElement)
                    {
                        break;
                    }
                }
            }

            return(fp);
        }