public PreprocessorDataDescriptor(PreprocessorAreaData areaData, PreprocessorData data) : this()
			{
				this.AreaData = areaData;
				this.Data     = data;
			}
        private void PreprocessElement(XmlDocument document, XmlElement element, ref List <PreprocessorAreaData> datas, PreprocessorAreaData parentArea = null)
        {
            List <XmlElement> nodes = element.ChildNodes.OfType <XmlElement>().ToList();

            foreach (XmlElement subElement in nodes)
            {
                if (subElement == null)
                {
                    continue;
                }

                switch (subElement.Name.ToLower())
                {
                case "mssqlauditorpreprocessor":
                {
                    string className = subElement.Attributes["preprocessor"].Value;

                    XmlAttribute idAttr        = subElement.Attributes["id"];
                    XmlAttribute nameAttr      = subElement.Attributes["name"];
                    XmlAttribute columnAttr    = subElement.Attributes["column"];
                    XmlAttribute rowAttr       = subElement.Attributes["row"];
                    XmlAttribute colSpanAttr   = subElement.Attributes["colspan"];
                    XmlAttribute rowSpanAttr   = subElement.Attributes["rowspan"];
                    XmlAttribute vertTestAlign = subElement.Attributes["text-vertical-align"];
                    XmlAttribute textAlign     = subElement.Attributes["text-align"];

                    string id          = "";
                    string preprocName = "unnamed";

                    if (nameAttr != null)
                    {
                        preprocName = nameAttr.Value;
                    }

                    if (idAttr != null)
                    {
                        id = idAttr.Value;
                    }

                    int col     = ParseIntAttribute(columnAttr, 1);
                    int row     = ParseIntAttribute(rowAttr, 1);
                    int colSpan = ParseIntAttribute(colSpanAttr, 1);
                    int rowSpan = ParseIntAttribute(rowSpanAttr, 1);

                    VerticalTextAlign?preprocVertTestAlign = null;

                    if (vertTestAlign != null)
                    {
                        VerticalTextAlign tempVertTestAlign;

                        if (Enum.TryParse(vertTestAlign.Value, out tempVertTestAlign))
                        {
                            preprocVertTestAlign = tempVertTestAlign;
                        }
                    }

                    TextAlign preprocTestAlign = TextAlign.Left;

                    if (textAlign != null)
                    {
                        if (!Enum.TryParse(textAlign.Value, out preprocTestAlign))
                        {
                            preprocTestAlign = TextAlign.Left;
                        }
                    }

                    IPreprocessor preprocessor =
                        (from proc in this._availablePreprocessors where proc.GetType().Name == className select proc)
                        .FirstOrDefault();

                    if (preprocessor != null)
                    {
                        string          configuration = subElement.InnerXml;
                        IContentFactory factory       = preprocessor.CreateContentFactory(id, configuration);

                        PreprocessorData data = new PreprocessorData
                        {
                            ContentFactory    = factory,
                            Name              = preprocName,
                            Column            = col,
                            Row               = row,
                            ColSpan           = colSpan,
                            RowSpan           = rowSpan,
                            VerticalTextAlign = preprocVertTestAlign,
                            TextAlign         = preprocTestAlign
                        };

                        XmlElement newSubElement = document.CreateElement("div");

                        newSubElement.SetAttribute("style", "margin:0; padding:0;");
                        newSubElement.InnerXml = string.Empty;

                        element.ReplaceChild(newSubElement, subElement);

                        if (parentArea != null)
                        {
                            parentArea.Preprocessors.Add(data);
                        }
                        else
                        {
                            log.ErrorFormat(
                                "Invalid configuration: <mssqlauditorpreprocessor> is not embedded in <mssqlauditorpreprocessors>. " +
                                "Are you using old style configuration file?" + Environment.NewLine +
                                "Silently ignoring '{0}' with id='{1}' and name='{2}'",
                                className,
                                id,
                                preprocName
                                );

                            throw new ArgumentOutOfRangeException(
                                      "document",
                                      "Invalid configuration: <mssqlauditorpreprocessor> is not embedded in <mssqlauditorpreprocessors>!"
                                      );
                        }
                        continue;
                    }
                    break;
                }

                case "mssqlauditorpreprocessors":
                {
                    XmlAttribute idAttr       = subElement.Attributes["id"];
                    XmlAttribute nameAttr     = subElement.Attributes["name"];
                    XmlAttribute rowsAttr     = subElement.Attributes["rows"];
                    XmlAttribute columnsAttr  = subElement.Attributes["columns"];
                    XmlAttribute splitterAttr = subElement.Attributes["splitter"];

                    string id       = "";
                    string name     = "unnamed";
                    string rows     = "";
                    string columns  = "";
                    string splitter = "";

                    if (nameAttr != null)
                    {
                        name = nameAttr.Value;
                    }
                    if (idAttr != null)
                    {
                        id = idAttr.Value;
                    }
                    if (columnsAttr != null)
                    {
                        columns = columnsAttr.Value;
                    }
                    if (rowsAttr != null)
                    {
                        rows = rowsAttr.Value;
                    }
                    if (splitterAttr != null)
                    {
                        splitter = splitterAttr.Value;
                    }

                    PreprocessorAreaData container = new PreprocessorAreaData(id, name, columns, rows);

                    if (string.Equals(splitter, "no", StringComparison.InvariantCultureIgnoreCase))
                    {
                        container.NoSplitter = true;
                    }

                    datas.Add(container);

                    PreprocessElement(document, subElement, ref datas, container);

                    container.CheckPreprocessors();

                    continue;
                }
                }

                PreprocessElement(document, subElement, ref datas);
            }
        }
		private void PreprocessElement(XmlDocument document, XmlElement element, ref List<PreprocessorAreaData> datas, PreprocessorAreaData parentArea = null)
		{
			List<XmlElement> nodes = element.ChildNodes.OfType<XmlElement>().ToList();

			foreach (XmlElement subElement in nodes)
			{
				if (subElement == null)
				{
					continue;
				}

				switch (subElement.Name.ToLower())
				{
					case "mssqlauditorpreprocessor":
						{
							string className           = subElement.Attributes["preprocessor"].Value;

							XmlAttribute idAttr        = subElement.Attributes["id"];
							XmlAttribute nameAttr      = subElement.Attributes["name"];
							XmlAttribute columnAttr    = subElement.Attributes["column"];
							XmlAttribute rowAttr       = subElement.Attributes["row"];
							XmlAttribute colSpanAttr   = subElement.Attributes["colspan"];
							XmlAttribute rowSpanAttr   = subElement.Attributes["rowspan"];
							XmlAttribute vertTestAlign = subElement.Attributes["text-vertical-align"];
							XmlAttribute textAlign     = subElement.Attributes["text-align"];

							string id                  = "";
							string preprocName         = "unnamed";

							if (nameAttr != null)
							{
								preprocName = nameAttr.Value;
							}

							if (idAttr != null)
							{
								id = idAttr.Value;
							}

							int col     = ParseIntAttribute(columnAttr,  1);
							int row     = ParseIntAttribute(rowAttr,     1);
							int colSpan = ParseIntAttribute(colSpanAttr, 1);
							int rowSpan = ParseIntAttribute(rowSpanAttr, 1);

							VerticalTextAlign? preprocVertTestAlign = null;

							if (vertTestAlign != null)
							{
								VerticalTextAlign tempVertTestAlign;

								if (Enum.TryParse(vertTestAlign.Value, out tempVertTestAlign))
								{
									preprocVertTestAlign = tempVertTestAlign;
								}
							}

							TextAlign preprocTestAlign = TextAlign.Left;

							if (textAlign != null)
							{
								if (!Enum.TryParse(textAlign.Value, out preprocTestAlign))
								{
									preprocTestAlign = TextAlign.Left;
								}
							}

							IPreprocessor preprocessor =
								(from proc in this._availablePreprocessors where proc.GetType().Name == className select proc)
									.FirstOrDefault();

							if (preprocessor != null)
							{
								string          configuration = subElement.InnerXml;
								IContentFactory factory       = preprocessor.CreateContentFactory(id, configuration);

								PreprocessorData data = new PreprocessorData
								{
									ContentFactory    = factory,
									Name              = preprocName,
									Column            = col,
									Row               = row,
									ColSpan           = colSpan,
									RowSpan           = rowSpan,
									VerticalTextAlign = preprocVertTestAlign,
									TextAlign         = preprocTestAlign
								};

								XmlElement newSubElement = document.CreateElement("div");

								newSubElement.SetAttribute("style", "margin:0; padding:0;");
								newSubElement.InnerXml = string.Empty;

								element.ReplaceChild(newSubElement, subElement);

								if (parentArea != null)
								{
									parentArea.Preprocessors.Add(data);
								}
								else
								{
									log.ErrorFormat(
										"Invalid configuration: <mssqlauditorpreprocessor> is not embedded in <mssqlauditorpreprocessors>. " +
										"Are you using old style configuration file?" + Environment.NewLine +
										"Silently ignoring '{0}' with id='{1}' and name='{2}'",
										className,
										id,
										preprocName
									);

									throw new ArgumentOutOfRangeException(
										"document",
										"Invalid configuration: <mssqlauditorpreprocessor> is not embedded in <mssqlauditorpreprocessors>!"
									);
								}
								continue;
							}
							break;
						}
					case "mssqlauditorpreprocessors":
						{
							XmlAttribute idAttr       = subElement.Attributes["id"];
							XmlAttribute nameAttr     = subElement.Attributes["name"];
							XmlAttribute rowsAttr     = subElement.Attributes["rows"];
							XmlAttribute columnsAttr  = subElement.Attributes["columns"];
							XmlAttribute splitterAttr = subElement.Attributes["splitter"];

							string id       = "";
							string name     = "unnamed";
							string rows     = "";
							string columns  = "";
							string splitter = "";

							if (nameAttr != null)
							{
								name = nameAttr.Value;
							}
							if (idAttr != null)
							{
								id = idAttr.Value;
							}
							if (columnsAttr != null)
							{
								columns = columnsAttr.Value;
							}
							if (rowsAttr != null)
							{
								rows = rowsAttr.Value;
							}
							if (splitterAttr != null)
							{
								splitter = splitterAttr.Value;
							}

							PreprocessorAreaData container = new PreprocessorAreaData(id, name, columns, rows);

							if (string.Equals(splitter, "no", StringComparison.InvariantCultureIgnoreCase))
							{
								container.NoSplitter = true;
							}

							datas.Add(container);

							PreprocessElement(document, subElement, ref datas, container);

							container.CheckPreprocessors();

							continue;
						}
				}

				PreprocessElement(document, subElement, ref datas);
			}
		}
		internal void Init(ConnectionTabControl parent, PreprocessorAreaData area, ConcreteTemplateNodeDefinition definition, MsSqlAuditorModel model)
		{
			if (parent == null)
			{
				throw new ArgumentNullException("parent");
			}

			if (area == null)
			{
				throw new ArgumentNullException("area");
			}

			if (definition == null)
			{
				throw new ArgumentNullException("definition");
			}

			if (model == null)
			{
				throw new ArgumentNullException("model");
			}

			if (!area.IsConfigured)
			{
				throw new ArgumentOutOfRangeException("area");
			}

			this._area   = area;
			this._parent = parent;
			this._model  = model;

			table.StartConfiguring();

			var rows    = this._area.Rows;
			var columns = this._area.Columns;

			// _templateId = !String.IsNullOrWhiteSpace(definition.Connection.TemplateId) ? definition.Connection.TemplateId : definition.Connection.TemplateFileName;
			if (!String.IsNullOrWhiteSpace(definition.Connection.TemplateId))
			{
				this._templateId = definition.Connection.TemplateId;
			}
			else
			{
				this._templateId = string.IsNullOrEmpty(definition.Connection.TemplateDir)
					? definition.Connection.TemplateFileName
					: Path.Combine(definition.Connection.TemplateDir, definition.Connection.TemplateFileName);
			}

			this._nodeId           = !String.IsNullOrWhiteSpace(definition.TemplateNode.Id) ? definition.TemplateNode.Id : definition.TemplateNode.Name;
			this._areaId           = !String.IsNullOrWhiteSpace(this._area.Id) ? this._area.Id : this._area.Name;
			this._reportLanguage   = this._model.Settings.ReportLanguage;
			this._splitterSettings = this._model.LayoutSettings.GetExtendedSettings<SplitterSettings>(this._templateId, String.Empty, this._reportLanguage);

			if (this._splitterSettings == null)
			{
				this._splitterSettings = new SplitterSettings
				{
					SplitterNodeSettingList = new List<SplitterSetting>()
				};
			}

			var splitterSetting =
				this._splitterSettings.SplitterNodeSettingList.FirstOrDefault(
					s =>
						string.Equals(s.NodeId, this._nodeId, StringComparison.InvariantCultureIgnoreCase)
						&&
						string.Equals(s.AreaId, this._areaId, StringComparison.InvariantCultureIgnoreCase)
				);

			if (splitterSetting != null)
			{
				var newRows    = PreprocessorAreaData.ParseGridDimension(splitterSetting.Rows,    "splitterSetting.Rows");
				var newColumns = PreprocessorAreaData.ParseGridDimension(splitterSetting.Columns, "splitterSetting.Columns");

				if (rows.Length == newRows.Length && columns.Length == newColumns.Length)
				{
					rows    = newRows;
					columns = newColumns;
				}
			}

			table.SetRows(rows);
			table.SetColumns(columns);

			List<PreprocessorData> preprocessors = _area.Preprocessors;

			for (int i = 0, iMax = preprocessors.Count; i < iMax; i++)
			{
				PreprocessorData preprocessor = preprocessors[i];
				Control control = preprocessor.ContentFactory.CreateControl();

				if (control != null)
				{
					if (control is WebBrowser)
					{
						// control.PreviewKeyDown += (s, e) =>
						control.PreviewKeyDown += ConnectionTabArea_PreviewKeyDown;

						this.Disposed += (s, e) =>
						{
							//
							// #248 - fix memory leaks during Web rendering
							//
							// if (e.KeyCode == Keys.F5)
							// {
							//     _parent.F5RefreshView();
							// }

							control.PreviewKeyDown -= ConnectionTabArea_PreviewKeyDown;
							IntPtr currentProcessHandle = (IntPtr)(-1);
							SafeNativeMethods.EmptyWorkingSet(currentProcessHandle);
						};
					}

					#region Wrap control to frame with title
					if (preprocessor.VerticalTextAlign != null)
					{
						var titleFrame = new TitleFrame(
							preprocessor.VerticalTextAlign,
							preprocessor.TextAlign,
							control
						);

						titleFrame.Title = preprocessor.Name;

						control = titleFrame;
					}
					#endregion

					table.AddControlToCell(
						preprocessor.Column - 1,
						preprocessor.Row - 1,
						preprocessor.ColSpan,
						preprocessor.RowSpan,
						control
					);
				}
			}

			table.StopConfiguring();

			this._splitterChanged = false;

			if (!this._handlingSplitterMoved)
			{
				this._handlingSplitterMoved = true;

				table.SplitterMoved += TableSplitterMoved;
			}
		}