Exemplo n.º 1
0
        private void bGroups_Click(object sender, System.EventArgs e)
        {
            PropertyDialog pd = new PropertyDialog(_Draw, _ReportItems, PropertyTypeEnum.Grouping);
            DialogResult   dr = pd.ShowDialog();

            if (pd.Changed || dr == DialogResult.OK)
            {
//				_DrawPanel.Invalidate();   TODO need to force change somehow?????
            }
        }
Exemplo n.º 2
0
        internal StyleTextCtl(DesignXmlDraw dxDraw, List <XmlNode> styles, PropertyDialog myDialog)
        {
            _ReportItems = styles;
            _Draw        = dxDraw;
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            // Initialize form using the style node values
            InitTextStyles();
            myDialog.Shown += MyDialog_Shown;
        }
Exemplo n.º 3
0
		private void bGroups_Click(object sender, System.EventArgs e)
		{
			PropertyDialog pd = new PropertyDialog(_Draw, _ReportItems, PropertyTypeEnum.Grouping);
            try
            {
                DialogResult dr = pd.ShowDialog();
                if (pd.Changed || dr == DialogResult.OK)
                {
                    //				_DrawPanel.Invalidate();   TODO need to force change somehow?????
                }
            }
            finally
            {
                pd.Dispose();
            }
		}
