private void AddToBandAndGetCommonProperties(StiComponent comp)
        {
            double height = GetDouble("HEIGHT");
            double width  = GetDouble("WIDTH");
            double hpos   = GetDouble("HPOS");
            double vpos   = GetDouble("VPOS");

            if ((comp is StiVerticalLinePrimitive) || (comp is StiRectanglePrimitive))
            {
                StiStartPointPrimitive start = new StiStartPointPrimitive();
                start.ReferenceToGuid = comp.Guid;
                AddToBand(start, hpos, vpos, 0, 0);

                StiEndPointPrimitive end = new StiEndPointPrimitive();
                end.ReferenceToGuid = comp.Guid;
                AddToBand(end, hpos + width, vpos + height, 0, 0);

                bands[0].Page.Components.Add(comp);
            }
            else
            {
                AddToBand(comp, hpos, vpos, width, height);
            }

            if (GetString("PLATFORM").Trim().ToLowerInvariant() != "windows")
            {
                comp.Enabled = false;
            }
        }
Beispiel #2
0
        private static double ConvertFromMillimeters(double value, StiComponent comp)
        {
            StiMillimetersUnit mmUnit = new StiMillimetersUnit();

            value = mmUnit.ConvertToHInches(value);
            return(comp.Report.Unit.ConvertFromHInches(value));
        }
        public override void Paint(StiComponent component, StiPaintEventArgs e)
        {
            DrawingContext dc = e.Context as DrawingContext;

            RectangleD rectD = component.GetPaintRectangle(true, false);
            Rect       rect  = new Rect(rectD.Left, rectD.Top, rectD.Width, rectD.Height);

            if (rect.Width > 0 && rect.Height > 0)
            {
                MyCustomComponent customComponent = component as MyCustomComponent;

                #region Fill rectangle
                PaintBackground(customComponent, dc, rect);
                #endregion

                #region Markers
                if (customComponent.HighlightState == StiHighlightState.Hide && customComponent.Border.Side != StiBorderSides.All)
                {
                    PaintMarkers(customComponent, dc, rect);
                }
                #endregion

                //Own drawing


                #region Border
                base.PaintBorder(customComponent, dc, rect, true, true);
                #endregion
            }

            PaintEvents(component, dc, rect);
            PaintConditions(component, dc, rect);
            PaintInteraction(component, dc);
        }
 /// <summary>
 /// Invokes a component designer.
 /// </summary>
 /// <param name="component">Component for edition.</param>
 /// <returns>The result of invokes the component designer.</returns>
 public override DialogResult Design(StiComponent component)
 {
     using (MyCustomComponentDesignerForm form = new MyCustomComponentDesignerForm())
     {
         return(form.ShowDialog());
     }
 }
Beispiel #5
0
 private void ReadTextBrush(XmlNode node, StiComponent comp)
 {
     if (comp is IStiTextBrush)
     {
         IStiTextBrush brushComp = comp as IStiTextBrush;
         brushComp.TextBrush = GetBrush(node, comp, "TextFill");
     }
 }
Beispiel #6
0
 private void ReadTextBrush(XRControl xtraControl, StiComponent comp)
 {
     if (comp is IStiTextBrush)
     {
         IStiTextBrush brushComp = comp as IStiTextBrush;
         brushComp.TextBrush = new StiSolidBrush(xtraControl.GetEffectiveForeColor());
     }
 }
Beispiel #7
0
 private void ReadFont(XRControl xtraControl, StiComponent comp)
 {
     if (comp is IStiFont)
     {
         IStiFont fontComp = comp as IStiFont;
         fontComp.Font = xtraControl.GetEffectiveFont();
     }
 }
        /// <summary>
        /// Rendering of the component without events.
        /// </summary>
        /// <param name="renderedComponent">Rendered component.</param>
        /// <param name="outContainer">Panel in which rendering will be done.</param>
        /// <returns>Is rendering finished or not.</returns>
        protected override bool RenderComponent(ref StiComponent renderedComponent, StiContainer outContainer)
        {
            MyCustomComponent component = (MyCustomComponent)this.Clone();

            component.InvokeEvents();
            outContainer.Components.Add(component);
            renderedComponent = component;
            return(true);
        }
Beispiel #9
0
 private void ReadBorder(XRControl xtraControl, StiComponent comp)
 {
     if (comp is IStiBorder)
     {
         IStiBorder borderComp = comp as IStiBorder;
         borderComp.Border.Color = xtraControl.GetEffectiveBorderColor();
         borderComp.Border.Style = ConvertBorderDashStyle(xtraControl.GetEffectiveBorderDashStyle());
         borderComp.Border.Side  = ConvertBorderSide(xtraControl.GetEffectiveBorders());
         borderComp.Border.Size  = xtraControl.GetEffectiveBorderWidth();
     }
 }
