Exemple #1
0
        // Create an MDI child.   Only creates it if not already open
        private void CreateMDIChild(Uri file, bool bMenuUpdate)
        {
            MDIChild mcOpen = null;

            if (file != null)
            {
                foreach (MDIChild mc in this.MdiChildren)
                {
                    if (file == mc.SourceFile)
                    {                                                   // we found it
                        mcOpen = mc;
                        break;
                    }
                }
            }
            if (mcOpen == null)
            {
                MDIChild mc = new MDIChild(this.ClientRectangle.Width * 3 / 4, this.ClientRectangle.Height * 3 / 4);
                mc.MdiParent = this;
                mc.Viewer.GetDataSourceReferencePassword = _GetPassword;
                mc.SourceFile = file;
                mc.Text       = file == null ? string.Empty : file.LocalPath;
                NoteRecentFiles(file, bMenuUpdate);
                mc.Show();
            }
            else
            {
                mcOpen.Activate();
            }
        }
Exemple #2
0
        private void menuView_Popup(object sender, EventArgs e)
        {
            // These menus require an MDIChild in order to work
            bool bEnable = this.MdiChildren.Length > 0 ? true : false;

            zoomToToolStripMenuItem.Enabled     = bEnable;
            actualSizeToolStripMenuItem.Enabled = bEnable;
            fitPageToolStripMenuItem.Enabled    = bEnable;
            fitWidthToolStripMenuItem.Enabled   = bEnable;
            pageLayoutToolStripMenuItem.Enabled = bEnable;
            if (!bEnable)
            {
                return;
            }

            // Now handle checking the correct sizing menu
            MDIChild mc = this.ActiveMdiChild as MDIChild;

            actualSizeToolStripMenuItem.Checked = fitPageToolStripMenuItem.Checked = fitWidthToolStripMenuItem.Checked = false;

            if (mc.Viewer.ZoomMode == ZoomEnum.FitWidth)
            {
                fitWidthToolStripMenuItem.Checked = true;
            }
            else if (mc.Viewer.ZoomMode == ZoomEnum.FitPage)
            {
                fitPageToolStripMenuItem.Checked = true;
            }
            else if (mc.Viewer.Zoom == 1)
            {
                actualSizeToolStripMenuItem.Checked = true;
            }
        }
Exemple #3
0
        private void menuPL_Popup(object sender, EventArgs e)
        {
            MDIChild mc = this.ActiveMdiChild as MDIChild;

            if (mc == null)
            {
                return;
            }

            singlePageToolStripMenuItem.Checked = continuousToolStripMenuItem.Checked =
                facingToolStripMenuItem.Checked = continuousFacingToolStripMenuItem.Checked = false;;

            switch (mc.Viewer.ScrollMode)
            {
            case ScrollModeEnum.Continuous:
                continuousToolStripMenuItem.Checked = true;
                break;

            case ScrollModeEnum.ContinuousFacing:
                continuousFacingToolStripMenuItem.Checked = true;
                break;

            case ScrollModeEnum.Facing:
                facingToolStripMenuItem.Checked = true;
                break;

            case ScrollModeEnum.SinglePage:
                singlePageToolStripMenuItem.Checked = true;
                break;
            }
        }
Exemple #4
0
        public RdlReader(bool mono)
        {
            bMono = mono;
            GetStartupState();
            BuildMenus();
            InitializeComponent();
            Application.AddMessageFilter(this);

            this.Closing += new System.ComponentModel.CancelEventHandler(this.RdlReader_Closing);
            _GetPassword  = new RDL.NeedPassword(this.GetPassword);

            // open up the current files if any
            if (_CurrentFiles != null)
            {
                foreach (string file in _CurrentFiles)
                {
                    MDIChild mc = new MDIChild(this.ClientRectangle.Width * 3 / 4, this.ClientRectangle.Height * 3 / 4);
                    mc.MdiParent = this;
                    mc.Viewer.GetDataSourceReferencePassword = _GetPassword;
                    mc.SourceFile = file;
                    mc.Text       = file;
                    mc.Show();
                }
                _CurrentFiles = null;                           // don't need this any longer
            }
        }