Exemplo n.º 4
0
        public override object EditValue(ITypeDescriptorContext context,
                                        IServiceProvider provider,
                                        object value)
        {
            if ((context == null) || (provider == null))
                return base.EditValue(context, provider, value);

            // Access the Property Browser's UI display service
            IWindowsFormsEditorService editorService =
                (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (editorService == null)
                return base.EditValue(context, provider, value);

            // Create an instance of the UI editor form
            IReportItem iri = context.Instance as IReportItem;
            if (iri == null)
                return base.EditValue(context, provider, value);
            PropertyReportItem pri = iri.GetPRI();

            PropertyTable pt = value as PropertyTable;
            if (pt == null)
                return base.EditValue(context, provider, value);

            //SingleCtlDialog scd = new SingleCtlDialog(pri.DesignCtl, pri.Draw, pri.Nodes, SingleCtlTypeEnum.BorderCtl, pb.Names);
            DesignCtl dc = pri.DesignCtl;
            DesignXmlDraw dp = dc.DrawCtl;
            if (dp.SelectedCount != 1)
                return base.EditValue(context, provider, value);
            XmlNode riNode = dp.SelectedList[0];
            XmlNode table = dp.GetTableFromReportItem(riNode);
            if (table == null)
                return base.EditValue(context, provider, value);
            XmlNode tc = dp.GetTableColumn(riNode);
            XmlNode tr = dp.GetTableRow(riNode);

            List<XmlNode> ar = new List<XmlNode>();		// need to put this is a list for dialog to handle
            ar.Add(table);
            dc.UndoObject.StartUndoGroup("Table Dialog");
            using (PropertyDialog pd = new PropertyDialog(dp, ar, PropertyTypeEnum.ReportItems, tc, tr))
            {
                // Display the UI editor dialog
                DialogResult dr = editorService.ShowDialog(pd);
                dc.UndoObject.EndUndoGroup(pd.Changed || dr == DialogResult.OK);
                if (pd.Changed || dr == DialogResult.OK)
                {
                    dp.Invalidate();
                    return new PropertyTable(dp, dc, pt.Nodes);
                }

                return base.EditValue(context, provider, value);
            }
        }
Exemplo n.º 5
0
        public override object EditValue(ITypeDescriptorContext context,
                                         IServiceProvider provider,
                                         object value)
        {
            if ((context == null) || (provider == null))
            {
                return(base.EditValue(context, provider, value));
            }

            // Access the Property Browser's UI display service
            IWindowsFormsEditorService editorService =
                (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (editorService == null)
            {
                return(base.EditValue(context, provider, value));
            }

            // Create an instance of the UI editor form
            IReportItem iri = context.Instance as IReportItem;

            if (iri == null)
            {
                return(base.EditValue(context, provider, value));
            }
            PropertyReportItem pri = iri.GetPRI();

            PropertyTable pt = value as PropertyTable;

            if (pt == null)
            {
                return(base.EditValue(context, provider, value));
            }

            //SingleCtlDialog scd = new SingleCtlDialog(pri.DesignCtl, pri.Draw, pri.Nodes, SingleCtlTypeEnum.BorderCtl, pb.Names);
            DesignCtl     dc = pri.DesignCtl;
            DesignXmlDraw dp = dc.DrawCtl;

            if (dp.SelectedCount != 1)
            {
                return(base.EditValue(context, provider, value));
            }
            XmlNode riNode = dp.SelectedList[0];
            XmlNode table  = dp.GetTableFromReportItem(riNode);

            if (table == null)
            {
                return(base.EditValue(context, provider, value));
            }
            XmlNode tc = dp.GetTableColumn(riNode);
            XmlNode tr = dp.GetTableRow(riNode);

            List <XmlNode> ar = new List <XmlNode>();             // need to put this is a list for dialog to handle

            ar.Add(table);
            dc.UndoObject.StartUndoGroup(Strings.PropertyTableUIEditor_EditValue_TableDialog);
            using (PropertyDialog pd = new PropertyDialog(dp, ar, PropertyTypeEnum.ReportItems, tc, tr))
            {
                // Display the UI editor dialog
                DialogResult dr = editorService.ShowDialog(pd);
                dc.UndoObject.EndUndoGroup(pd.Changed || dr == DialogResult.OK);
                if (pd.Changed || dr == DialogResult.OK)
                {
                    dp.Invalidate();
                    return(new PropertyTable(dp, dc, pt.Nodes));
                }

                return(base.EditValue(context, provider, value));
            }
        }
Exemplo n.º 6
0
        private void dataSetsToolStripMenuItem_Click(object sender, System.EventArgs e)
        {
            MDIChild mc = this.ActiveMdiChild as MDIChild;
            if (mc == null || mc.DrawCtl == null || mc.ReportDocument == null)
                return;

            ToolStripMenuItem menu = sender as ToolStripMenuItem;
            if (menu == null)
                return;
            mc.Editor.StartUndoGroup(Strings.RdlDesigner_Undo_DataSetDialog);

            string dsname = menu.Text;

            // Find the dataset we need
            List<XmlNode> ds = new List<XmlNode>();
            DesignXmlDraw draw = mc.DrawCtl;
            XmlNode rNode = draw.GetReportNode();
            XmlNode dsNode = draw.GetCreateNamedChildNode(rNode, "DataSets");
            XmlNode dataset = null;

            // find the requested dataset: the menu text equals the name of the dataset
            int dsCount = 0;		// count of the datasets
            string onlyOneDsname = null;
            foreach (XmlNode dNode in dsNode)
            {
                if (dNode.Name != "DataSet")
                    continue;
                XmlAttribute nAttr = dNode.Attributes["Name"];
                if (nAttr == null)	// shouldn't really happen
                    continue;
                if (dsCount == 0)
                    onlyOneDsname = nAttr.Value;		// we keep track of 1st name;

                dsCount++;
                if (nAttr.Value == dsname)
                    dataset = dNode;
            }

            bool bNew = false;
            if (dataset == null)	// This must be the new menu item
            {
                dataset = draw.CreateElement(dsNode, "DataSet", null);	// create empty node
                bNew = true;
            }
            ds.Add(dataset);

            using (PropertyDialog pd = new PropertyDialog(mc.DrawCtl, ds, PropertyTypeEnum.DataSets))
            {
                DialogResult dr = pd.ShowDialog();
                if (pd.Changed || dr == DialogResult.OK)
                {
                    if (dsCount == 1)
                    // if we used to just have one DataSet we may need to fix up DataRegions
                    //	that were defaulting to that name
                    {
                        dsCount = 0;
                        bool bUseName = false;
                        foreach (XmlNode dNode in dsNode)
                        {
                            if (dNode.Name != "DataSet")
                                continue;
                            XmlAttribute nAttr = dNode.Attributes["Name"];
                            if (nAttr == null)	// shouldn't really happen
                                continue;

                            dsCount++;
                            if (onlyOneDsname == nAttr.Value)
                                bUseName = true;
                        }
                        if (bUseName && dsCount > 1)
                        {
                            foreach (XmlNode drNode in draw.ReportNames.ReportItems)
                            {
                                switch (drNode.Name)
                                {
                                    // If a DataRegion doesn't have a dataset name specified use previous one
                                    case "Table":
                                    case "List":
                                    case "Matrix":
                                    case "Chart":
                                        XmlNode aNode = draw.GetNamedChildNode(drNode, "DataSetName");
                                        if (aNode == null)
                                            draw.CreateElement(drNode, "DataSetName", onlyOneDsname);
                                        break;
                                    default:
                                        break;
                                }
                            }
                        }
                    }
                    mc.Modified = true;
                }
                else if (bNew)	// if canceled and new DataSet get rid of temp node
                {
                    dsNode.RemoveChild(dataset);
                }
                if (pd.Delete)	// user must have hit a delete button for this to get set
                    dsNode.RemoveChild(dataset);

                if (!dsNode.HasChildNodes)		// If no dataset exists we remove DataSets
                    draw.RemoveElement(rNode, "DataSets");

                mc.Editor.EndUndoGroup(pd.Changed || dr == DialogResult.OK);
            }
        }
Exemplo n.º 7
0
		private void DoPropertyDialog(PropertyTypeEnum type)
		{
			StartUndoGroup(Strings.DesignCtl_Undo_Dialog);
			PropertyDialog pd = new PropertyDialog(_DrawPanel, _DrawPanel.SelectedList, type);
            try
            {
                DialogResult dr = pd.ShowDialog(this);
                this.EndUndoGroup(pd.Changed || dr == DialogResult.OK);
                if (pd.Changed || dr == DialogResult.OK)
                {
                    ReportChanged(this, new EventArgs());
                    _DrawPanel.Invalidate();
                }
            }
            finally
            {
                pd.Dispose();
            }
			SetFocus();
		}
Exemplo n.º 8
0
		private void menuTableProperties_Click(object sender, EventArgs e)
		{
			if (_DrawPanel.SelectedCount != 1)
				return;
			XmlNode riNode = _DrawPanel.SelectedList[0];
			XmlNode table = _DrawPanel.GetTableFromReportItem(riNode);
			if (table == null)
				return;
			XmlNode tc = _DrawPanel.GetTableColumn(riNode);
			XmlNode tr = _DrawPanel.GetTableRow(riNode);

			List<XmlNode> ar = new List<XmlNode>();		// need to put this is a list for dialog to handle
			ar.Add(table);
			_Undo.StartUndoGroup(Strings.DesignCtl_Undo_TableDialog);
			PropertyDialog pd = new PropertyDialog(_DrawPanel, ar, PropertyTypeEnum.ReportItems, tc, tr);
            try
            {
                DialogResult dr = pd.ShowDialog(this);
                _Undo.EndUndoGroup(pd.Changed || dr == DialogResult.OK);
                if (pd.Changed || dr == DialogResult.OK)
                {
                    ReportChanged(this, new EventArgs());
                    _DrawPanel.Invalidate();
                }
            }
            finally
            {
                pd.Dispose();
            }
		}
Exemplo n.º 9
0
		private void menuTableInsertGroup_Click(object sender, EventArgs e)
		{
			if (_DrawPanel.SelectedCount != 1)
				return;
			XmlNode cNode = _DrawPanel.SelectedList[0];
			_Undo.StartUndoGroup(Strings.DesignCtl_Undo_InsertTableGroup);
			XmlNode tblGroup = _DrawPanel.InsertTableGroup(cNode);
			if (tblGroup == null)
			{
				_Undo.EndUndoGroup(false);
				return;
			}

			List<XmlNode> ar = new List<XmlNode>();		// need to put this is a list for dialog to handle
			ar.Add(tblGroup);
			PropertyDialog pd = new PropertyDialog(_DrawPanel, ar, PropertyTypeEnum.Grouping);
            try
            {
                DialogResult dr = pd.ShowDialog(this);
                if (pd.Changed || dr == DialogResult.OK)
                {
                    _Undo.EndUndoGroup(true);
                    ReportChanged(this, new EventArgs());
                    _DrawPanel.Invalidate();
                }
                else
                {
                    _DrawPanel.DeleteTableGroup(tblGroup);
                    _Undo.EndUndoGroup(false);
                }
            }
            finally
            {
                pd.Dispose();
            }
		}
Exemplo n.º 10
0
		private void menuTableEditGroup_Click(object sender, EventArgs e)
		{
			if (_DrawPanel.SelectedCount != 1)
				return;

			var menu = (ToolStripMenuItem)sender;

			var gname = menu.Text;

			XmlNode cNode = _DrawPanel.SelectedList[0];

			_Undo.StartUndoGroup(Strings.DesignCtl_Undo_DialogTableGroupEdit);
			XmlNode tblGroup = _DrawPanel.GetTableGroup(cNode, gname);

			List<XmlNode> ar = new List<XmlNode>();		// need to put this is a list for dialog to handle
			ar.Add(tblGroup);
			PropertyDialog pd = new PropertyDialog(_DrawPanel, ar, PropertyTypeEnum.Grouping);
            try
            {
                DialogResult dr = pd.ShowDialog(this);
                _Undo.EndUndoGroup(pd.Changed || dr == DialogResult.OK);
                if (pd.Changed || dr == DialogResult.OK)
                {
                    ReportChanged(this, new EventArgs());
                    _DrawPanel.Invalidate();
                }
            }
            finally
            {
                pd.Dispose();
            }
		}
Exemplo n.º 11
0
		private void DoPropertyDialog(PropertyTypeEnum type)
		{
			this.StartUndoGroup("Dialog");
			PropertyDialog pd = new PropertyDialog(_DrawPanel, _DrawPanel.SelectedList, type);
			DialogResult dr = pd.ShowDialog(this);
			this.EndUndoGroup(pd.Changed || dr == DialogResult.OK);
			if (pd.Changed || dr == DialogResult.OK)
			{
				ReportChanged(this, new EventArgs());
				_DrawPanel.Invalidate();
			}
			SetFocus();
		}
Exemplo n.º 12
0
		private void menuTableEditGroup_Click(object sender, EventArgs e)
		{
			if (_DrawPanel.SelectedCount != 1)
				return;
			MenuItem menu = sender as MenuItem;
			if (menu == null)
				return;
			string gname = menu.Text;
			XmlNode cNode = _DrawPanel.SelectedList[0];

			_Undo.StartUndoGroup("Dialog Table Group Edit");
			XmlNode tblGroup = _DrawPanel.GetTableGroup(cNode, gname);

			List<XmlNode> ar = new List<XmlNode>();		// need to put this is a list for dialog to handle
			ar.Add(tblGroup);
			PropertyDialog pd = new PropertyDialog(_DrawPanel, ar, PropertyTypeEnum.Grouping);
			DialogResult dr = pd.ShowDialog(this);
			_Undo.EndUndoGroup(pd.Changed || dr == DialogResult.OK);
			if (pd.Changed || dr == DialogResult.OK)
			{
				ReportChanged(this, new EventArgs());
				_DrawPanel.Invalidate();   
			}
		}
Exemplo n.º 13
0
		private void menuMatrixInsertRowGroup_Click(object sender, EventArgs e)
		{
			if (_DrawPanel.SelectedCount != 1)
				return;
			XmlNode cNode =  _DrawPanel.SelectedList[0];
			XmlNode rowGroup = _DrawPanel.InsertMatrixRowGroup(cNode);
			if (rowGroup == null)
				return;

			List<XmlNode> ar = new List<XmlNode>();		// need to put this is a list for dialog to handle
			ar.Add(rowGroup);
			_Undo.StartUndoGroup("Matrix Insert Row Group");
			PropertyDialog pd = new PropertyDialog(_DrawPanel, ar, PropertyTypeEnum.Grouping);
			DialogResult dr = pd.ShowDialog(this);
			if (pd.Changed || dr == DialogResult.OK)
			{
				_Undo.EndUndoGroup(true);
				ReportChanged(this, new EventArgs());
				_DrawPanel.Invalidate();   
			}
			else
			{
				_DrawPanel.DeleteMatrixGroup(rowGroup);
				_Undo.EndUndoGroup(false);
			}
		}
Exemplo n.º 14
0
		private void menuMatrixProperties_Click(object sender, EventArgs e)
		{
			if (_DrawPanel.SelectedCount != 1)
				return;
			XmlNode riNode = _DrawPanel.SelectedList[0];
			XmlNode table = _DrawPanel.GetMatrixFromReportItem(riNode);
			if (table == null)
				return;

			List<XmlNode> ar = new List<XmlNode>();		// need to put this is a list for dialog to handle
			ar.Add(table);
			_Undo.StartUndoGroup("Matrix Dialog");
			PropertyDialog pd = new PropertyDialog(_DrawPanel, ar, PropertyTypeEnum.ReportItems);
			DialogResult dr = pd.ShowDialog(this);
			_Undo.EndUndoGroup(pd.Changed || dr == DialogResult.OK);
			if (pd.Changed || dr == DialogResult.OK)
			{
				ReportChanged(this, new EventArgs());
				_DrawPanel.Invalidate();   
			}
		}
Exemplo n.º 15
0
		private void menuInsertTable_Click(object sender, EventArgs e)
		{
			HitLocation hl = _DrawPanel.HitContainer(_MousePosition, 
				PointsX(_hScroll.Value), PointsY(_vScroll.Value));
			if (hl == null || hl.HitContainer == null)
				return;
			
			// Tables aren't allowed in PageHeader or PageFooter
			if (_DrawPanel.InPageHeaderOrFooter(hl.HitContainer))
			{
				MessageBox.Show("Tables can only be inserted in the body of the report.", "Insert");
				return;
			}

			_Undo.StartUndoGroup("Insert Table");
			DialogNewTable dnt = new DialogNewTable(this._DrawPanel, hl.HitContainer);
			DialogResult dr = dnt.ShowDialog(this);
			if (dr != DialogResult.OK)
			{
				_Undo.EndUndoGroup(false);
				return;
			}
			XmlNode table;
			if (hl.HitContainer.Name == "Table")
				table = _DrawPanel.ReplaceTableMatrixOrChart(hl, dnt.TableXml);
			else
				table = _DrawPanel.PasteTableMatrixOrChart(hl.HitContainer, dnt.TableXml, hl.HitRelative);
			if (table == null)
			{
				_Undo.EndUndoGroup(false);
				return;
			}
			_Undo.EndUndoGroup(true);
			ReportChanged(this, new EventArgs());
			SelectionChanged(this, new EventArgs());
			ReportItemInserted(this, new EventArgs());
			_DrawPanel.Invalidate();   

			// Now bring up the property dialog
			List<XmlNode> ar = new List<XmlNode>();
			ar.Add(table);
			_Undo.StartUndoGroup("Dialog");
			PropertyDialog pd = new PropertyDialog(_DrawPanel, ar, PropertyTypeEnum.ReportItems);
			dr = pd.ShowDialog(this);
			_Undo.EndUndoGroup(pd.Changed || dr == DialogResult.OK);
			if (pd.Changed || dr == DialogResult.OK)
			{
				ReportChanged(this, new EventArgs());
				_DrawPanel.Invalidate();   
			}
			SetFocus();
		}