Exemplo n.º 1
0
        private ElementRenderNode RenderElement(IElement reference, StyleCollection collection, ICssStyleDeclaration parent = null)
        {
            var style    = collection.ComputeCascadedStyle(reference, parent);
            var children = new List <IRenderNode>();

            foreach (var child in reference.ChildNodes)
            {
                if (child is IText text)
                {
                    children.Add(RenderText(text, collection));
                }
                else if (child is IElement element)
                {
                    children.Add(RenderElement(element, collection, style));
                }
            }

            return(new ElementRenderNode
            {
                Ref = reference,
                SpecifiedStyle = style,
                ComputedStyle = style.Compute(_device),
                Children = children,
            });
        }
Exemplo n.º 2
0
        protected virtual void ParseCssStyles(StyleCollection collection, string content, PDFContextBase context)
        {
            bool parseCss = true;

            if (!string.IsNullOrEmpty(this.Relationship))
            {
                if (this.Relationship.Equals("stylesheet", StringComparison.OrdinalIgnoreCase) == false)
                {
                    parseCss = false;
                }
            }



            if (parseCss)
            {
                var parser = new Scryber.Styles.Parsing.CSSStyleParser(content, context);
                foreach (var style in parser)
                {
                    if (null != style)
                    {
                        collection.Add(style);
                    }
                }
            }
        }
Exemplo n.º 3
0
        public void ParseCSSWithComments_Performance()
        {
            var css = commentedCSS;

            int repeatCount = 1000;

            Stopwatch counter = Stopwatch.StartNew();

            for (int i = 0; i < repeatCount; i++)
            {
                var cssparser = new Scryber.Styles.Parsing.CSSStyleParser(css, null);

                StyleCollection col = new StyleCollection();

                foreach (var style in cssparser)
                {
                    col.Add(style);
                }
            }
            counter.Stop();

            var elapsed = counter.Elapsed.TotalMilliseconds / repeatCount;

            Assert.IsTrue(elapsed < 0.20, "Took too long to parse. Expected < 0.15ms per string, Actual : " + elapsed + "ms");
        }
Exemplo n.º 4
0
        public StyleCollection loadStyleCollection()
        {
            StyleCollection collection = new StyleCollection();
            if (good)
            {
                XmlDocument xml = new XmlDocument();
                xml.Load(this.path);
                string name = "";
                List<string> input = new List<string>();
                string output = "";

                foreach (XmlNode node in xml.SelectNodes("styles/style"))
                {
                    if (node.Attributes.Count == 1 && node.Attributes[0].Name == "type")
                        name = node.Attributes[0].Value;

                    collection.addStyle(name);
                    foreach (XmlNode child in node.ChildNodes)
                    {
                        foreach (XmlNode child2 in child.ChildNodes)
                        {
                            if (child2.Name == "input")
                                input.Add(child2.InnerText);
                            else if (child2.Name == "output")
                                output = child2.InnerText;
                        }
                        collection.getStyle()[collection.getSize() - 1].addSubStyle(input, output);
                        input.Clear();
                    }

                }
            }

            return collection;
        }
Exemplo n.º 5
0
        public static void Run()
        {
            //ExStart:AccessStyles
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_WorkingWithDocument();
            // Load the template document.
            Document doc = new Document(dataDir + "TestFile.doc");
            // Get styles collection from document.
            StyleCollection styles    = doc.Styles;
            string          styleName = "";

            // Iterate through all the styles.
            foreach (Style style in styles)
            {
                if (styleName == "")
                {
                    styleName = style.Name;
                }
                else
                {
                    styleName = styleName + ", " + style.Name;
                }
            }
            //ExEnd:AccessStyles
            Console.WriteLine("\nDocument have following styles " + styleName);
        }