Beispiel #10
0
        private static double ReadDouble(XmlNode node, string name, StiComponent comp, double defaultValue)
        {
            XmlAttribute attr = node.Attributes[name];

            if (attr != null)
            {
                return(double.Parse(attr.Value.Replace(".", ",").Replace(",", Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator)));
            }
            else
            {
                return(defaultValue);
            }
        }
Beispiel #11
0
        private static int ReadInt(XmlNode node, string name, StiComponent comp, int defaultValue)
        {
            XmlAttribute attr = node.Attributes[name];

            if (attr != null)
            {
                return(int.Parse(attr.Value));
            }
            else
            {
                return(defaultValue);
            }
        }
Beispiel #12
0
        private static bool ReadBool(XmlNode node, string name, StiComponent comp, bool defaultValue)
        {
            XmlAttribute attr = node.Attributes[name];

            if (attr != null)
            {
                return(attr.Value.ToLowerInvariant() == "true");
            }
            else
            {
                return(defaultValue);//default value
            }
        }
Beispiel #13
0
        private void click(object sender, EventArgs e)
        {
            StiComponent comp       = sender as StiComponent;
            string       customerID = (string)comp.BookmarkValue;

            if (customerID != null)
            {
                StiReport report = new StiReport();
                report.RegData(dataSet1);
                report.Load("..\\Details.mrt");
                StiDataBand dataBand = (StiDataBand)report.Pages["Page1"].Components["DataBand1"];
                StiFilter   filter   = new StiFilter("{Orders.CustomerID==\"" + customerID + "\"}");
                dataBand.Filters.Add(filter);
                report.Show();
            }
        }
 /// <summary>
 /// Raises the GetCustomCode event.
 /// </summary>
 public void InvokeGetCustomCode(StiComponent sender, StiValueEventArgs e)
 {
     try
     {
         OnGetCustomCode(e);
         StiValueEventHandler handler = base.Events[EventGetCustomCode] as StiValueEventHandler;
         if (handler != null)
         {
             handler(sender, e);
         }
     }
     catch (Exception ex)
     {
         string str = string.Format("Expression in CustomCode property of '{0}' can't be evaluated!", this.Name);
         StiLogService.Write(this.GetType(), str);
         StiLogService.Write(this.GetType(), ex.Message);
         Report.WriteToReportRenderingMessages(str);
     }
 }
        private string ConvertExpression(string input, StiComponent comp)
        {
            if (comp == null)
            {
                comp      = new StiText();
                comp.Name = "*TextBox*";
                comp.Page = report.Pages[0];
            }

            var storeToPrint = false;
            //object aa = StiVisualFoxProParser.ParseTextValue(input, comp, comp, ref storeToPrint, false, true);
            object aa = StiVisualFoxProParser.ParseTextValue(input, comp, comp, ref storeToPrint, false);

            if (aa != null)
            {
                return(aa.ToString());
            }

            return(input);
        }
        private void AddToBand(StiComponent comp, double hpos, double vpos, double width, double height)
        {
            int    bandIndex = 0;
            double bandPos   = 0;

            while (vpos >= bandsTop[bandIndex] - 10)
            {
                bandPos = bandsTop[bandIndex];
                bandIndex++;
            }
            vpos -= bandPos;
            if (vpos < 10)
            {
                vpos = 0;
            }

            comp.ClientRectangle = new RectangleD(fru(hpos), fru(vpos), fru(width), fru(height));
            bands[bandIndex].Components.Add(comp);
            comp.Linked = true;
        }
Beispiel #17
0
        private void ReadComp(XRControl xtraControl, StiComponent comp)
        {
            comp.Name = xtraControl.Name;

            comp.Left   = ReadValueFrom(xtraControl.Report as XtraReportBase, xtraControl.LeftF);
            comp.Top    = ReadValueFrom(xtraControl.Report as XtraReportBase, xtraControl.TopF);
            comp.Width  = ReadValueFrom(xtraControl.Report as XtraReportBase, xtraControl.WidthF);
            comp.Height = ReadValueFrom(xtraControl.Report as XtraReportBase, xtraControl.HeightF);

            comp.CanGrow   = xtraControl.CanGrow;
            comp.CanShrink = xtraControl.CanShrink;
            comp.Enabled   = xtraControl.Visible;

            comp.Bookmark.Value  = xtraControl.Bookmark;
            comp.Hyperlink.Value = xtraControl.NavigateUrl;
            comp.Tag.Value       = xtraControl.Tag != null?xtraControl.Tag.ToString() : "";

            comp.AfterPrintEvent.Script  = xtraControl.Scripts.OnAfterPrint;
            comp.BeforePrintEvent.Script = xtraControl.Scripts.OnBeforePrint;

            comp.Enabled        = xtraControl.Visible;
            comp.ComponentStyle = xtraControl.StyleName;
        }
