internal PrintPreviewLayout(IServiceProvider serviceProvider, WorkflowPrintDocument printDoc) : base(serviceProvider)
 {
     this.pageLayoutInfo = new ArrayList();
     this.headerFooterMargins = new Margins(0, 0, 0, 0);
     this.pageSeparator = DefaultPageSeparator;
     this.pageMargins = DefaultPageMargins;
     this.rowColumns = new Size(1, 1);
     this.scaling = 1f;
     this.pageSize = Size.Empty;
     this.previewTime = DateTime.Now;
     this.printDocument = printDoc;
 }
コード例 #2
0
 internal PrintPreviewLayout(IServiceProvider serviceProvider, WorkflowPrintDocument printDoc) : base(serviceProvider)
 {
     this.pageLayoutInfo      = new ArrayList();
     this.headerFooterMargins = new Margins(0, 0, 0, 0);
     this.pageSeparator       = DefaultPageSeparator;
     this.pageMargins         = DefaultPageMargins;
     this.rowColumns          = new Size(1, 1);
     this.scaling             = 1f;
     this.pageSize            = Size.Empty;
     this.previewTime         = DateTime.Now;
     this.printDocument       = printDoc;
 }
コード例 #3
0
        public WorkflowPageSetupDialog(IServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
                throw new ArgumentNullException("serviceProvider");

            this.serviceProvider = serviceProvider;

            WorkflowView workflowView = this.serviceProvider.GetService(typeof(WorkflowView)) as WorkflowView;
            if (workflowView == null)
                throw new InvalidOperationException(SR.GetString(SR.General_MissingService, typeof(WorkflowView).FullName));

            if (!(workflowView.PrintDocument is WorkflowPrintDocument))
                throw new InvalidOperationException(DR.GetString(DR.WorkflowPrintDocumentNotFound, typeof(WorkflowPrintDocument).Name));

            try
            {
                Cursor.Current = Cursors.WaitCursor;

                InitializeComponent();

                this.printDocument = workflowView.PrintDocument as WorkflowPrintDocument;
                //deserialize state of the dialog from the page setup data scaling:

                //set the values scaling controls
                this.adjustToScaleInput.Value = this.printDocument.PageSetupData.ScaleFactor;
                this.fitToPagesWideInput.Value = this.printDocument.PageSetupData.PagesWide;
                this.fitToPagesTallInput.Value = this.printDocument.PageSetupData.PagesTall;

                //select the right mode
                if (this.printDocument.PageSetupData.AdjustToScaleFactor)
                    this.adjustToRadioButton.Checked = true;
                else
                    this.fitToRadioButton.Checked = true;

                //set the orientation
                if (this.printDocument.PageSetupData.Landscape)
                    this.landscapeRadioButton.Checked = true;
                else
                    this.portraitRadioButton.Checked = true;

                //margins
                SetMarginsToUI(this.printDocument.PageSetupData.Margins);

                //centering
                this.CenterHorizontallyCheckBox.Checked = this.printDocument.PageSetupData.CenterHorizontally;
                this.CenterVerticallyCheckBox.Checked = this.printDocument.PageSetupData.CenterVertically;

                //Initialize the paper
                InitializePaperInformation();

                //read standard header/footer formats
                this.headerFooterNone = DR.GetString(DR.HeaderFooterStringNone); //"(none)"
                this.headerFooterCustom = DR.GetString(DR.HeaderFooterStringCustom); //"(none)"
                this.headerFooterTemplates = new string[] {
                    DR.GetString(DR.HeaderFooterFormat1), //"Page %Page%",//
                    DR.GetString(DR.HeaderFooterFormat2), //"Page %Page% of %Pages%",//
                    DR.GetString(DR.HeaderFooterFormat3), //"%Path%%File, Page %Page% of %Pages%", //
                    DR.GetString(DR.HeaderFooterFormat4), //"%Path%%File, Page %Page%",//
                    DR.GetString(DR.HeaderFooterFormat5), //"%File, %Date% %Time%, Page %Page%",//
                    DR.GetString(DR.HeaderFooterFormat6), //"%File, Page %Page% of %Pages%",//
                    DR.GetString(DR.HeaderFooterFormat7), //"%File, Page %Page%",//
                    DR.GetString(DR.HeaderFooterFormat8), //"Prepated by %User% %Date%",//
                    DR.GetString(DR.HeaderFooterFormat9), //"%User%, Page %Page%, %Date%"//
                };

                //header inputs
                this.headerTextComboBox.Items.Add(this.headerFooterNone);
                this.headerTextComboBox.Items.AddRange(this.headerFooterTemplates);
                this.headerTextComboBox.Items.Add(this.headerFooterCustom);
                this.headerTextComboBox.SelectedIndex = 0;

                string userHeader = this.printDocument.PageSetupData.HeaderTemplate;
                this.headerCustom = this.printDocument.PageSetupData.HeaderCustom;
                if (userHeader.Length == 0)
                {
                    this.headerTextComboBox.SelectedIndex = 0; //none
                }
                else
                {
                    int userHeaderIndex = this.headerTextComboBox.Items.IndexOf(userHeader);

                    if (-1 == userHeaderIndex || this.headerCustom)
                    {
                        //this is an unknown template, put it into custom field
                        this.headerTextComboBox.SelectedIndex = this.headerTextComboBox.Items.IndexOf(this.headerFooterCustom);
                        this.customHeaderText.Text = userHeader;
                    }
                    else
                    {
                        this.headerTextComboBox.SelectedIndex = userHeaderIndex;
                    }
                }

                this.headerAlignmentComboBox.Items.AddRange(new object[] { HorizontalAlignment.Left, HorizontalAlignment.Center, HorizontalAlignment.Right });
                if (this.headerAlignmentComboBox.Items.IndexOf(this.printDocument.PageSetupData.HeaderAlignment) != -1)
                    this.headerAlignmentComboBox.SelectedItem = this.printDocument.PageSetupData.HeaderAlignment;
                else
                    this.headerAlignmentComboBox.SelectedItem = HorizontalAlignment.Center;

                this.headerMarginInput.Value = PrinterUnitToUIUnit(this.printDocument.PageSetupData.HeaderMargin);

                //footer inputs
                this.footerTextComboBox.Items.Add(this.headerFooterNone);
                this.footerTextComboBox.SelectedIndex = 0;
                this.footerTextComboBox.Items.AddRange(this.headerFooterTemplates);
                this.footerTextComboBox.Items.Add(this.headerFooterCustom);

                string userFooter = this.printDocument.PageSetupData.FooterTemplate;
                this.footerCustom = this.printDocument.PageSetupData.FooterCustom;
                if (userFooter.Length == 0)
                {
                    this.footerTextComboBox.SelectedIndex = 0; //none
                }
                else
                {
                    int userFooterIndex = this.footerTextComboBox.Items.IndexOf(userFooter);

                    if (-1 == userFooterIndex || this.footerCustom)
                    {
                        //this is an unknown template, put it into custom field
                        this.footerTextComboBox.SelectedIndex = this.footerTextComboBox.Items.IndexOf(this.headerFooterCustom);
                        this.customFooterText.Text = userFooter;
                    }
                    else
                    {
                        this.footerTextComboBox.SelectedIndex = userFooterIndex;
                    }
                }

                this.footerAlignmentComboBox.Items.AddRange(new object[] { HorizontalAlignment.Left, HorizontalAlignment.Center, HorizontalAlignment.Right });
                if (this.footerAlignmentComboBox.Items.IndexOf(this.printDocument.PageSetupData.FooterAlignment) != -1)
                    this.footerAlignmentComboBox.SelectedItem = this.printDocument.PageSetupData.FooterAlignment;
                else
                    this.footerAlignmentComboBox.SelectedItem = HorizontalAlignment.Center;

                this.footerMarginInput.Value = PrinterUnitToUIUnit(this.printDocument.PageSetupData.FooterMargin);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
コード例 #4
0
 internal PrintPreviewLayout(IServiceProvider serviceProvider, WorkflowPrintDocument printDoc)
     : base(serviceProvider)
 {
     this.printDocument = printDoc;
 }
コード例 #5
0
 internal PrintPreviewLayout(IServiceProvider serviceProvider, WorkflowPrintDocument printDoc)
     : base(serviceProvider)
 {
     this.printDocument = printDoc;
 }