Exemple #5
0
        private void menuPL_Popup(object sender, EventArgs e)
        {
            MDIChild mc = this.ActiveMdiChild as MDIChild;

            if (mc == null)
            {
                return;
            }

            menuPLSinglePage.Checked = menuPLContinuous.Checked =
                menuPLFacing.Checked = menuPLContinuousFacing.Checked = false;;

            switch (mc.Viewer.ScrollMode)
            {
            case ScrollModeEnum.Continuous:
                menuPLContinuous.Checked = true;
                break;

            case ScrollModeEnum.ContinuousFacing:
                menuPLContinuousFacing.Checked = true;
                break;

            case ScrollModeEnum.Facing:
                menuPLFacing.Checked = true;
                break;

            case ScrollModeEnum.SinglePage:
                menuPLSinglePage.Checked = true;
                break;
            }
        }
Exemple #6
0
        private void menuView_Popup(object sender, EventArgs e)
        {
            // These menus require an MDIChild in order to work
            bool bEnable = this.MdiChildren.Length > 0? true: false;

            menuPLZoomTo.Enabled     = bEnable;
            menuPLActualSize.Enabled = bEnable;
            menuPLFitPage.Enabled    = bEnable;
            menuPLFitWidth.Enabled   = bEnable;
            menuPL.Enabled           = bEnable;
            if (!bEnable)
            {
                return;
            }

            // Now handle checking the correct sizing menu
            MDIChild mc = this.ActiveMdiChild as MDIChild;

            menuPLActualSize.Checked = menuPLFitPage.Checked = menuPLFitWidth.Checked = false;

            if (mc.Viewer.ZoomMode == ZoomEnum.FitWidth)
            {
                menuPLFitWidth.Checked = true;
            }
            else if (mc.Viewer.ZoomMode == ZoomEnum.FitPage)
            {
                menuPLFitPage.Checked = true;
            }
            else if (mc.Viewer.Zoom == 1)
            {
                menuPLActualSize.Checked = true;
            }
        }
Exemple #7
0
        private void menuPLSinglePage_Click(object sender, EventArgs e)
        {
            MDIChild mc = this.ActiveMdiChild as MDIChild;

            if (mc != null)
            {
                mc.Viewer.ScrollMode = ScrollModeEnum.SinglePage;
            }
        }
Exemple #8
0
        private void menuPLContinuousFacing_Click(object sender, EventArgs e)
        {
            MDIChild mc = this.ActiveMdiChild as MDIChild;

            if (mc != null)
            {
                mc.Viewer.ScrollMode = ScrollModeEnum.ContinuousFacing;
            }
        }
Exemple #9
0
        private void menuFileClose_Click(object sender, EventArgs e)
        {
            MDIChild mc = this.ActiveMdiChild as MDIChild;

            if (mc != null)
            {
                mc.Close();
            }
        }
Exemple #10
0
        private void menuPLActualSize_Click(object sender, EventArgs e)
        {
            MDIChild mc = this.ActiveMdiChild as MDIChild;

            if (mc != null)
            {
                mc.Viewer.Zoom = 1;
            }
        }
Exemple #11
0
        private void menuPLFitWidth_Click(object sender, EventArgs e)
        {
            MDIChild mc = this.ActiveMdiChild as MDIChild;

            if (mc != null)
            {
                mc.Viewer.ZoomMode = ZoomEnum.FitWidth;
            }
        }
Exemple #12
0
        private void menuSelection_Click(object sender, System.EventArgs ea)
        {
            MDIChild mc = this.ActiveMdiChild as MDIChild;

            if (mc == null)
            {
                return;
            }

            mc.Viewer.SelectTool = !mc.Viewer.SelectTool;
        }
Exemple #13
0
        private void menuCopy_Click(object sender, System.EventArgs ea)
        {
            MDIChild mc = this.ActiveMdiChild as MDIChild;

            if (mc == null || !mc.Viewer.CanCopy)
            {
                return;
            }

            mc.Viewer.Copy();
        }