Beispiel #18
0
        public override void Paint(StiComponent component, StiPaintEventArgs e)
        {
            Graphics g = e.Graphics;

            RectangleD rect = component.GetPaintRectangle();

            if (rect.Width > 0 && rect.Height > 0 && (e.ClipRectangle.IsEmpty || rect.IntersectsWith(e.ClipRectangle)))
            {
                MyCustomComponent customComponent = component as MyCustomComponent;

                #region Fill rectangle
                PaintBackground(customComponent, g, rect);
                #endregion

                #region Markers
                if (customComponent.HighlightState == StiHighlightState.Hide && customComponent.Border.Side != StiBorderSides.All)
                {
                    PaintMarkers(customComponent, g, rect);
                }
                #endregion

                RectangleD borderRect = rect;

                //Own drawing


                #region Border
                base.PaintBorder(customComponent, g, borderRect);
                #endregion
            }

            PaintEvents(component, e.Graphics, rect);
            PaintConditions(component, e.Graphics, rect);
            PaintQuickButtons(component, e.Graphics);
            PaintInteraction(component, e.Graphics);
        }
Beispiel #19
0
        public override void Paint(StiComponent component, StiPaintEventArgs e)
        {
            Graphics   g    = e.Graphics;
            RectangleD rect = component.GetPaintRectangle();

            RectangleF rectF = rect.ToRectangleF();

            g.DrawRectangle(Pens.Gray, rectF.Left, rectF.Top, rectF.Width, rectF.Height);

            MyCustomComponentWithExpression customComponent = component as MyCustomComponentWithExpression;

            using (StringFormat stringFormat = new StringFormat())
                using (Font font = new Font("Arial", (float)(15 * component.Page.Zoom)))
                    using (Brush brush = new SolidBrush(Color.Gray))
                    {
                        stringFormat.LineAlignment = StringAlignment.Center;
                        stringFormat.Alignment     = StringAlignment.Center;

                        string value = component.IsDesigning ? customComponent.CustomCode.Value : customComponent.CustomCodeValue;

                        StiTextDrawing.DrawString(g, value, font, brush,
                                                  new RectangleD(rect.Left, rect.Top, rect.Width, rect.Height), stringFormat);
                    }
        }
