Name _InstanceName; // The name of the variable to assign the class to.

        #endregion Fields

        #region Constructors

        // This variable can be used in expressions
        // throughout the report.
        internal ReportClass(ReportDefn r, ReportLink p, XmlNode xNode)
            : base(r, p)
        {
            _ClassName=null;
            _InstanceName = null;

            // Loop thru all the child nodes
            foreach(XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                    continue;
                switch (xNodeLoop.Name)
                {
                    case "ClassName":
                        _ClassName = xNodeLoop.InnerText;
                        break;
                    case "InstanceName":
                        _InstanceName = new Name(xNodeLoop.InnerText);
                        break;
                    default:
                        break;
                }
            }
            if (_ClassName == null)
                OwnerReport.rl.LogError(8, "Class ClassName is required but not specified.");

            if (_InstanceName == null)
                OwnerReport.rl.LogError(8, "Class InstanceName is required but not specified or invalid for " + _ClassName==null? "<unknown name>": _ClassName);
        }
        Name _Name; // Name of the image.

        #endregion Fields

        #region Constructors

        internal EmbeddedImage(ReportDefn r, ReportLink p, XmlNode xNode)
            : base(r, p)
        {
            _Name=null;
            _MIMEType=null;
            _ImageData=null;
            // Run thru the attributes
            foreach(XmlAttribute xAttr in xNode.Attributes)
            {
                switch (xAttr.Name)
                {
                    case "Name":
                        _Name = new Name(xAttr.Value);
                        break;
                }
            }
            // Loop thru all the child nodes
            foreach(XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                    continue;
                switch (xNodeLoop.Name)
                {
                    case "MIMEType":
                        _MIMEType = xNodeLoop.InnerText;
                        break;
                    case "ImageData":
                        _ImageData = xNodeLoop.InnerText;
                        break;
                    default:
                        this.OwnerReport.rl.LogError(4, "Unknown Report element '" + xNodeLoop.Name + "' ignored.");
                        break;
                }
            }

            if (this.Name == null)
            {
                OwnerReport.rl.LogError(8, "EmbeddedImage Name is required but not specified.");
            }
            else
            {
                try
                {
                    OwnerReport.LUEmbeddedImages.Add(this.Name.Nm, this);		// add to referenceable embedded images
                }
                catch		// Duplicate name
                {
                    OwnerReport.rl.LogError(4, "Duplicate EmbeddedImage  name '" + this.Name.Nm + "' ignored.");
                }
            }
            if (_MIMEType == null)
                OwnerReport.rl.LogError(8, "EmbeddedImage MIMEType is required but not specified for " + (this.Name == null? "'name not specified'": this.Name.Nm));

            if (_ImageData == null)
                OwnerReport.rl.LogError(8, "EmbeddedImage ImageData is required but not specified for " + (this.Name == null? "'name not specified'": this.Name.Nm));
        }
        bool _Transaction; // Indicates the data sets that use this data

        #endregion Fields

        #region Constructors

        internal DataSourceDefn(ReportDefn r, ReportLink p, XmlNode xNode)
            : base(r, p)
        {
            _Name=null;
            _Transaction=false;
            _ConnectionProperties=null;
            _DataSourceReference=null;
            // Run thru the attributes
            foreach(XmlAttribute xAttr in xNode.Attributes)
            {
                switch (xAttr.Name)
                {
                    case "Name":
                        _Name = new Name(xAttr.Value);
                        break;
                }
            }

            // Loop thru all the child nodes
            foreach(XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                    continue;
                switch (xNodeLoop.Name)
                {
                    case "Transaction":
                        _Transaction = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl);
                        break;
                    case "ConnectionProperties":
                        _ConnectionProperties = new ConnectionProperties(r, this, xNodeLoop);
                        break;
                    case "DataSourceReference":
                        _DataSourceReference = xNodeLoop.InnerText;
                        break;
                    default:
                        // don't know this element - log it
                        OwnerReport.rl.LogError(4, "Unknown DataSource element '" + xNodeLoop.Name + "' ignored.");
                        break;
                }
            }
            if (_Name == null)
                OwnerReport.rl.LogError(8, "DataSource Name is required but not specified.");
            else if (_ConnectionProperties == null && _DataSourceReference == null)
                OwnerReport.rl.LogError(8, string.Format("Either ConnectionProperties or DataSourceReference must be specified for DataSource {0}.", this._Name.Nm));
            else if (_ConnectionProperties != null && _DataSourceReference != null)
                OwnerReport.rl.LogError(8, string.Format("Either ConnectionProperties or DataSourceReference must be specified for DataSource {0} but not both.", this._Name.Nm));
        }