Exemple #14
0
        private void menuFilePrint_Click(object sender, EventArgs e)
        {
            MDIChild mc = this.ActiveMdiChild as MDIChild;

            if (mc == null)
            {
                return;
            }
            if (printChild != null)                     // already printing
            {
                MessageBox.Show(Strings.RdlReader_ShowC_PrintOneFile);
                return;
            }

            printChild = mc;

            PrintDocument pd = new PrintDocument();

            pd.DocumentName                = mc.SourceFile.LocalPath;
            pd.PrinterSettings.FromPage    = 1;
            pd.PrinterSettings.ToPage      = mc.Viewer.PageCount;
            pd.PrinterSettings.MaximumPage = mc.Viewer.PageCount;
            pd.PrinterSettings.MinimumPage = 1;
            if (mc.Viewer.PageWidth > mc.Viewer.PageHeight)
            {
                pd.DefaultPageSettings.Landscape = true;
            }
            else
            {
                pd.DefaultPageSettings.Landscape = false;
            }

            PrintDialog dlg = new PrintDialog();

            dlg.Document       = pd;
            dlg.AllowSelection = true;
            dlg.AllowSomePages = true;
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    if (pd.PrinterSettings.PrintRange == PrintRange.Selection)
                    {
                        pd.PrinterSettings.FromPage = mc.Viewer.PageCurrent;
                    }
                    mc.Viewer.Print(pd);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(Strings.RdlReader_ShowC_PrintError + ex.Message);
                }
            }
            printChild = null;
        }
Exemple #15
0
        private void menuPLZoomTo_Click(object sender, EventArgs e)
        {
            MDIChild mc = this.ActiveMdiChild as MDIChild;

            if (mc == null)
            {
                return;
            }

            ZoomTo dlg = new ZoomTo(mc.Viewer);

            dlg.StartPosition = FormStartPosition.CenterParent;
            dlg.ShowDialog();
        }
Exemple #16
0
        private void menuFind_Click(object sender, System.EventArgs ea)
        {
            MDIChild mc = this.ActiveMdiChild as MDIChild;

            if (mc == null)
            {
                return;
            }

            if (!mc.Viewer.ShowFindPanel)
            {
                mc.Viewer.ShowFindPanel = true;
            }
            mc.Viewer.FindNext();
        }
Exemple #17
0
        public RdlReader(bool mono)
        {
            bMono = mono;
            GetStartupState();

            InitializeComponent();

            BuildMenus();
            // CustomReportItem load 
            RdlEngineConfig.GetCustomReportTypes();

            Application.AddMessageFilter(this);

            this.Closing += new System.ComponentModel.CancelEventHandler(this.RdlReader_Closing);
            _GetPassword = new RDL.NeedPassword(this.GetPassword);

            // open up the current files if any
            if (_CurrentFiles != null)
            {
                foreach (var dict in _CurrentFiles)
                {
                    MDIChild mc = new MDIChild(this.ClientRectangle.Width * 3 / 4, this.ClientRectangle.Height * 3 / 4);
                    mc.MdiParent = this;
                    mc.Viewer.GetDataSourceReferencePassword = _GetPassword;

                    mc.SourceFile = dict.Key;
                    if (dict.Value != string.Empty)
                    {
                        mc.Parameters = dict.Value;
                    }

                    mc.Text = dict.Key.LocalPath;

                    if (_CurrentFiles.Count == 1)
                    {
                        mc.WindowState = FormWindowState.Maximized;
                    }

                    mc.Show();

                }
                _CurrentFiles = null;		// don't need this any longer
            }

        }
Exemple #18
0
        private void menuEdit_Popup(object sender, EventArgs e)
        {
            // These menus require an MDIChild in order to work
            bool bEnable = this.MdiChildren.Length > 0 ? true : false;

            copyToolStripMenuItem.Enabled          = bEnable;
            findToolStripMenuItem.Enabled          = bEnable;
            selectionToolToolStripMenuItem.Enabled = bEnable;
            if (!bEnable)
            {
                return;
            }

            MDIChild mc = this.ActiveMdiChild as MDIChild;

            copyToolStripMenuItem.Enabled          = mc.Viewer.CanCopy;
            selectionToolToolStripMenuItem.Checked = mc.Viewer.SelectTool;
        }