Beispiel #20
0
        private void ReadComp(XmlNode node, StiComponent comp)
        {
            comp.Name = ReadString(node, "Name", comp.Name);

            comp.Left   = ConvertFromFRUnit(ReadDouble(node, "Left", comp, comp.Left), comp);
            comp.Top    = ConvertFromFRUnit(ReadDouble(node, "Top", comp, comp.Top), comp);
            comp.Width  = ConvertFromFRUnit(ReadDouble(node, "Width", comp, comp.Width), comp);
            comp.Height = ConvertFromFRUnit(ReadDouble(node, "Height", comp, comp.Height), comp);

            comp.CanGrow         = ReadBool(node, "CanGrow", comp, true);
            comp.CanShrink       = ReadBool(node, "CanShrink", comp, true);
            comp.Printable       = ReadBool(node, "Printable", comp, true);
            comp.Enabled         = ReadBool(node, "Enabled", comp, true);
            comp.GrowToHeight    = ReadBool(node, "GrowToBottom", comp, false);
            comp.ComponentStyle  = ReadString(node, "Style", "");
            comp.Bookmark.Value  = ReadString(node, "Bookmark", "");
            comp.Hyperlink.Value = ReadString(node, "Hyperlink.Expression", "");

            #region Dock
            switch (ReadString(node, "Dock", "None"))
            {
            case "Bottom":
                comp.DockStyle = StiDockStyle.Bottom;
                break;

            case "Fill":
                comp.DockStyle = StiDockStyle.Fill;
                break;

            case "Left":
                comp.DockStyle = StiDockStyle.Left;
                break;

            case "None":
                comp.DockStyle = StiDockStyle.None;
                break;

            case "Right":
                comp.DockStyle = StiDockStyle.Right;
                break;

            case "Top":
                comp.DockStyle = StiDockStyle.Top;
                break;
            }
            #endregion

            #region ShiftMode
            switch (ReadString(node, "ShiftMode", "Always"))
            {
            case "Always":
                comp.ShiftMode = StiShiftMode.IncreasingSize | StiShiftMode.DecreasingSize;
                break;

            case "WhenOverlapped":
                comp.ShiftMode = StiShiftMode.IncreasingSize;
                break;

            case "Never":
                comp.ShiftMode = (StiShiftMode)0;
                break;
            }
            #endregion

            #region Restrictions
            XmlAttribute attr = node.Attributes["Restrictions"];
            if (attr != null)
            {
                if (attr.Value.Contains("DontModify"))
                {
                    comp.Restrictions &= Stimulsoft.Report.Components.StiRestrictions.AllowChange;
                }
                if (attr.Value.Contains("DontDelete"))
                {
                    comp.Restrictions &= Stimulsoft.Report.Components.StiRestrictions.AllowDelete;
                }
                if (attr.Value.Contains("DontMove"))
                {
                    comp.Restrictions &= Stimulsoft.Report.Components.StiRestrictions.AllowMove;
                }
                if (attr.Value.Contains("DontResize"))
                {
                    comp.Restrictions &= Stimulsoft.Report.Components.StiRestrictions.AllowResize;
                }
            }
            #endregion

            #region PrintOn
            attr = node.Attributes["PrintOn"];
            if (attr != null)
            {
                if (!attr.Value.Contains("FirstPage") && !attr.Value.Contains("LastPage"))
                {
                    comp.PrintOn = StiPrintOnType.ExceptFirstAndLastPage;
                }

                else if (!attr.Value.Contains("FirstPage") && attr.Value.Contains("LastPage"))
                {
                    comp.PrintOn = StiPrintOnType.ExceptFirstPage;
                }

                else if (attr.Value.Contains("FirstPage") && !attr.Value.Contains("LastPage"))
                {
                    comp.PrintOn = StiPrintOnType.ExceptLastPage;
                }

                IStiPrintOnEvenOddPages printOn = comp as IStiPrintOnEvenOddPages;
                if (printOn != null)
                {
                    if (attr.Value.Contains("OddPages") && attr.Value.Contains("EvenPages"))
                    {
                        printOn.PrintOnEvenOddPages = StiPrintOnEvenOddPagesType.Ignore;
                    }

                    else if (!attr.Value.Contains("OddPages") && attr.Value.Contains("EvenPages"))
                    {
                        printOn.PrintOnEvenOddPages = StiPrintOnEvenOddPagesType.PrintOnEvenPages;
                    }

                    else if (attr.Value.Contains("OddPages") && !attr.Value.Contains("EvenPages"))
                    {
                        printOn.PrintOnEvenOddPages = StiPrintOnEvenOddPagesType.PrintOnOddPages;
                    }
                }
            }
            #endregion

            #region PrintOn
            attr = node.Attributes["PrintOn"];
            if (attr != null)
            {
                if (!attr.Value.Contains("FirstPage") && !attr.Value.Contains("LastPage"))
                {
                    comp.PrintOn = StiPrintOnType.ExceptFirstAndLastPage;
                }

                else if (!attr.Value.Contains("FirstPage") && attr.Value.Contains("LastPage"))
                {
                    comp.PrintOn = StiPrintOnType.ExceptFirstPage;
                }

                else if (attr.Value.Contains("FirstPage") && !attr.Value.Contains("LastPage"))
                {
                    comp.PrintOn = StiPrintOnType.ExceptLastPage;
                }

                IStiPrintOnEvenOddPages printOn = comp as IStiPrintOnEvenOddPages;
                if (printOn != null)
                {
                    if (attr.Value.Contains("OddPages") && attr.Value.Contains("EvenPages"))
                    {
                        printOn.PrintOnEvenOddPages = StiPrintOnEvenOddPagesType.Ignore;
                    }

                    else if (!attr.Value.Contains("OddPages") && attr.Value.Contains("EvenPages"))
                    {
                        printOn.PrintOnEvenOddPages = StiPrintOnEvenOddPagesType.PrintOnEvenPages;
                    }

                    else if (attr.Value.Contains("OddPages") && !attr.Value.Contains("EvenPages"))
                    {
                        printOn.PrintOnEvenOddPages = StiPrintOnEvenOddPagesType.PrintOnOddPages;
                    }
                }
            }
            #endregion

            #region PrintOnBottom
            attr = node.Attributes["PrintOnBottom"];
            if (attr != null && comp is IStiPrintAtBottom)
            {
                ((IStiPrintAtBottom)comp).PrintAtBottom = ReadBool(node, "PrintOnBottom", comp, false);
            }
            #endregion

            #region StartNewPage
            attr = node.Attributes["StartNewPage"];
            if (attr != null && comp is IStiPageBreak)
            {
                ((IStiPageBreak)comp).NewPageBefore = ReadBool(node, "StartNewPage", comp, false);
            }
            #endregion

            #region RepeatOnEveryPage
            attr = node.Attributes["RepeatOnEveryPage"];
            if (attr != null && comp is IStiPrintOnAllPages)
            {
                ((IStiPrintOnAllPages)comp).PrintOnAllPages = ReadBool(node, "RepeatOnEveryPage", comp, false);
            }
            #endregion

            ReadBorder(node, comp);
            ReadBrush(node, comp);
            ReadTextBrush(node, comp);
        }