Exemple #4
0
        Expression _Value; // (Variant) An expression that evaluates to the value of

        #endregion Fields

        #region Constructors

        //  this field.  For example, =Fields!Price.Value+Fields!Tax.Value
        // The expression cannot contain aggregates or references to report items.
        internal Field(ReportDefn r, ReportLink p, XmlNode xNode)
            : base(r, p)
        {
            _Name=null;
            _DataField=null;
            _Value=null;
            _ColumnNumber = -1;
            _Type = TypeCode.String;
            // Run thru the attributes
            foreach(XmlAttribute xAttr in xNode.Attributes)
            {
                switch (xAttr.Name)
                {
                    case "Name":
                        _Name = new Name(xAttr.Value);
                        break;
                }
            }
            // Loop thru all the child nodes
            foreach(XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                    continue;
                switch (xNodeLoop.Name)
                {
                    case "DataField":
                        _DataField = xNodeLoop.InnerText;
                        break;
                    case "TypeName":		// Extension !!!!!!!!!!!!!!!!!
                    case "rd:TypeName":		// Microsoft Designer uses this extension
                        _Type = DataType.GetStyle(xNodeLoop.InnerText, this.OwnerReport);
                        break;
                    case "Value":
                        _Value = new Expression(r, this, xNodeLoop, ExpressionType.Variant);
                        break;
                    default:
                        // don't know this element - log it
                        OwnerReport.rl.LogError(4, "Unknown Field element '" + xNodeLoop.Name + "' ignored.");
                        break;
                }
            }
            if (_DataField != null && _Value != null)
                OwnerReport.rl.LogError(8, "Only DataField or Value may be specified in a Field element, not both.");
            else if (_DataField == null && _Value == null)
                OwnerReport.rl.LogError(8, "Either DataField or Value must be specified in a Field element.");
        }
        Expression _Value; // (Variant) An expression that evaluates to the value to

        #endregion Fields

        #region Constructors

        // hand in for the parameter to the Subreport.
        internal SubreportParameter(ReportDefn r, ReportLink p, XmlNode xNode)
            : base(r, p)
        {
            _Name=null;
            _Value=null;
            // Run thru the attributes
            foreach(XmlAttribute xAttr in xNode.Attributes)
            {
                switch (xAttr.Name)
                {
                    case "Name":
                        _Name = new Name(xAttr.Value);
                        break;
                }
            }

            if (_Name == null)
            {	// Name is required for parameters
                OwnerReport.rl.LogError(8, "Parameter Name attribute required.");
            }

            // Loop thru all the child nodes
            foreach(XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                    continue;
                switch (xNodeLoop.Name)
                {
                    case "Value":
                        _Value = new Expression(r, this, xNodeLoop, ExpressionType.Variant);
                        break;
                    default:
                        // don't know this element - log it
                        OwnerReport.rl.LogError(4, "Unknown Subreport parameter element '" + xNodeLoop.Name + "' ignored.");
                        break;
                }
            }

            if (_Value == null)
            {	// Value is required for parameters
                OwnerReport.rl.LogError(8, "The Parameter Value element is required but was not specified.");
            }
        }
        Expression _ParentGroup; //(Variant)

        #endregion Fields

        #region Constructors

        internal Grouping(ReportDefn r, ReportLink p, XmlNode xNode)
            : base(r, p)
        {
            _Name=null;
            _Label=null;
            _GroupExpressions=null;
            _PageBreakAtStart=false;
            _PageBreakAtEnd=false;
            _Custom=null;
            _Filters=null;
            _ParentGroup=null;
            _DataElementName=null;
            _DataCollectionName=null;
            _DataElementOutput=DataElementOutputEnum.Output;
            _HideDuplicates=null;
            // Run thru the attributes
            foreach(XmlAttribute xAttr in xNode.Attributes)
            {
                switch (xAttr.Name)
                {
                    case "Name":
                        _Name = new Name(xAttr.Value);
                        break;
                }
            }
            // Loop thru all the child nodes
            foreach(XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                    continue;
                switch (xNodeLoop.Name)
                {
                    case "Label":
                        _Label = new Expression(r, this, xNodeLoop, ExpressionType.String);
                        break;
                    case "GroupExpressions":
                        _GroupExpressions = new GroupExpressions(r, this, xNodeLoop);
                        break;
                    case "PageBreakAtStart":
                        _PageBreakAtStart = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl);
                        break;
                    case "PageBreakAtEnd":
                        _PageBreakAtEnd = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl);
                        break;
                    case "Custom":
                        _Custom = new Custom(r, this, xNodeLoop);
                        break;
                    case "Filters":
                        _Filters = new Filters(r, this, xNodeLoop);
                        break;
                    case "Parent":
                        _ParentGroup = new Expression(r, this, xNodeLoop, ExpressionType.Variant);
                        break;
                    case "DataElementName":
                        _DataElementName = xNodeLoop.InnerText;
                        break;
                    case "DataCollectionName":
                        _DataCollectionName = xNodeLoop.InnerText;
                        break;
                    case "DataElementOutput":
                        _DataElementOutput = Engine.DataElementOutput.GetStyle(xNodeLoop.InnerText, OwnerReport.rl);
                        break;
                    default:
                        // don't know this element - log it
                        OwnerReport.rl.LogError(4, "Unknown Grouping element '" + xNodeLoop.Name + "' ignored.");
                        break;
                }
            }
            if (this.Name != null)
            {
                try
                {
                    OwnerReport.LUAggrScope.Add(this.Name.Nm, this);		// add to referenceable Grouping's
                }
                catch	// wish duplicate had its own exception
                {
                    OwnerReport.rl.LogError(8, "Duplicate Grouping name '" + this.Name.Nm + "'.");
                }
            }
            if (_GroupExpressions == null)
                OwnerReport.rl.LogError(8, "Group Expressions are required within group '" + (this.Name==null? "unnamed": this.Name.Nm) + "'.");
        }
        string _XmlRowFile; //   - File should be loaded for user data; if not found use XmlRowData

        #endregion Fields

        #region Constructors

        internal DataSetDefn(ReportDefn r, ReportLink p, XmlNode xNode)
            : base(r, p)
        {
            _Name=null;
            _Fields=null;
            _Query=null;
            _CaseSensitivity=TrueFalseAutoEnum.True;
            _Collation=null;
            _AccentSensitivity=TrueFalseAutoEnum.False;
            _KanatypeSensitivity=TrueFalseAutoEnum.False;
            _WidthSensitivity=TrueFalseAutoEnum.False;
            _Filters=null;
            _HideDuplicates=null;
            // Run thru the attributes
            foreach(XmlAttribute xAttr in xNode.Attributes)
            {
                switch (xAttr.Name)
                {
                    case "Name":
                        _Name = new Name(xAttr.Value);
                        break;
                }
            }

            // Loop thru all the child nodes
            foreach(XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                    continue;
                switch (xNodeLoop.Name)
                {
                    case "Fields":
                        _Fields = new Fields(r, this, xNodeLoop);
                        break;
                    case "Query":
                        _Query = new Query(r, this, xNodeLoop);
                        break;
                    case "Rows":	// Extension !!!!!!!!!!!!!!!!!!!!!!!
                    case "fyi:Rows":
                        _XmlRowData = "<?xml version='1.0' encoding='UTF-8'?><Rows>" + xNodeLoop.InnerXml + "</Rows>";
                        foreach(XmlAttribute xA in xNodeLoop.Attributes)
                        {
                            if (xA.Name == "File")
                                _XmlRowFile = xA.Value;
                        }
                        break;
                    case "CaseSensitivity":
                        _CaseSensitivity = TrueFalseAuto.GetStyle(xNodeLoop.InnerText, OwnerReport.rl);
                        break;
                    case "Collation":
                        _Collation = xNodeLoop.InnerText;
                        break;
                    case "AccentSensitivity":
                        _AccentSensitivity = TrueFalseAuto.GetStyle(xNodeLoop.InnerText, OwnerReport.rl);
                        break;
                    case "KanatypeSensitivity":
                        _KanatypeSensitivity = TrueFalseAuto.GetStyle(xNodeLoop.InnerText, OwnerReport.rl);
                        break;
                    case "WidthSensitivity":
                        _WidthSensitivity = TrueFalseAuto.GetStyle(xNodeLoop.InnerText, OwnerReport.rl);
                        break;
                    case "Filters":
                        _Filters = new Filters(r, this, xNodeLoop);
                        break;
                    default:
                        OwnerReport.rl.LogError(4, "Unknown DataSet element '" + xNodeLoop.Name + "' ignored.");
                        break;
                }
            }
            if (this.Name != null)
                OwnerReport.LUAggrScope.Add(this.Name.Nm, this);		// add to referenceable TextBoxes
            else
                OwnerReport.rl.LogError(4, "Name attribute must be specified in a DataSet.");

            if (_Query == null)
                OwnerReport.rl.LogError(8, "Query element must be specified in a DataSet.");
        }
        int _ZIndex; // Drawing order of the report item within the

        #endregion Fields

        #region Constructors

        internal ReportItem(ReportDefn r, ReportLink p, XmlNode xNode)
            : base(r, p)
        {
            _Name=null;
            _Style=null;
            _Action=null;
            _Top=null;
            _Left=null;
            _Height=null;
            _Width=null;
            _ZIndex=0;
            _Visibility=null;
            _ToolTip=null;
            _Label=null;
            _LinkToChild=null;
            _Bookmark=null;
            _RepeatWith=null;
            _Custom=null;
            _DataElementName=null;
            _DataElementOutput=DataElementOutputEnum.Auto;
            // Run thru the attributes
            foreach(XmlAttribute xAttr in xNode.Attributes)
            {
                switch (xAttr.Name)
                {
                    case "Name":
                        _Name = new Name(xAttr.Value);
                        break;
                }
            }
        }
        ValidValues _ValidValues; // Possible values for the parameter (for an

        #endregion Fields

        #region Constructors

        //    Indicates whether or not the parameter is
        //    used in a query in the report. This is
        //    needed to determine if the queries need
        //    to be re-executed if the parameter
        //    changes. Auto indicates the
        //    UsedInQuery setting should be
        //    autodetected as follows: True if the
        //    parameter is referenced in any query
        //    value expression.
        internal ReportParameter(ReportDefn r, ReportLink p, XmlNode xNode)
            : base(r, p)
        {
            _Name=null;
            _dt = TypeCode.Object;
            _Nullable = false;
            _DefaultValue=null;
            _AllowBlank=false;
            _Prompt=null;
            _ValidValues=null;
            _UsedInQuery = TrueFalseAutoEnum.Auto;
            // Run thru the attributes
            foreach(XmlAttribute xAttr in xNode.Attributes)
            {
                switch (xAttr.Name)
                {
                    case "Name":
                        _Name = new Name(xAttr.Value);
                        break;
                }
            }
            // Loop thru all the child nodes
            foreach(XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                    continue;
                switch (xNodeLoop.Name)
                {
                    case "DataType":
                        _dt = DataType.GetStyle(xNodeLoop.InnerText, this.OwnerReport);
                        _NumericType = DataType.IsNumeric(_dt);
                        break;
                    case "Nullable":
                        _Nullable = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl);
                        break;
                    case "DefaultValue":
                        _DefaultValue = new DefaultValue(r, this, xNodeLoop);
                        break;
                    case "AllowBlank":
                        _AllowBlank = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl);
                        break;
                    case "Prompt":
                        _Prompt = xNodeLoop.InnerText;
                        break;
                    case "Hidden":
                        _Hidden = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl);
                        OwnerReport.rl.LogError(4, "ReportParameter element Hidden is currently ignored.");	// TODO
                        break;
                    case "MultiValue":
                        _MultiValue = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl);
                        break;
                    case "ValidValues":
                        _ValidValues = new ValidValues(r, this, xNodeLoop);
                        break;
                    case "UsedInQuery":
                        _UsedInQuery = TrueFalseAuto.GetStyle(xNodeLoop.InnerText, OwnerReport.rl);
                        break;
                    default:
                        // don't know this element - log it
                        OwnerReport.rl.LogError(4, "Unknown ReportParameter element '" + xNodeLoop.Name + "' ignored.");
                        break;
                }
            }
            if (_Name == null)
                OwnerReport.rl.LogError(8, "ReportParameter name is required but not specified.");

            if (_dt == TypeCode.Object)
                OwnerReport.rl.LogError(8, string.Format("ReportParameter DataType is required but not specified or invalid for {0}.", _Name==null? "<unknown name>": _Name.Nm));
        }
        RSize _Width; // Width of the report

        #endregion Fields

        #region Constructors

        // report has no parents
        // Constructor
        internal ReportDefn(XmlNode xNode, ReportLog replog, string folder, NeedPassword getpswd, int objcount, IRdlSourceLoader sourceLoader)
        {
            rl = replog;				// used for error reporting
            _ObjectCount = objcount;	// starting number for objects in this report; 0 other than for subreports
            _SourceLoader = sourceLoader;
            GetDataSourceReferencePassword = getpswd;
            _ParseFolder = folder;
            _Description = null;
            _Author = null;
            _AutoRefresh = -1;
            _DataSourcesDefn = null;
            _DataSetsDefn = null;
            _Body = null;
            _Width = null;
            _PageHeader = null;
            _PageFooter = null;
            _PageHeight = null;
            _PageWidth = null;
            _LeftMargin = null;
            _RightMargin = null;
            _TopMargin = null;
            _BottomMargin = null;
            _EmbeddedImages = null;
            _Language = null;
            _CodeModules = null;
            _Code = null;
            _Classes = null;
            _DataTransform = null;
            _DataSchema = null;
            _DataElementName = null;
            _DataElementStyle = DataElementStyleEnum.AttributeNormal;
            _LUReportItems = new Hashtable();		// to hold all the textBoxes
            _LUAggrScope = new ListDictionary();	// to hold all dataset, dataregion, grouping names
            _LUEmbeddedImages = new ListDictionary();	// probably not very many
            _LUDynamicNames = new Hashtable();
            _DataCache = new List<ICacheData>();

            // Run thru the attributes
            foreach(XmlAttribute xAttr in xNode.Attributes)
            {
                switch (xAttr.Name)
                {
                    case "Name":
                        _Name = new Name(xAttr.Value);
                        break;
                }
            }

            // Loop thru all the child nodes
            foreach(XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                    continue;
                switch (xNodeLoop.Name)
                {
                    case "Description":
                        _Description = xNodeLoop.InnerText;
                        break;
                    case "Author":
                        _Author = xNodeLoop.InnerText;
                        break;
                    case "AutoRefresh":
                        _AutoRefresh = XmlUtil.Integer(xNodeLoop.InnerText);
                        break;
                    case "DataSources":
                        _DataSourcesDefn = new DataSourcesDefn(this, null, xNodeLoop);
                        break;
                    case "DataSets":
                        _DataSetsDefn = new DataSetsDefn(this, null, xNodeLoop);
                        break;
                    case "Body":
                        _Body = new Body(this, null, xNodeLoop);
                        break;
                    case "ReportParameters":
                        _ReportParameters = new ReportParameters(this, null, xNodeLoop);
                        break;
                    case "Width":
                        _Width = new RSize(this, xNodeLoop);
                        break;
                    case "PageHeader":
                        _PageHeader = new PageHeader(this, null, xNodeLoop);
                        break;
                    case "PageFooter":
                        _PageFooter = new PageFooter(this, null, xNodeLoop);
                        break;
                    case "PageHeight":
                        _PageHeight = new RSize(this, xNodeLoop);
                        break;
                    case "PageWidth":
                        _PageWidth = new RSize(this, xNodeLoop);
                        break;
                    case "LeftMargin":
                        _LeftMargin = new RSize(this, xNodeLoop);
                        break;
                    case "RightMargin":
                        _RightMargin = new RSize(this, xNodeLoop);
                        break;
                    case "TopMargin":
                        _TopMargin = new RSize(this, xNodeLoop);
                        break;
                    case "BottomMargin":
                        _BottomMargin = new RSize(this, xNodeLoop);
                        break;
                    case "EmbeddedImages":
                        _EmbeddedImages = new EmbeddedImages(this, null, xNodeLoop);
                        break;
                    case "Language":
                        _Language =  new Expression(this, null, xNodeLoop, ExpressionType.String);
                        break;
                    case "Code":
                        _Code = new Code(this, null, xNodeLoop);
                        break;
                    case "CodeModules":
                        _CodeModules = new CodeModules(this, null, xNodeLoop);
                        break;
                    case "Classes":
                        _Classes = new Classes(this, null, xNodeLoop);
                        break;
                    case "DataTransform":
                        _DataTransform = xNodeLoop.InnerText;
                        break;
                    case "DataSchema":
                        _DataSchema = xNodeLoop.InnerText;
                        break;
                    case "DataElementName":
                        _DataElementName = xNodeLoop.InnerText;
                        break;
                    case "DataElementStyle":
                        _DataElementStyle = Engine.DataElementStyle.GetStyle(xNodeLoop.InnerText, this.rl);
                        break;
                    default:
                        // don't know this element - log it
                        this.rl.LogError(4, "Unknown Report element '" + xNodeLoop.Name + "' ignored.");
                        break;
                }
            }

            if (_Body == null)
                rl.LogError(8, "Body not specified for report.");

            if (_Width == null)
                rl.LogError(4, "Width not specified for report.  Assuming page width.");

            if (rl.MaxSeverity <= 4)	// don't do final pass if already have serious errors
            {
                FinalPass(folder);	// call final parser pass for expression resolution
            }

            // Cleanup any dangling resources
            if (_DataSourcesDefn != null)
                _DataSourcesDefn.CleanUp(null);
        }