Exemple #19
0
        public RdlReader(bool mono)
        {
            bMono = mono;
            GetStartupState();

            InitializeComponent();

            BuildMenus();
            // CustomReportItem load
            RdlEngineConfig.GetCustomReportTypes();

            Application.AddMessageFilter(this);

            this.Closing += new System.ComponentModel.CancelEventHandler(this.RdlReader_Closing);
            _GetPassword  = new RDL.NeedPassword(this.GetPassword);

            // open up the current files if any
            if (_CurrentFiles != null)
            {
                foreach (var dict in _CurrentFiles)
                {
                    MDIChild mc = new MDIChild(this.ClientRectangle.Width * 3 / 4, this.ClientRectangle.Height * 3 / 4);
                    mc.MdiParent = this;
                    mc.Viewer.GetDataSourceReferencePassword = _GetPassword;

                    mc.SourceFile = dict.Key;
                    if (dict.Value != string.Empty)
                    {
                        mc.Parameters = dict.Value;
                    }

                    mc.Text = dict.Key.LocalPath;

                    if (_CurrentFiles.Count == 1)
                    {
                        mc.WindowState = FormWindowState.Maximized;
                    }

                    mc.Show();
                }
                _CurrentFiles = null;           // don't need this any longer
            }
        }
Exemple #20
0
        private void menuFileSaveAs_Click(object sender, EventArgs e)
        {
            MDIChild mc = this.ActiveMdiChild as MDIChild;

            if (mc == null)
            {
                return;
            }

            SaveFileDialog sfd = new SaveFileDialog();

            sfd.Filter      = Strings.RdlReader_menuFileSaveAs_Click_FilesFilter;
            sfd.FilterIndex = 1;

            Uri file = mc.SourceFile;

            if (file != null)
            {
                int index = file.LocalPath.LastIndexOf('.');
                if (index > 1)
                {
                    sfd.FileName = file.LocalPath.Substring(0, index) + ".pdf";
                }
                else
                {
                    sfd.FileName = "*.pdf";
                }
            }
            else
            {
                sfd.FileName = "*.pdf";
            }

            if (sfd.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            // save the report in a rendered format
            string ext = null;
            int    i   = sfd.FileName.LastIndexOf('.');

            if (i < 1)
            {
                ext = string.Empty;
            }
            else
            {
                ext = sfd.FileName.Substring(i + 1).ToLower();
            }

            OutputPresentationType type = OutputPresentationType.Internal;

            switch (ext)
            {
            case "pdf":
                type = OutputPresentationType.PDF;
                break;

            case "xml":
                type = OutputPresentationType.XML;
                break;

            case "html":
                type = OutputPresentationType.HTML;
                break;

            case "htm":
                type = OutputPresentationType.HTML;
                break;

            case "dmp":
                type = OutputPresentationType.DMP;
                break;

            case "csv":
                type = OutputPresentationType.CSV;
                break;

            case "rtf":
                type = OutputPresentationType.RTF;
                break;

            case "mht":
                type = OutputPresentationType.MHTML;
                break;

            case "mhtml":
                type = OutputPresentationType.MHTML;
                break;

            case "xlsx":
                type = OutputPresentationType.Excel;
                break;

            case "tif":
                type = OutputPresentationType.TIF;
                break;

            case "tiff":
                type = OutputPresentationType.TIF;
                break;

            default:
                MessageBox.Show(this,
                                String.Format(Strings.RdlReader_SaveG_NotValidFileType, sfd.FileName), Strings.RdlReader_SaveG_SaveAsError,
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                break;
            }

            if (type == OutputPresentationType.TIF)
            {
                DialogResult dr = MessageBox.Show(this, Strings.RdlReader_ShowF_WantSaveColorsInTIF, Strings.RdlReader_ShowF_Export, MessageBoxButtons.YesNoCancel);
                if (dr == DialogResult.No)
                {
                    type = OutputPresentationType.TIFBW;
                }
                else if (dr == DialogResult.Cancel)
                {
                    return;
                }
            }

            if (type != OutputPresentationType.Internal)
            {
                try { mc.Viewer.SaveAs(sfd.FileName, type); }
                catch (Exception ex)
                {
                    MessageBox.Show(this,
                                    ex.Message, Strings.RdlReader_SaveG_SaveAsError,
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            return;
        }
Exemple #21
0
		private void menuFilePrint_Click(object sender, EventArgs e)
		{
			MDIChild mc = this.ActiveMdiChild as MDIChild;
			if (mc == null)
				return;
			if (printChild != null)			// already printing
			{
				MessageBox.Show("Can only print one file at a time.");
				return;
			}

			printChild = mc;

			PrintDocument pd = new PrintDocument();
			pd.DocumentName = mc.SourceFile;
			pd.PrinterSettings.FromPage = 1;
			pd.PrinterSettings.ToPage = mc.Viewer.PageCount;
			pd.PrinterSettings.MaximumPage = mc.Viewer.PageCount;
			pd.PrinterSettings.MinimumPage = 1;
			if (mc.Viewer.PageWidth > mc.Viewer.PageHeight)
				pd.DefaultPageSettings.Landscape=true;
			else
				pd.DefaultPageSettings.Landscape=false;

			PrintDialog dlg = new PrintDialog();
			dlg.Document = pd;
			dlg.AllowSelection = true;
			dlg.AllowSomePages = true;
			if (dlg.ShowDialog() == DialogResult.OK)
			{
				try
				{
					if (pd.PrinterSettings.PrintRange == PrintRange.Selection)
					{
						pd.PrinterSettings.FromPage = mc.Viewer.PageCurrent;
					}
					mc.Viewer.Print(pd);
				}
				catch (Exception ex)
				{
					MessageBox.Show("Print error: " + ex.Message);
				}
			}
			printChild = null;
		}
Exemple #22
0
        private void menuFileSaveAs_Click(object sender, EventArgs e)
        {
            MDIChild mc = this.ActiveMdiChild as MDIChild;

            if (mc == null)
            {
                return;
            }

            SaveFileDialog sfd = new SaveFileDialog();

            sfd.Filter =
                "PDF files (*.pdf)|*.pdf|" +
                "XML files (*.xml)|*.xml|" +
                "HTML files (*.html)|*.html|" +
                "CSV files (*.csv)|*.csv|" +
                "RTF files (*.rtf)|*.rtf|" +
                "TIF files (*.tif)|*.tif|" +
                "Excel files (*.xlsx)|*.xlsx|" +
                "MHT files (*.mht)|*.mht";
            sfd.FilterIndex = 1;

            string file = mc.SourceFile;

            if (file != null)
            {
                int index = file.LastIndexOf('.');
                if (index > 1)
                {
                    sfd.FileName = file.Substring(0, index) + ".pdf";
                }
                else
                {
                    sfd.FileName = "*.pdf";
                }
            }
            else
            {
                sfd.FileName = "*.pdf";
            }

            if (sfd.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            // save the report in a rendered format
            string ext = null;
            int    i   = sfd.FileName.LastIndexOf('.');

            if (i < 1)
            {
                ext = "";
            }
            else
            {
                ext = sfd.FileName.Substring(i + 1).ToLower();
            }
            switch (ext)
            {
            case "pdf":
            case "xml":
            case "html":
            case "htm":
            case "csv":
            case "rtf":
            case "mht":
            case "mhtml":
            case "xlsx":
            case "tif":
            case "tiff":
                if (ext == "tif" || ext == "tiff")
                {
                    DialogResult dr = MessageBox.Show(this, "Do you want to save colors in TIF file?", "Export", MessageBoxButtons.YesNoCancel);
                    if (dr == DialogResult.No)
                    {
                        ext = "tifbw";
                    }
                    else if (dr == DialogResult.Cancel)
                    {
                        break;
                    }
                }
                try { mc.Viewer.SaveAs(sfd.FileName, ext); }
                catch (Exception ex)
                {
                    MessageBox.Show(this,
                                    ex.Message, "Save As Error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                break;

            default:
                MessageBox.Show(this,
                                String.Format("{0} is not a valid file type.  File extension must be PDF, XML, HTML, CSV, MHT, RTF, TIF, XLSX.", sfd.FileName), "Save As Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                break;
            }
            return;
        }
Exemple #23
0
		public RdlReader(bool mono)
		{
			bMono = mono;
			GetStartupState();
			BuildMenus();
			InitializeComponent();
			this.Closing += new System.ComponentModel.CancelEventHandler(this.RdlReader_Closing);
			_GetPassword = new RDL.NeedPassword(this.GetPassword);

			// open up the current files if any
			if (_CurrentFiles != null)
			{
				foreach (string file in _CurrentFiles)
				{
					MDIChild mc = new MDIChild(this.ClientRectangle.Width*3/4, this.ClientRectangle.Height*3/4);
					mc.MdiParent = this;
					mc.Viewer.GetDataSourceReferencePassword = _GetPassword;
					mc.SourceFile = file;
					mc.Text = file;
					mc.Show();
				}
				_CurrentFiles = null;		// don't need this any longer
			}

		}
Exemple #24
0
 // Create an MDI child.   Only creates it if not already open
 private void CreateMDIChild(Uri file, bool bMenuUpdate)
 {
     MDIChild mcOpen = null;
     if (file != null)
     {
         foreach (MDIChild mc in this.MdiChildren)
         {
             if (file == mc.SourceFile)
             {							// we found it
                 mcOpen = mc;
                 break;
             }
         }
     }
     if (mcOpen == null)
     {
         MDIChild mc = new MDIChild(this.ClientRectangle.Width * 3 / 4, this.ClientRectangle.Height * 3 / 4);
         mc.MdiParent = this;
         mc.Viewer.GetDataSourceReferencePassword = _GetPassword;
         mc.SourceFile = file;
         mc.Text = file == null ? "" : file.LocalPath;
         NoteRecentFiles(file, bMenuUpdate);
         mc.Show();
     }
     else
         mcOpen.Activate();
 }
Exemple #25
0
        private void menuFileSaveAs_Click(object sender, EventArgs e)
        {
            MDIChild mc = this.ActiveMdiChild as MDIChild;

            if (mc == null)
            {
                return;
            }

            SaveFileDialog sfd = new SaveFileDialog();

            sfd.Filter =
                "PDF files (*.pdf)|*.pdf|" +
                "XML files (*.xml)|*.xml|" +
                "HTML files (*.html)|*.html";
            sfd.FilterIndex = 1;

            string file = mc.SourceFile;

            if (file != null)
            {
                int index = file.LastIndexOf('.');
                if (index > 1)
                {
                    sfd.FileName = file.Substring(0, index) + ".pdf";
                }
                else
                {
                    sfd.FileName = "*.pdf";
                }
            }
            else
            {
                sfd.FileName = "*.pdf";
            }

            if (sfd.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            // save the report in a rendered format
            string ext = null;
            int    i   = sfd.FileName.LastIndexOf('.');

            if (i < 1)
            {
                ext = "";
            }
            else
            {
                ext = sfd.FileName.Substring(i + 1).ToLower();
            }
            switch (ext)
            {
            case "pdf":
            case "xml":
            case "html":
            case "htm":
                try { mc.Viewer.SaveAs(sfd.FileName, ext); }
                catch (Exception ex)
                {
                    MessageBox.Show(this,
                                    ex.Message, "Save As Error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                break;

            default:
                MessageBox.Show(this,
                                String.Format("{0} is not a valid file type.  File extension must be PDF, XML, or HTML.", sfd.FileName), "Save As Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                break;;
            }
            return;
        }