Beispiel #21
0
        private void SortBands(StiPage input)
        {
            int counterPageHeader  = 1000;
            int counterPageFooter  = 2000;
            int counterHeader      = 3000;
            int counterGroupHeader = 4000;
            int counterData        = 5000;
            int counterDetail      = 6000;
            int counterGroupFooter = 7000;
            int counterFooter      = 8000;
            int counterOther       = 10000;

            StiDataBand masterDataBand = null;

            Dictionary <int, StiComponent> dict = new Dictionary <int, StiComponent>();
            List <int> keys = new List <int>();

            foreach (StiComponent comp in input.Components)
            {
                int counter = 0;
                if (comp is StiPageHeaderBand)
                {
                    counter = counterPageHeader++;
                }
                if (comp is StiPageFooterBand)
                {
                    counter = counterPageFooter++;
                }
                if (comp is StiGroupHeaderBand)
                {
                    counter = counterGroupHeader++;
                }
                else if (comp is StiGroupFooterBand)
                {
                    counter = counterGroupFooter++;
                }
                else if (comp is StiHeaderBand)
                {
                    counter = counterHeader++;
                }
                else if (comp is StiFooterBand)
                {
                    counter = counterFooter++;
                }
                else if (comp is StiDataBand)
                {
                    counter        = counterData++;
                    masterDataBand = comp as StiDataBand;
                }
                else if (comp is StiPage)
                {
                    counter = counterDetail++;
                }
                else if (comp is StiChildBand)
                {
                    counter = counterData++;
                }
                else
                {
                    counter = counterOther++;
                }

                dict.Add(counter, comp);
                keys.Add(counter);
            }

            keys.Sort();

            StiComponentsCollection comps = new StiComponentsCollection(input);

            foreach (int key in keys)
            {
                StiComponent comp = dict[key];
                if (comp is StiPage)
                {
                    StiPage cont = comp as StiPage;
                    foreach (StiComponent comp2 in cont.Components)
                    {
                        StiDataBand band = comp2 as StiDataBand;
                        if ((band != null) && (band.MasterComponent == null))
                        {
                            band.MasterComponent = masterDataBand;
                        }
                        comps.Add(comp2);
                    }
                }
                else
                {
                    comps.Add(comp);
                }
            }
            input.Components = comps;
        }
Beispiel #22
0
 private static double ConvertFromFRUnit(double value, StiComponent comp)
 {
     value = value / 0.96;
     return(comp.Report.Unit.ConvertFromHInches(value));
 }