Exemplo n.º 6
0
        public void StyleCollection()
        {
            //ExStart
            //ExFor:StyleCollection.Add(Style)
            //ExFor:StyleCollection.Count
            //ExFor:StyleCollection.DefaultFont
            //ExFor:StyleCollection.DefaultParagraphFormat
            //ExFor:StyleCollection.Item(StyleIdentifier)
            //ExFor:StyleCollection.Item(Int32)
            //ExSummary:Shows how to add a Style to a document's styles collection.
            Document        doc    = new Document();
            StyleCollection styles = doc.Styles;

            // Set default parameters for new styles that we may later add to this collection.
            styles.DefaultFont.Name = "Courier New";

            // If we add a style of the "StyleType.Paragraph", the collection will apply the values of
            // its "DefaultParagraphFormat" property to the style's "ParagraphFormat" property.
            styles.DefaultParagraphFormat.FirstLineIndent = 15.0;

            // Add a style, and then verify that it has the default settings.
            styles.Add(StyleType.Paragraph, "MyStyle");

            Assert.AreEqual("Courier New", styles[4].Font.Name);
            Assert.AreEqual(15.0, styles["MyStyle"].ParagraphFormat.FirstLineIndent);
            //ExEnd
        }
        public void ItemTest()
        {
            StyleCollection target = new StyleCollection();
            StyleDefn       defn   = new StyleDefn();

            defn.Border.Color = PDFColors.Red;
            defn.Border.Width = 10;
            target.Add(defn);

            StyleDefn defn2 = new StyleDefn();

            defn2.Border.Color = PDFColors.Gray;
            defn2.Border.Width = 2;
            target.Add(defn2);

            int       index    = 0;
            StyleBase expected = defn;
            StyleBase actual   = target[index];

            Assert.AreEqual(expected, actual);

            index    = 1;
            expected = defn2;
            actual   = target[index];
            Assert.AreEqual(expected, actual);

            expected      = defn;
            target[index] = defn;
            actual        = target[index];
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 8
0
        private void ParseLoadedContent(HTMLLinkType type, string content, string path, PDFContextBase context)
        {
            switch (type)
            {
            case (HTMLLinkType.CSS):
                StyleCollection col = this.CreateInnerStyles(content, context);
                this._content = new LinkContentCSS(col, path);
                break;

            case (HTMLLinkType.Html):

                Dictionary <string, string> ns = new Dictionary <string, string>();
                foreach (var map in this.Document.NamespaceDeclarations)
                {
                    ns.Add(map.Prefix, map.NamespaceURI);
                }
                Scryber.Data.ParsableTemplateGenerator gen = new Data.ParsableTemplateGenerator(content, ns);
                this._content = new LinkContentHtml(gen, path);
                break;

            default:
                if (context.Conformance == ParserConformanceMode.Strict)
                {
                    throw new System.IO.FileLoadException("The link with href " + this.Href + " could not be loaded from path '" + path + "' as it does not have a known rel type - stylesheet or include");
                }
                else
                {
                    context.TraceLog.Add(TraceLevel.Error, "HTML", "The link with href " + this.Href + " could not be loaded from path '" + path + "'  as it does not have a known rel type - stylesheet or include");
                }

                break;
            }
        }
        public void PDFStyleCollectionConstructorTest()
        {
            StyleCollection target = new StyleCollection();

            Assert.IsNotNull(target);
            Assert.AreEqual(0, target.Count);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Computes the declarations for the given element in the context of
        /// the specified styling rules.
        /// </summary>
        /// <param name="rules">The styles to use.</param>
        /// <param name="element">The element that is questioned.</param>
        /// <param name="pseudoSelector">The optional pseudo selector to use.</param>
        /// <returns>The style declaration containing all the declarations.</returns>
        public static CssStyleDeclaration ComputeDeclarations(this StyleCollection rules, IElement element, String pseudoSelector = null)
        {
            var computedStyle = new CssStyleDeclaration();
            var pseudoElement = PseudoElement.Create(element, pseudoSelector);

            if (pseudoElement != null)
            {
                element = pseudoElement;
            }

            computedStyle.SetDeclarations(rules.ComputeCascadedStyle(element).Declarations);
            var htmlElement = element as IHtmlElement;

            if (htmlElement != null)
            {
                var declarations = htmlElement.Style.OfType <CssProperty>();
                computedStyle.SetDeclarations(declarations);
            }

            var nodes = element.GetAncestors().OfType <IElement>();

            foreach (var node in nodes)
            {
                var style = rules.ComputeCascadedStyle(node);
                computedStyle.UpdateDeclarations(style.Declarations);
            }

            return(computedStyle);
        }
Exemplo n.º 11
0
        public void StyleCollection()
        {
            //ExStart
            //ExFor:StyleCollection.Add(Style)
            //ExFor:StyleCollection.Count
            //ExFor:StyleCollection.DefaultFont
            //ExFor:StyleCollection.DefaultParagraphFormat
            //ExFor:StyleCollection.Item(StyleIdentifier)
            //ExFor:StyleCollection.Item(Int32)
            //ExSummary:Shows how to add a Style to a StyleCollection.
            Document doc = new Document();

            // New documents come with a collection of default styles that can be applied to paragraphs
            StyleCollection styles = doc.Styles;

            Assert.AreEqual(4, styles.Count);

            // We can set default parameters for new styles that will be added to the collection from now on
            styles.DefaultFont.Name = "Courier New";
            styles.DefaultParagraphFormat.FirstLineIndent = 15.0;

            styles.Add(StyleType.Paragraph, "MyStyle");

            // Styles within the collection can be referenced either by index or name
            Assert.AreEqual("Courier New", styles[4].Font.Name);
            Assert.AreEqual(15.0, styles["MyStyle"].ParagraphFormat.FirstLineIndent);
            //ExEnd
        }
Exemplo n.º 12
0
    // Start is called before the first frame update
    void Start()
    {
        collection = StyleCollection.getInstance();

        foreach (var bodyPartAvailable in collection.getAvailableBodyParts())
        {
            var key       = StyleCollection.bodyPartToString(bodyPartAvailable);
            var currentId = PlayerPrefs.GetString(key);
            if (currentId == "")
            {
                currentId = defaultPart;
            }
            m_meshIds[bodyPartAvailable] = currentId;
        }

        loadSprite(Hood, BodyPart.Hood);
        loadSprite(Head, BodyPart.Head);
        loadSprite(Torso, BodyPart.Torso);
        loadSprite(Pelvis, BodyPart.Pelvis);
        loadSprite(leftShoulder, BodyPart.LShoulder);
        loadSprite(rightShoulder, BodyPart.RShoulder);
        loadSprite(leftElbow, BodyPart.LElbow);
        loadSprite(rightElbow, BodyPart.RElbow);
        loadSprite(leftWrist, BodyPart.LWrist);
        loadSprite(rightWrist, BodyPart.RWrist);
        loadSprite(leftLeg, BodyPart.LLeg);
        loadSprite(rightLeg, BodyPart.RLeg);
        loadSprite(leftBoot, BodyPart.LBoot);
        loadSprite(rightBoot, BodyPart.RBoot);
    }
Exemplo n.º 13
0
        public void AccessStyles()
        {
            //ExStart:AccessStyles
            Document doc = new Document();

            string styleName = "";

            // Get styles collection from the document.
            StyleCollection styles = doc.Styles;

            foreach (Style style in styles)
            {
                if (styleName == "")
                {
                    styleName = style.Name;
                    Console.WriteLine(styleName);
                }
                else
                {
                    styleName = styleName + ", " + style.Name;
                    Console.WriteLine(styleName);
                }
            }
            //ExEnd:AccessStyles
        }
Exemplo n.º 14
0
        void AddStyles()
        {
            StyleCollection styles = book.Styles;
            Style           style1 = styles.Add("Style 1");

            style1.Fill.PatternType     = PatternType.Solid;
            style1.Fill.BackgroundColor = blueFillColor;
            style1.Font.Color           = blueFontColor;
            style1.Font.Name            = "Segoe UI";
            style1.Alignment.Horizontal = SpreadsheetHorizontalAlignment.Left;
            style1.Alignment.Vertical   = SpreadsheetVerticalAlignment.Center;
            style1.Alignment.Indent     = 2;

            Style style2 = styles.Add("Style 2");

            style2.Fill.PatternType     = PatternType.Solid;
            style2.Fill.BackgroundColor = blueBorderColor;
            style2.Font.Color           = blueFontColor;
            style2.Font.Name            = "Segoe UI";
            style2.Alignment.Horizontal = SpreadsheetHorizontalAlignment.Left;
            style2.Alignment.Vertical   = SpreadsheetVerticalAlignment.Center;
            style2.Alignment.Indent     = 2;

            Style style3 = styles.Add("Style 3");

            style3.Fill.PatternType     = PatternType.Solid;
            style3.Fill.BackgroundColor = Color.FromArgb(255, 255, 255, 255);
            style3.Font.Color           = Color.FromArgb(255, 0, 0, 0);
            style3.Font.Name            = "Segoe UI";
            style3.Alignment.Horizontal = SpreadsheetHorizontalAlignment.Center;
            style3.Alignment.Vertical   = SpreadsheetVerticalAlignment.Center;
            style3.Flags.Number         = false;
        }
Exemplo n.º 15
0
        public void WithNoValuesReturnsCorrectly()
        {
            var styles = new StyleCollection();

            var result = styles.ToString();

            Assert.AreEqual( string.Empty, result );
        }
Exemplo n.º 16
0
 private void clear()
 {
     bibRecordsCurrent = new BibTeXRecordsCollection();
     bibRecordsReference = new BibTeXRecordsCollection();
     bibEntryContent = new BibTeXEntryContent();
     styleCollection = new StyleCollection();
     listViewEntires.Items.Clear();
 }
Exemplo n.º 17
0
 internal Class427(Class52 A_0, Class812 A_1, StyleCollection A_2)
 {
     this.class52_0         = A_0;
     this.styleCollection_0 = A_2;
     this.class141_0        = new Class141(null, A_1);
     this.class140_0        = new Class140(this.class52_0, A_1);
     this.class143_0        = new Class143(null, A_1, NFibEnum.Word2003);
 }
Exemplo n.º 18
0
        protected StyleCollection CreateInnerStyles(PDFContextBase context)
        {
            var collection = new StyleCollection(this);

            this.AddCssStyles(collection, context);

            return(collection);
        }
Exemplo n.º 19
0
        public void CSSParserWithComments()
        {
            var css = @"
            /* This is the grey body */
            body.grey
            {
                background-color:#808080; /* body background */
                color: #222;
            }

            body.grey div /* Inner divs */{
                padding: 10px;
                /*color: #AAA;*/
                margin:15px;
            }


            body.grey div.reverse{
    
                /* Reverse the colors */
                background-color: #222;
                color:#808080;
            }";

            var cssparser = new Scryber.Styles.Parsing.CSSStyleParser(css, null);

            StyleCollection col = new StyleCollection();

            foreach (var style in cssparser)
            {
                col.Add(style);
            }

            Assert.AreEqual(3, col.Count);

            //First one
            var one = col[0] as StyleDefn;

            Assert.AreEqual("body.grey", one.Match.ToString());
            Assert.AreEqual(2, one.ValueCount);
            Assert.AreEqual((PDFColor)"#808080", one.GetValue(StyleKeys.BgColorKey, PDFColors.Transparent));
            Assert.AreEqual((PDFColor)"#222", one.GetValue(StyleKeys.FillColorKey, PDFColors.Transparent));

            var two = col[1] as StyleDefn;

            Assert.AreEqual("body.grey div", two.Match.ToString());
            Assert.AreEqual(10, two.ValueCount); //All, Top, Left, Bottom and Right are all set for Margins and Padding
            // 96 pixels per inch, 72 points per inch
            Assert.AreEqual(7.5, two.GetValue(StyleKeys.PaddingAllKey, PDFUnit.Zero).PointsValue);
            Assert.AreEqual(11.25, two.GetValue(StyleKeys.MarginsAllKey, PDFUnit.Zero).PointsValue);

            var three = col[2] as StyleDefn;

            Assert.AreEqual("body.grey div.reverse", three.Match.ToString());
            Assert.AreEqual(2, one.ValueCount);
            Assert.AreEqual((PDFColor)"#222", three.GetValue(StyleKeys.BgColorKey, PDFColors.Transparent));
            Assert.AreEqual((PDFColor)"#808080", three.GetValue(StyleKeys.FillColorKey, PDFColors.Transparent));
        }
Exemplo n.º 20
0
        public IRenderNode RenderDocument()
        {
            var document      = _window.Document;
            var currentSheets = document.GetStyleSheets().OfType <ICssStyleSheet>();
            var stylesheets   = _defaultSheets.Concat(currentSheets);
            var collection    = new StyleCollection(stylesheets, _device);

            return(RenderElement(document.DocumentElement, collection));
        }
Exemplo n.º 21
0
 public Chart(IDocument document, XElement node, XElement parentNode) : base(parentNode, document)
 {
     Node        = node;
     Styles      = new StyleCollection();
     ChartStyles = new ChartStyles(this);
     Document.EmbedObjects.Add(this);
     Document.DocumentMetadata.ObjectCount += 1;
     InitStandards();
 }
Exemplo n.º 22
0
    private void method_20()
    {
        StyleCollection styles = this.class422_0.method_15().Styles;

        for (int i = 0; i < styles.Count; i++)
        {
            this.class974_0.method_5(styles[i] as Style);
        }
    }
Exemplo n.º 23
0
        public static StyleCollection ToStyleCollection(this IDictionary <string, string> dictionary)
        {
            var styleCollection = new StyleCollection();

            foreach (var key in dictionary.Keys)
            {
                styleCollection[key] = dictionary[key];
            }
            return(styleCollection);
        }
Exemplo n.º 24
0
        public void StyleCollection_CreateNew()
        {
            // Arrange

            // Act
            var list = new StyleCollection();

            // Assert
            Assert.IsNotNull(list);
        }
Exemplo n.º 25
0
		public void GetStyleByName_Null()
		{
			TextDocument document = new TextDocument();
			document.New();
			StyleCollection collection = new StyleCollection();
			IStyle nullStyle = new TableStyle(document, string.Empty);
			collection.Add(nullStyle);
			
			Assert.AreEqual(nullStyle, collection.GetStyleByName(null));
		}
Exemplo n.º 26
0
 private void AssertInnerStyles(PDFContextBase context)
 {
     if (!string.IsNullOrEmpty(this.Contents))
     {
         if (null == this._innerItems)
         {
             this._innerItems = CreateInnerStyles(context);
         }
     }
 }
Exemplo n.º 27
0
 public static StyleCollection getInstance()
 {
     if (m_instance == null)
     {
         m_instance = new StyleCollection();
         m_instance.buildAssetsDescription();
         m_instance.buildAssets();
     }
     return(m_instance);
 }
Exemplo n.º 28
0
 internal static void smethod_0(StyleCollection A_0, bool A_1)
 {
     foreach (Style style in A_0)
     {
         if (style.StyleType == StyleType.ParagraphStyle)
         {
             smethod_1(style.ParaPr);
         }
     }
 }
Exemplo n.º 29
0
        public async Task NullSelectorStillWorks_Issue52()
        {
            var sheet    = ParseStyleSheet("a {}");
            var document = await sheet.Context.OpenAsync(res => res.Content("<body></body>"));

            sheet.Add(new CssStyleRule(sheet));
            var sc   = new StyleCollection(new[] { sheet }, new DefaultRenderDevice());
            var decl = sc.ComputeCascadedStyle(document.Body);

            Assert.IsNotNull(decl);
        }
Exemplo n.º 30
0
 private void OnDestroy()
 {
     foreach (var bodyPartAvailable in collection.getAvailableBodyParts())
     {
         var key             = StyleCollection.bodyPartToString(bodyPartAvailable);
         var spriteMeshDatas = collection.getCustomizerData(bodyPartAvailable);
         var currentId       = spriteMeshDatas.getCurrentMeshId();
         PlayerPrefs.SetString(key, currentId);
     }
     collection.unloadAllAssets();
 }
Exemplo n.º 31
0
        public void TestStyleCollection()
        {
            var indexGrama = new StyleCollection
            {
                ["a"] = "b",
                ["c"] = "d",
            };

            Assert.Equal("a:b;c:d", indexGrama.ToString());

            StyleCollection array = new[] { ("a", "b"), ("c", "d") };
Exemplo n.º 32
0
        public void StyleCollection_OuterXml_EmptyXml()
        {
            // Arrange
            var list = new StyleCollection();

            // Act
            var xml = list.OuterXml;

            // Assert
            Assert.IsTrue(string.IsNullOrEmpty(xml));
        }
Exemplo n.º 33
0
        public void StyleCollection_IsReadOnly()
        {
            // Arrange
            var list = new StyleCollection();

            // Act
            var value = list.IsReadOnly;

            // Assert
            Assert.IsFalse(value);
        }
Exemplo n.º 34
0
        public void StyleCollection_GetEnumerator()
        {
            // Arrange
            var list = new StyleCollection();

            // Act
            var enumerator = list.GetEnumerator();

            // Assert
            Assert.IsNotNull(enumerator);
        }
Exemplo n.º 35
0
        public void AddsAttributeNameValueCorrectly()
        {
            string name = "Name";
            string value = "Value";

            StyleCollection styles = new StyleCollection();
            StyleAttributeBuilder builder = new StyleAttributeBuilder( styles );

            var result = builder.Style( name, value );

            Assert.AreSame( builder, result );
            Assert.AreEqual( value, styles[ name ] );
        }
Exemplo n.º 36
0
 public GUI()
 {
     InitializeComponent();
     texFile = new FileManager();
     bibFile = new FileManager();
     bibRecordsCurrent = new BibTeXRecordsCollection();
     bibRecordsReference = new BibTeXRecordsCollection();
     isFilesOpened = false;
     gridViewEntryDetail.EditMode = DataGridViewEditMode.EditOnEnter;
     bibEntryContent = new BibTeXEntryContent();
     styleCollection = new StyleCollection();
     styleInterpreter = new StyleInterpreter(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + @"\Style.xml");
 }
Exemplo n.º 37
0
        public void ReturnsCorrectly()
        {
            string definitionName1 = "DefinitionName1";
            string definitionValue1 = "DefinitionValue1";

            string definitionName2 = "DefinitionName2";
            string definitionValue2 = "DefinitionValue2";

            var styles = new StyleCollection();
            styles.Add( definitionName1, definitionValue1 );
            styles.Add( definitionName2, definitionValue2 );

            var result = styles.ToString();

            string expectedResult = string.Format( "{0}:{1};{2}:{3}", definitionName1, definitionValue1, definitionName2, definitionValue2 );
            Assert.AreEqual( expectedResult, result );
        }
Exemplo n.º 38
0
		internal static void AddBuildIn(StyleCollection<NumberFormatXmlWrapper> NumberFormats)
		{
			NumberFormats.Add("General", new NumberFormatXmlWrapper(true) { NumFmtId = 0, Format = "General" });
			NumberFormats.Add("0", new NumberFormatXmlWrapper(true) { NumFmtId = 1, Format = "0" });
			NumberFormats.Add("0.00", new NumberFormatXmlWrapper(true) { NumFmtId = 2, Format = "0.00" });
			NumberFormats.Add("#,##0", new NumberFormatXmlWrapper(true) { NumFmtId = 3, Format = "#,##0" });
			NumberFormats.Add("#,##0.00", new NumberFormatXmlWrapper(true) { NumFmtId = 4, Format = "#,##0.00" });
			NumberFormats.Add("0%", new NumberFormatXmlWrapper(true) { NumFmtId = 9, Format = "0%" });
			NumberFormats.Add("0.00%", new NumberFormatXmlWrapper(true) { NumFmtId = 10, Format = "0.00%" });
			NumberFormats.Add("0.00E+00", new NumberFormatXmlWrapper(true) { NumFmtId = 11, Format = "0.00E+00" });
			NumberFormats.Add("# ?/?", new NumberFormatXmlWrapper(true) { NumFmtId = 12, Format = "# ?/?" });
			NumberFormats.Add("# ??/??", new NumberFormatXmlWrapper(true) { NumFmtId = 13, Format = "# ??/??" });
			NumberFormats.Add("mm-dd-yy", new NumberFormatXmlWrapper(true) { NumFmtId = 14, Format = "mm-dd-yy" });
			NumberFormats.Add("d-mmm-yy", new NumberFormatXmlWrapper(true) { NumFmtId = 15, Format = "d-mmm-yy" });
			NumberFormats.Add("d-mmm", new NumberFormatXmlWrapper(true) { NumFmtId = 16, Format = "d-mmm" });
			NumberFormats.Add("mmm-yy", new NumberFormatXmlWrapper(true) { NumFmtId = 17, Format = "mmm-yy" });
			NumberFormats.Add("h:mm AM/PM", new NumberFormatXmlWrapper(true) { NumFmtId = 18, Format = "h:mm AM/PM" });
			NumberFormats.Add("h:mm:ss AM/PM", new NumberFormatXmlWrapper(true) { NumFmtId = 19, Format = "h:mm:ss AM/PM" });
			NumberFormats.Add("h:mm", new NumberFormatXmlWrapper(true) { NumFmtId = 20, Format = "h:mm" });
			//NumberFormats.Add("h:mm:dd", new NumberFormatXmlWrapper(true) { NumFmtId = 21, Format = "h:mm:dd" });
			NumberFormats.Add("m/d/yy h:mm", new NumberFormatXmlWrapper(true) { NumFmtId = 22, Format = "m/d/yy h:mm" });
			NumberFormats.Add("#,##0 ;(#,##0)", new NumberFormatXmlWrapper(true) { NumFmtId = 37, Format = "#,##0 ;(#,##0)" });
			NumberFormats.Add("#,##0 ;[Red](#,##0)", new NumberFormatXmlWrapper(true) { NumFmtId = 38, Format = "#,##0 ;[Red](#,##0)" });
			NumberFormats.Add("#,##0.00;(#,##0.00)", new NumberFormatXmlWrapper(true) { NumFmtId = 39, Format = "#,##0.00;(#,##0.00)" });
			NumberFormats.Add("#,##0.00;[Red](#,#)", new NumberFormatXmlWrapper(true) { NumFmtId = 40, Format = "#,##0.00;[Red](#,#)" });
			NumberFormats.Add("mm:ss", new NumberFormatXmlWrapper(true) { NumFmtId = 45, Format = "mm:ss" });
			NumberFormats.Add("[h]:mm:ss", new NumberFormatXmlWrapper(true) { NumFmtId = 46, Format = "[h]:mm:ss" });
			NumberFormats.Add("mmss.0", new NumberFormatXmlWrapper(true) { NumFmtId = 47, Format = "mmss.0" });
			NumberFormats.Add("##0.0", new NumberFormatXmlWrapper(true) { NumFmtId = 48, Format = "##0.0" });
			NumberFormats.Add("@", new NumberFormatXmlWrapper(true) { NumFmtId = 49, Format = "@" });

			NumberFormats.NextId = 164;
		}
Exemplo n.º 39
0
        /// <summary>
        /// Provides a way to specify an expression for all of the HTML style attributes values.
        /// </summary>
        /// <param name="styleAttributeExpression">An expression that contains the HTML style attribute values to set for the element.</param>
        /// <returns>The same instance of <see cref="Hex.AttributeBuilders.HtmlAttributeBuilder"/>.</returns>
        public HtmlAttributeBuilder Styles( Action<StyleAttributeBuilder> styleAttributeExpression )
        {
            if( styleAttributeExpression != null )
            {
                StyleCollection styles = null;
                if( !this.Attributes.TryGetValue<StyleCollection>( HtmlAttributes.Style, out styles ) )
                {
                    styles = new StyleCollection();
                    this.Attributes[ HtmlAttributes.Style ] = styles;
                }

                styleAttributeExpression( new StyleAttributeBuilder( styles ) );
            }

            return this;
        }
 public BaseWebControl()
 {
     _styles = new StyleCollection(this);
 }
Exemplo n.º 41
0
 /// <summary>
 /// Instaniates a new instance of <see cref="Hex.AttributeBuilders.StyleAttributeBuilder"/>.
 /// </summary>
 /// <param name="styles"></param>
 public StyleAttributeBuilder( StyleCollection styles )
 {
     this.Styles = styles;
 }
Exemplo n.º 42
0
 public static ILayer CreateRandomPointLayerWithLabel(IProvider dataSource)
 {
     var styleList = new StyleCollection
         {
             new SymbolStyle {SymbolScale = 1, Fill = new Brush(Color.Indigo)},
             new LabelStyle {Text = "TestLabel", HorizontalAlignment = LabelStyle.HorizontalAlignmentEnum.Left, Offset = new Offset{ X= 16.0 }}
         };
     return new Layer("pointLayer") { DataSource = dataSource, Style = styleList };
 }
Exemplo n.º 43
0
        private void Load(CompoundFile doc)
        {
            Stream stream;
            try
            {
                // see if workbook works
                stream = doc.OpenStream("Workbook");
            }
            catch (IOException)
            {
                // see if book works, if not then leak the exception
                stream = doc.OpenStream("Book");
            }

            SstRecord sst = null;
            /* long sstPos = 0; */

            // record position dictionary
            SortedList<long, Biff> records = new SortedList<long, Biff>();

            _styles = new StyleCollection(this);
            _formats = new FormatCollection(this);
            _fonts = new FontCollection(this);
            _palette = new Palette(this);
            _hyperLinks = new HyperLinkCollection(this);

            while (stream.Length - stream.Position >= GenericBiff.MinimumSize)
            {
                // capture the current stream position
                long pos = stream.Position;

                // decode the record if possible
                Biff record = GetCorrectRecord(new GenericBiff(stream), stream, sst);

                // capture 
                // shared string table 
                if (record is SstRecord)
                {
                    Debug.Assert(sst == null);
                    sst = (SstRecord)record;
                    /* sstPos = pos; */
                }
                // formatting records
                else if (record is FormatRecord)
                {
                    FormatRecord f = (FormatRecord)record;
                    _formats.Add(f.Index, new Format(this, f));
                }
                else if (record is FontRecord)
                    _fonts.Add(new Font(this, (FontRecord)record));
                else if (record is PaletteRecord)
                    _palette.Initialize((PaletteRecord)record);
                else if (record is XfRecord)
                    _styles.Add(new Style(this, (XfRecord)record));
                else if (record is HyperLinkRecord)
                    _hyperLinks.Add((HyperLinkRecord)record);

                Debug.Assert(!records.ContainsKey(pos));
                // store the position and corresponding record
                records[pos] = record;
            }

            // generate the worksheets
            _sheets = new WorksheetCollection();
            foreach (Biff record in records.Values)
            {
                if (record is BoundSheetRecord)
                    _sheets.Add(new Worksheet(this, (BoundSheetRecord)record, records));
            }
        }
Exemplo n.º 44
0
        private ILayer CreateRandomPointLayerWithLabel(IProvider dataSource, Stream bitmapStream)
        {
            var bitmapId = BitmapRegistry.Instance.Register(bitmapStream);
            var styles = new StyleCollection
                {
                    new SymbolStyle { BitmapId = bitmapId, SymbolRotation = 45.0},
                    new LabelStyle {Text = "TestLabel"}
                };

            return new Layer("pointLayer") { DataSource = dataSource, Style = styles };
        }