public void TestClassContainer() { var doc = new Scriber.Document(); var spanStyle = new StyleContainer(".class"); doc.Styles.Add(spanStyle); var text = new TextLeaf("text") { Document = doc }; text.Classes.Add("class"); spanStyle.Set(StyleKeys.FontSize, Unit.FromPoint(20)); var fontSize = text.Style.Get(StyleKeys.FontSize); Assert.Equal(20, fontSize.Point); }
public static void Main(string[] args) { if (args.Length > 0 && args[0] == "-t") { Renderer termrend = new Renderer(); StyleContainer termcont = new StyleContainer(new StreamReader("Test.css").ReadToEnd()); HtmlLayout termhtml = new HtmlLayout(new StreamReader("Test.html").ReadToEnd()); termhtml.CSS = termcont; State termstate = new State(termhtml); termhtml.Render(termrend, true); termrend.Term_Render(); // Render any script changes termhtml.Render(termrend, true); termrend.Term_Render(); Console.WriteLine(); return; } Bitmap map = new Bitmap(600, 600); Renderer rend = new Renderer(map); StyleContainer cont = new StyleContainer(new StreamReader("Test.css").ReadToEnd()); HtmlLayout html = new HtmlLayout(new StreamReader("Test.html").ReadToEnd()); html.CSS = cont; State jsstate = new State(html); html.Render(rend); jsstate.ProcessEvents(); html.Render(rend); // Save rendered frame to file rend.Save("Output.png"); }
public static void AddStyle(CompilerState state, string selector, DynamicDictionary style) { var styleSelector = StyleSelectorParser.Parse(selector); var container = new StyleContainer(styleSelector); foreach (var(name, value) in style.GetContents()) { if (value == null) { state.Context.Logger.Warning($"Style contains null value for property '{name}'."); continue; } var propName = StringUtility.ToPascalCase(name); if (StyleKeys.TryGetByName(propName, out var styleKey) && state.Context.Converters.TryConvert(value, styleKey.Type, out var propertyValue)) { styleKey.Set(container, propertyValue); } } state.Document.Styles.Add(container); }
public CellConditionControl() { InitializeComponent(); lblCondition.Text = Localization.ValueCondition_Label; AppearanceItem.Header = Localization.CellConditionControl_AppearanceItem; CellAppearanceItem.Header = Localization.CellConditionControl_CellAppearanceItem; ProgressBarItem.Header = Localization.CellConditionControl_ProgressBarItem; ImageItem.Header = Localization.CellConditionControl_ImageItem; lblShowValue.Text = Localization.ShowValue_Check; lblShowImage.Text = Localization.ShowImage_Check; lblShowProgressBar.Text = Localization.ShowProgressBar_Check; lblUseBackColor.Text = Localization.UseBackColor_Check; lblUseForeColor.Text = Localization.UseForeColor_Check; lblUseBorderColor.Text = Localization.UseBorderColor_Check; lblUseAllOptions.Text = Localization.UseAllOptions_Check; lblIgnoreAllOptions.Text = Localization.IgnoreAllOptions_Check; lblBackColor.Text = Localization.BackColor_Label; lblForeColor.Text = Localization.ForeColor_Label; lblBorderColor.Text = Localization.BorderColor_Label; lblMinValue.Text = Localization.MinValue_Label; lblMaxValue.Text = Localization.MaxValue_Label; lblStartColor.Text = Localization.StartColor_Label; lblEndColor.Text = Localization.EndColor_Label; lblImage.Text = Localization.Image_Label; btnChangeCustomImage.Content = Localization.ChangeCustomImage_Caption; // Стилизуем скроллеры StyleContainer styleContainer = new StyleContainer(); if (styleContainer.Resources != null && styleContainer.Resources.Contains("ScrollViewerGlowStyle")) { Scroller.Style = styleContainer.Resources["ScrollViewerGlowStyle"] as Style; } Ranet.AgOlap.Features.ScrollViewerMouseWheelSupport.AddMouseWheelSupport(Scroller); }
private void ExportReportSubheader(NPOI.SS.UserModel.ISheet sheet, vmAdmin_PerformanceFilter filter, StyleContainer allStyles, ref int rowNumber) { var row = sheet.CreateRow(rowNumber++); if (filter.EventId.HasValue && filter.EventId.Value > 0) { var thisEvent = _service.GetEventById(filter.EventId.Value); ReportUtilities.CreateCell(row, 0, string.Format("{0} - {1}", thisEvent.GeneralLocality, thisEvent.EventDates.Min().DateOfEvent.ToShortDateString()), allStyles.Header2Style); row = sheet.CreateRow(rowNumber++); } else { if (filter.startDate.HasValue) { var value = string.Format("Events from {0} to {1}", filter.startDate.Value.ToShortDateString(), filter.endDate.Value.ToShortDateString()); ReportUtilities.CreateCell(row, 0, value, allStyles.Header2Style); row = sheet.CreateRow(rowNumber++); } } }
public DefineSharedStyle(StyleContainer parent, string id) : base(parent) { this.m_styleProps = new StyleProperties(); this.m_id = id; }
private static void ExportReportTshirts(vmAdmin_PerformanceReport report, NPOI.SS.UserModel.ISheet sheet, StyleContainer allStyles, ref int rowNumber) { if (report.TShirtSizes != null && report.TShirtSizes.Count > 0) { var row = sheet.CreateRow(rowNumber++); ReportUtilities.CreateCell(row, 0, "T-Shirts", allStyles.Header3Style); foreach (var size in report.TShirtSizes) { row = sheet.CreateRow(rowNumber++); ReportUtilities.CreateCell(row, 0, size.Keys.ElementAt(0).ToString(), allStyles.LeftAligned); ReportUtilities.CreateCell(row, 1, size.Values.ElementAt(0), allStyles.RightAligned); } row = sheet.CreateRow(rowNumber++); } }
private static void ExportReportValues(vmAdmin_PerformanceReport report, NPOI.SS.UserModel.ISheet sheet, StyleContainer allStyles, ref int rowNumber) { var row = sheet.CreateRow(rowNumber++); ReportUtilities.CreateCell(row, 0, "Event Revenue", allStyles.LeftAligned); ReportUtilities.CreateCell(row, 1, report.TotalRevenue, allStyles.Currency); ReportUtilities.CreateCell(row, 2, "Available Spots", allStyles.LeftAligned); ReportUtilities.CreateCell(row, 3, report.TotalSpots, allStyles.RightAligned); ReportUtilities.CreateCell(row, 4, "Fee Total", allStyles.LeftAligned); ReportUtilities.CreateCell(row, 5, report.FeeValue, allStyles.Currency); ReportUtilities.CreateCell(row, 6, "Charge Total", allStyles.LeftAligned); ReportUtilities.CreateCell(row, 7, report.ChargeValue, allStyles.Currency); row = sheet.CreateRow(rowNumber++); ReportUtilities.CreateCell(row, 0, "Days count", allStyles.LeftAligned); ReportUtilities.CreateCell(row, 1, report.DayCount, allStyles.RightAligned); ReportUtilities.CreateCell(row, 2, "Active Registrations", allStyles.LeftAligned); ReportUtilities.CreateCell(row, 3, report.SpotsTaken, allStyles.RightAligned); ReportUtilities.CreateCell(row, 4, "Discount value", allStyles.LeftAligned); ReportUtilities.CreateCell(row, 5, report.DiscountValue, allStyles.Currency); ReportUtilities.CreateCell(row, 6, "Local Tax", allStyles.LeftAligned); ReportUtilities.CreateCell(row, 7, report.ChargeLocalTaxValue, allStyles.Currency); row = sheet.CreateRow(rowNumber++); ReportUtilities.CreateCell(row, 0, "Event count", allStyles.LeftAligned); ReportUtilities.CreateCell(row, 1, report.EventCount, allStyles.RightAligned); ReportUtilities.CreateCell(row, 2, "Spots Available", allStyles.LeftAligned); ReportUtilities.CreateCell(row, 3, report.SpotsLeft, allStyles.RightAligned); ReportUtilities.CreateCell(row, 4, "Local Tax", allStyles.LeftAligned); ReportUtilities.CreateCell(row, 5, report.LocalTaxValue, allStyles.Currency); ReportUtilities.CreateCell(row, 6, "State Tax", allStyles.LeftAligned); ReportUtilities.CreateCell(row, 7, report.ChargeStateTaxValue, allStyles.Currency); row = sheet.CreateRow(rowNumber++); ReportUtilities.CreateCell(row, 0, "Revenue Per Day", allStyles.LeftAligned); ReportUtilities.CreateCell(row, 1, report.RevenuePerDay, allStyles.Currency); ReportUtilities.CreateCell(row, 2, "Registrations Per Day", allStyles.LeftAligned); ReportUtilities.CreateCell(row, 3, report.RegPerDay, allStyles.RightAligned); ReportUtilities.CreateCell(row, 4, "State Tax", allStyles.LeftAligned); ReportUtilities.CreateCell(row, 5, report.StateTaxValue, allStyles.Currency); ReportUtilities.CreateCell(row, 6, "Total Revenue", allStyles.LeftAligned); ReportUtilities.CreateCell(row, 7, report.ChargeActualRevenue, allStyles.Currency); row = sheet.CreateRow(rowNumber++); ReportUtilities.CreateCell(row, 0, "Revenue Per Event", allStyles.LeftAligned); ReportUtilities.CreateCell(row, 1, report.RevenuePerEvent, allStyles.Currency); row.CreateCell(2); row.CreateCell(3); ReportUtilities.CreateCell(row, 4, "Total Revenue", allStyles.LeftAligned); ReportUtilities.CreateCell(row, 5, report.FeeActualRevenue, allStyles.Currency); row.CreateCell(6); row.CreateCell(7); row = sheet.CreateRow(rowNumber++); }
private static void ExportReportCharges(vmAdmin_PerformanceReport report, NPOI.SS.UserModel.ISheet sheet, StyleContainer allStyles, ref int rowNumber) { if (report.ChargeReport.Count > 0) { var row = sheet.CreateRow(rowNumber++); ReportUtilities.CreateCell(row, 0, "Event Charges", allStyles.Header2Style); row = sheet.CreateRow(rowNumber++); ReportUtilities.CreateCell(row, 0, "Name", allStyles.TitleStyle); ReportUtilities.CreateCell(row, 1, "Cost Total", allStyles.TitleStyle); ReportUtilities.CreateCell(row, 2, "Discount Total", allStyles.TitleStyle); ReportUtilities.CreateCell(row, 3, "Local Tax Total", allStyles.TitleStyle); ReportUtilities.CreateCell(row, 4, "State Tax Total", allStyles.TitleStyle); ReportUtilities.CreateCell(row, 5, "Actual Total", allStyles.TitleStyle); foreach (var charge in report.ChargeReport.OrderBy(x => x.Name)) { row = sheet.CreateRow(rowNumber++); ReportUtilities.CreateCell(row, 0, charge.Name, allStyles.LeftAligned); ReportUtilities.CreateCell(row, 1, charge.CostTotal, allStyles.Currency); ReportUtilities.CreateCell(row, 2, charge.DiscountTotal, allStyles.Currency); ReportUtilities.CreateCell(row, 3, charge.LocalTaxTotal, allStyles.Currency); ReportUtilities.CreateCell(row, 4, charge.StateTaxTotal, allStyles.Currency); ReportUtilities.CreateCell(row, 5, charge.ActualTotal, allStyles.Currency); } } }
private static void ExportReportFees(vmAdmin_PerformanceReport report, NPOI.SS.UserModel.ISheet sheet, StyleContainer allStyles, ref int rowNumber) { if (report.FeeReport.Count > 0) { var row = sheet.CreateRow(rowNumber++); ReportUtilities.CreateCell(row, 0, "Event Fees", allStyles.Header2Style); foreach (var feeType in report.FeeReport.GroupBy(x => x.FeeType).Select(x => x.Key)) { row = sheet.CreateRow(rowNumber++); ReportUtilities.CreateCell(row, 0, feeType.ToString(), allStyles.Header3Style); row = sheet.CreateRow(rowNumber++); ReportUtilities.CreateCell(row, 0, "Cost", allStyles.TitleStyle); ReportUtilities.CreateCell(row, 1, "Use Count", allStyles.TitleStyle); ReportUtilities.CreateCell(row, 2, "Cost Total", allStyles.TitleStyle); ReportUtilities.CreateCell(row, 3, "Discount Total", allStyles.TitleStyle); ReportUtilities.CreateCell(row, 4, "Local Tax Total", allStyles.TitleStyle); ReportUtilities.CreateCell(row, 5, "State Tax Total", allStyles.TitleStyle); ReportUtilities.CreateCell(row, 6, "Actual Total", allStyles.TitleStyle); foreach (var fee in report.FeeReport.Where(x => x.FeeType == feeType).OrderBy(x => x.Cost)) { row = sheet.CreateRow(rowNumber++); ReportUtilities.CreateCell(row, 0, fee.Cost, allStyles.Currency); ReportUtilities.CreateCell(row, 1, fee.UseCount, allStyles.RightAligned); ReportUtilities.CreateCell(row, 2, fee.CostTotal, allStyles.Currency); ReportUtilities.CreateCell(row, 3, fee.DiscountTotal, allStyles.Currency); ReportUtilities.CreateCell(row, 4, fee.LocalTaxTotal, allStyles.Currency); ReportUtilities.CreateCell(row, 5, fee.StateTaxTotal, allStyles.Currency); ReportUtilities.CreateCell(row, 6, fee.ActualTotal, allStyles.Currency); } row = sheet.CreateRow(rowNumber++); } } }
protected StyleState(StyleContainer parent) { this.m_context = parent; }
private void OnDestroy() { Instance = null; }
public new void Render(Renderer rend, bool terminal = false) { _Rend = rend; if (terminal) { rend.Term_Clear(); } else { rend.Clear(); } LineY = 0; LineX = 0; int lasty = -1; foreach (HtmlNode elem in Elements) { HtmlAttribute x = elem.Get("x"); HtmlAttribute y = elem.Get("y"); CSSElement csselem = null; if (csselem == null) { HtmlAttribute style = elem.Get("style"); if (style != null) { csselem = StyleContainer.ParseStyleString(style.Value); } } if (CSS != null && csselem == null) { csselem = CSS.Get(elem.Tag); } int lf = -1; if (csselem != null) { Style left = csselem.Get("left"); if (left != null) { lf = int.Parse(left.Value); } } if (LineY != lasty) { lasty = LineY; LeftPadToPosition(lf); } if (elem.Tag == "RECT" && (x != null && y != null)) { int xi = int.Parse(x.Value); int yi = int.Parse(y.Value); if (!terminal) { rend.DrawRect(new Rectangle(xi, yi, 200, 200), GetColor(csselem.Get(elem.Tag))); } continue; } if (elem.Tag == "P") { if (terminal) { rend.Term_DrawString(elem.TagBody, new PointF(0, 0)); continue; } rend.DrawString(elem.TagBody, new PointF(LineX, LineY)); LineX += (int)rend.Measure(elem.TagBody).Width; } if (elem.Tag.StartsWith("H") && elem.Tag.Length == 2) { rend.Term_DrawString("<BOLD>" + elem.TagBody, new Point(0, 0)); rend.Term_DrawString("\n\n", new PointF(0, 0)); } if (elem.Tag == "IMG") { if (terminal) { WebImage image = new WebImage(elem); for (int i = 0; i < image.SizeY; i++) { LeftPadToPosition(lf); // Pad to the left style property // Get pixel(character and color) data and draw it foreach (WebImage.PixelData pixel in image.GetRow(i)) { rend.Term_DrawString("" + pixel.Character, new PointF(0, 0), pixel.Color); } if (i != image.SizeY - 1) { rend.Term_DrawString("\n", new PointF(0, 0)); LineY += 1; LineX = 0; } } } } if (elem.Tag == "B") { if (csselem.Get("background") != null) { if (terminal) { LineX += elem.TagBody.Length; rend.Term_DrawString(elem.TagBody, new PointF(0, 0), GetColor(csselem.Get("background")), GetColor(csselem.Get("color"))); continue; } SizeF bounds = rend.Measure(elem.TagBody, rend.Bold); rend.DrawRect(new Rectangle(LineX, LineY, (int)bounds.Width, (int)bounds.Height), GetColor(csselem.Get("background"))); } if (terminal) { rend.Term_DrawString(elem.TagBody, new PointF(0, 0), ColorEnum.White, GetColor(csselem.Get("color"))); LineX += elem.TagBody.Length; continue; } rend.DrawString(elem.TagBody, new PointF(LineX, LineY), rend.Bold, GetColor(csselem.Get("color"))); LineX += (int)rend.Measure(elem.TagBody).Width; } if (elem.Tag == "SCRIPT") { JSState.Engine.Execute(elem.TagBody); } if (elem.Tag == "BR") { if (terminal) { LineX = 0; LineY += 1; rend.Term_DrawString("\n", new PointF(0, 0)); continue; } LineX = 0; LineY += (int)rend.Measure("A").Height; } } }
internal InstanceStyle(StyleContainer aParent) : base(aParent) { m_xf = new BIFF8Style(); }
public InstanceStyle(StyleContainer aParent) : base(aParent) { this.m_xf = new BIFF8Style(); }
internal UseSharedStyle(StyleContainer parent, StyleProperties props) : base(parent) { m_styleProps = props; }
internal DefineSharedStyle(StyleContainer parent, string id) : base(parent) { m_styleProps = new StyleProperties(); m_id = id; }
private void Awake() { Instance = this; }
public UseSharedStyle(StyleContainer parent, StyleProperties props) : base(parent) { this.m_styleProps = props; }