Beispiel #23
0
        private void ReadBorder(XmlNode node, StiComponent comp)
        {
            try
            {
                if (comp is IStiBorder)
                {
                    StiBorder border = ((IStiBorder)comp).Border;

                    #region Border.Color
                    border.Color = ReadColor(node, "Border.Color");
                    #endregion

                    #region Border.Lines
                    XmlAttribute attr = node.Attributes["Border.Lines"];
                    if (attr != null)
                    {
                        if (attr.Value == "All")
                        {
                            border.Side = StiBorderSides.All;
                        }
                        else
                        {
                            if (attr.Value.Contains("Left"))
                            {
                                border.Side |= StiBorderSides.Left;
                            }
                            if (attr.Value.Contains("Right"))
                            {
                                border.Side |= StiBorderSides.Right;
                            }
                            if (attr.Value.Contains("Top"))
                            {
                                border.Side |= StiBorderSides.Top;
                            }
                            if (attr.Value.Contains("Bottom"))
                            {
                                border.Side |= StiBorderSides.Bottom;
                            }
                        }
                    }
                    #endregion

                    #region Border.Width
                    border.Size = ReadDouble(node, "Border.Width", comp, 1d);
                    #endregion

                    #region Border.Style
                    attr = node.Attributes["Border.Style"];
                    if (attr != null)
                    {
                        switch (attr.Value)
                        {
                        case "Dash":
                            border.Style = StiPenStyle.Dash;
                            break;

                        case "DashDot":
                            border.Style = StiPenStyle.DashDot;
                            break;

                        case "DashDotDot":
                            border.Style = StiPenStyle.DashDotDot;
                            break;

                        case "Dot":
                            border.Style = StiPenStyle.Dot;
                            break;

                        case "Double":
                            border.Style = StiPenStyle.Double;
                            break;

                        case "Solid":
                            border.Style = StiPenStyle.Solid;
                            break;
                        }
                    }
                    #endregion

                    #region Border.Shadow
                    border.DropShadow = ReadBool(node, "Border.Shadow", comp, false);
                    #endregion

                    #region Border.ShadowWidth
                    border.ShadowSize = ReadDouble(node, "Border.ShadowWidth", comp, 4d);
                    #endregion

                    #region Border.ShadowColor
                    attr = node.Attributes["Border.ShadowColor"];
                    if (attr != null)
                    {
                        border.ShadowBrush = new StiSolidBrush(ReadColor(node, "Border.ShadowColor"));
                    }
                    #endregion
                }
            }
            catch
            {
            }
        }
 public String Text18_GetValue_End(StiComponent sender)
 {
     return(Text18.TextFormat.Format(CheckExcelValue(sender, ((decimal)(ChangeType(Text18_Sum1.GetValue(), typeof(decimal), true))) - ((decimal)(ChangeType(Text18_Sum2.GetValue(), typeof(decimal), true))))));
 }
        private List <StiToken> PostProcessTokensList(List <StiToken> tokensList)
        {
            List <StiToken> newList = new List <StiToken>();

            tokenPos = 0;
            while (tokenPos < tokensList.Count)
            {
                StiToken token = tokensList[tokenPos];
                tokenPos++;
                if (token.Type == StiTokenType.Identifier)
                {
                    StiDataSource     ds  = report.Dictionary.DataSources[token.Value];
                    StiBusinessObject bos = report.Dictionary.BusinessObjects[token.Value];

                    #region check for DataSource field
                    if (ds != null)
                    {
                        StringBuilder fieldPath = new StringBuilder(StiNameValidator.CorrectName(token.Value));
                        while (tokenPos + 1 < tokensList.Count && tokensList[tokenPos].Type == StiTokenType.Dot)
                        {
                            token = tokensList[tokenPos + 1];
                            string nextName = StiNameValidator.CorrectName(token.Value);

                            StiDataRelation dr = GetDataRelationByName(nextName, ds);
                            if (dr != null)
                            {
                                ds        = dr.ParentSource;
                                tokenPos += 2;
                                fieldPath.Append(".");
                                fieldPath.Append(dr.NameInSource);
                                continue;
                            }
                            if (ds.Columns.Contains(nextName))
                            {
                                tokenPos += 2;
                                fieldPath.Append(".");
                                fieldPath.Append(nextName);
                                break;
                            }
                            foreach (StiDataColumn column in ds.Columns)
                            {
                                if (StiNameValidator.CorrectName(column.Name) == nextName)
                                {
                                    tokenPos += 2;
                                    fieldPath.Append(".");
                                    fieldPath.Append(column.NameInSource);
                                    break;
                                }
                            }

                            CheckDataSourceField(ds.Name, nextName);
                            tokenPos += 2;
                            fieldPath.Append(".");
                            fieldPath.Append(nextName);

                            //token = tokensList[tokenPos - 1];
                            break;
                        }
                        token.Type = StiTokenType.DataSourceField;
                        //надо оптимизировать и сохранять сразу массив строк !!!!!
                        token.Value = fieldPath.ToString();
                    }
                    #endregion

                    #region check for BusinessObject field
                    else if (bos != null)
                    {
                        StringBuilder fieldPath = new StringBuilder(token.Value);
                        while (tokenPos + 1 < tokensList.Count && tokensList[tokenPos].Type == StiTokenType.Dot)
                        //while (inputExpression[pos2] == '.')
                        {
                            token = tokensList[tokenPos + 1];
                            string nextName = token.Value;

                            if (bos.Columns.Contains(nextName))
                            {
                                tokenPos += 2;
                                fieldPath.Append(".");
                                fieldPath.Append(nextName);
                                break;
                            }
                            bos = bos.BusinessObjects[nextName];
                            if (bos != null)
                            {
                                tokenPos += 2;
                                fieldPath.Append(".");
                                fieldPath.Append(bos.Name);
                                continue;
                            }
                            break;
                        }
                        token.Type = StiTokenType.BusinessObjectField;
                        //надо оптимизировать и сохранять сразу массив строк !!!!!
                        token.Value = fieldPath.ToString();
                    }
                    #endregion

                    else if ((newList.Count > 0) && (newList[newList.Count - 1].Type == StiTokenType.Dot))
                    {
                        if (MethodsList.Contains(token.Value))
                        {
                            token.Type = StiTokenType.Method;
                        }
                        else if (PropertiesList.Contains(token.Value))
                        {
                            token.Type = StiTokenType.Property;
                        }
                        else
                        {
                            ThrowError(ParserErrorCode.FieldMethodOrPropertyNotFound, token, token.Value);
                        }
                    }

                    else if (TypesList.Contains(token.Value))
                    {
                        token.Type = StiTokenType.Cast;

                        if ((tokenPos + 1 < tokensList.Count) && (tokensList[tokenPos].Type == StiTokenType.Dot))
                        {
                            string tempName = token.Value + "." + tokensList[tokenPos + 1].Value;
                            if (FunctionsList.Contains(tempName))
                            {
                                token.Type  = StiTokenType.Function;
                                token.Value = tempName;
                                tokenPos   += 2;
                            }
                            if (SystemVariablesList.Contains(tempName))
                            {
                                token.Type  = StiTokenType.SystemVariable;
                                token.Value = tempName;
                                tokenPos   += 2;
                            }
                        }
                    }

                    else if (ComponentsList.Contains(token.Value))
                    {
                        token.Type = StiTokenType.Component;
                        if ((tokenPos + 1 < tokensList.Count) && (tokensList[tokenPos].Type == StiTokenType.Colon) && ComponentsList.Contains(tokensList[tokenPos + 1].Value))
                        {
                            StiComponent comp = (StiComponent)ComponentsList[tokensList[tokenPos + 1].Value];
                            if (comp != null && comp is StiDataBand)
                            {
                                token.Value = (comp as StiDataBand).DataSourceName;
                                token.Type  = StiTokenType.DataSourceField;
                                tokenPos   += 2;
                            }
                        }
                    }

                    else if (FunctionsList.Contains(token.Value))
                    {
                        while ((StiFunctionType)FunctionsList[token.Value] == StiFunctionType.NameSpace)
                        {
                            if (tokenPos + 1 >= tokensList.Count)
                            {
                                ThrowError(ParserErrorCode.UnexpectedEndOfExpression);
                            }
                            token.Value += "." + tokensList[tokenPos + 1].Value;
                            tokenPos    += 2;
                            if (!FunctionsList.Contains(token.Value))
                            {
                                ThrowError(ParserErrorCode.FunctionNotFound, token, token.Value);
                            }
                        }
                        token.Type = StiTokenType.Function;
                    }

                    else if (SystemVariablesList.Contains(token.Value) && (token.Value != "value" || component is Stimulsoft.Report.CrossTab.StiCrossCell))
                    {
                        token.Type = StiTokenType.SystemVariable;
                    }

                    //else if (token.Value.ToLowerInvariant() == "true" || token.Value.ToLowerInvariant() == "false")
                    //{
                    //    if (token.Value.ToLowerInvariant() == "true")
                    //        token.ValueObject = true;
                    //    else
                    //        token.ValueObject = false;
                    //    token.Type = StiTokenType.Number;
                    //}
                    //else if (token.Value.ToLowerInvariant() == "null")
                    //{
                    //    token.ValueObject = null;
                    //    token.Type = StiTokenType.Number;
                    //}

                    else if (ConstantsList.Contains(token.Value))
                    {
                        while (ConstantsList[token.Value] == namespaceObj)
                        {
                            if (tokenPos + 1 >= tokensList.Count)
                            {
                                ThrowError(ParserErrorCode.UnexpectedEndOfExpression);
                            }
                            string oldTokenValue = token.Value;
                            token.Value += "." + tokensList[tokenPos + 1].Value;
                            tokenPos    += 2;
                            if (!ConstantsList.Contains(token.Value))
                            {
                                ThrowError(ParserErrorCode.ItemDoesNotContainDefinition, token, oldTokenValue, tokensList[tokenPos + 1].Value);
                            }
                        }
                        token.ValueObject = ConstantsList[token.Value];
                        token.Type        = StiTokenType.Number;
                    }

                    else if (report.Dictionary.Variables.Contains(token.Value))
                    {
                        token.Type = StiTokenType.Variable;
                    }
                    else if (token.Value == "or" || token.Value == "and" || token.Value == "not")
                    {
                        if (token.Value == "or")
                        {
                            token.Type = StiTokenType.DoubleOr;
                        }
                        if (token.Value == "and")
                        {
                            token.Type = StiTokenType.DoubleAnd;
                        }
                        if (token.Value == "not")
                        {
                            token.Type = StiTokenType.Not;
                        }
                    }
                    else
                    {
                        if ((tokenPos < tokensList.Count) && (tokensList[tokenPos].Type != StiTokenType.Dot) || (tokenPos == tokensList.Count))
                        {
                            CheckDataSourceField(defaultDataSourceName, token.Value);

                            token.Type  = StiTokenType.DataSourceField;
                            token.Value = defaultDataSourceName + "." + token.Value;
                        }
                        else
                        {
                            if ((tokenPos + 1 < tokensList.Count) && (tokensList[tokenPos].Type == StiTokenType.Dot))
                            {
                                CheckDataSourceField(token.Value, tokensList[tokenPos + 1].Value);

                                token.Type  = StiTokenType.DataSourceField;
                                token.Value = token.Value + "." + tokensList[tokenPos + 1].Value;
                                tokenPos   += 2;
                            }
                            else
                            {
                                ThrowError(ParserErrorCode.NameDoesNotExistInCurrentContext, token, token.Value);
                            }
                        }
                    }
                }
                newList.Add(token);
            }
            return(newList);
        }
Beispiel #26
0
        private StiBrush GetBrush(XmlNode node, StiComponent comp, string key)
        {
            try
            {
                XmlAttribute attr = node.Attributes[key];
                if (attr != null)
                {
                    switch (attr.Value)
                    {
                    case "LinearGradient":
                        StiGradientBrush gradientBrush = new StiGradientBrush();
                        gradientBrush.StartColor = ReadColor(node, key + ".StartColor");
                        gradientBrush.EndColor   = ReadColor(node, key + ".EndColor");
                        gradientBrush.Angle      = (float)ReadDouble(node, key + ".Angle", comp, 0d);
                        return(gradientBrush);

                    case "PathGradient":
                        StiGlareBrush glareBrush = new StiGlareBrush();
                        glareBrush.StartColor = ReadColor(node, key + ".CenterColor");
                        glareBrush.EndColor   = ReadColor(node, key + ".EdgeColor");
                        return(glareBrush);

                    case "Hatch":
                        StiHatchBrush hatchBrush = new StiHatchBrush();
                        hatchBrush.ForeColor = ReadColor(node, key + ".ForeColor");
                        hatchBrush.BackColor = ReadColor(node, key + ".BackColor");
                        string str = ReadString(node, key + ".Style", "BackwardDiagonal");
                        hatchBrush.Style = (HatchStyle)Enum.Parse(typeof(HatchStyle), str, false);
                        return(hatchBrush);

                    case "Glass":
                        StiGlassBrush glassBrush = new StiGlassBrush();
                        glassBrush.Color     = ReadColor(node, key + ".Color");
                        glassBrush.Blend     = (float)ReadDouble(node, key + ".Blend", comp, 0.2d);
                        glassBrush.DrawHatch = ReadBool(node, key + ".Hatch", comp, false);
                        return(glassBrush);
                    }
                }
                else
                {
                    XmlAttribute attr2 = node.Attributes[key + ".Color"];
                    if (attr2 != null)
                    {
                        StiSolidBrush solidBrush = new StiSolidBrush();
                        solidBrush.Color = ReadColor(node, key + ".Color");
                        return(solidBrush);
                    }
                }
            }
            catch
            {
            }
            if (key == "Fill")
            {
                return(new StiEmptyBrush());
            }
            else
            {
                return(new StiSolidBrush(Color.Black));
            }
        }
Beispiel #27
0
        public override bool InternalRender(StiComponent masterComp, ref StiComponent renderedComponent, StiContainer outContainer)
        {
            bool result = base.InternalRender(masterComp, ref renderedComponent, outContainer);

            return(result);
        }
Beispiel #28
0
        public override StiComponent InternalRender(StiComponent masterComp)
        {
            MyCustomComponentWithDataSource renderedComponent = base.InternalRender(masterComp) as MyCustomComponentWithDataSource;

            return(renderedComponent);
        }
Beispiel #29
0
 public String FooterText1_GetValue_End(StiComponent sender)
 {
     return(ToString(sender, ((long)(ChangeType(FooterText1_Count.GetValue(), typeof(long), true))), true));
 }
        public override StiComponent InternalRender(StiComponent masterComp)
        {
            MyCustomComponentWithExpression renderedComponent = base.InternalRender(masterComp) as MyCustomComponentWithExpression;

            return(renderedComponent);
        }