Пример #1
0
        private static bool LoadImageWizard(Enums.FormLoadType loadType, OfficeDocument officeDoc)
        {
            var loadImageWizard = officeDoc.GetPropertyValue(
                Constants.WordDocumentProperties.LoadBrandingImageSelector, false);

            if (string.Equals(loadImageWizard, "true", StringComparison.OrdinalIgnoreCase))
            {
                var wizard = new ThemesOnlyWizard(officeDoc)
                {
                    TopMost       = true,
                    StartPosition = FormStartPosition.CenterParent,
                    Reload        = (loadType != Enums.FormLoadType.OpenDocument)
                };
                wizard.Show();
                return(true);
            }
            return(false);
        }
Пример #2
0
        public static void LoadWizard(this Document document, Enums.FormLoadType loadType)
        {
            if (document.Path.Contains("http://") ||
                (ThisAddIn.IsWizzardRunning && loadType != Enums.FormLoadType.RegenerateTemplate))
            {
                //do not load on sharepoint documents (or any document loaded via http).
                return;
            }

            var officeDoc = new OfficeDocument(Globals.ThisAddIn.Application.ActiveDocument);

            if (LoadImageWizard(loadType, officeDoc))
            {
                return;
            }

            LoadNormalWizard(loadType, officeDoc);
        }
Пример #3
0
        public static void LoadWizard(this Document document, Enums.FormLoadType loadType)
        {
            if (document.Path.Contains("http://") || (ThisAddIn.IsWizzardRunning && loadType != Enums.FormLoadType.RegenerateTemplate)) //do not load on sharepoint documents (or any document loaded via http).
            {
                return;
            }

            var officeDoc = new OfficeDocument(Globals.ThisAddIn.Application.ActiveDocument);

            dynamic templateName = ((DocumentProperties)(Globals.ThisAddIn.Application.ActiveDocument.BuiltInDocumentProperties))[WdBuiltInProperty.wdPropertyTitle].Value.ToString();

            if (!String.IsNullOrEmpty(templateName))
            {
                if (String.Equals(templateName, Constants.TemplateNames.PlacementSlip, StringComparison.OrdinalIgnoreCase))
                {
                    MessageBox.Show(@"You cannot make any changes to this placement slip through the wizard", @"Cannot make any changes", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (String.Equals(templateName, Constants.TemplateNames.FileNote, StringComparison.OrdinalIgnoreCase)) //we do not show this wizard on docload.
                {
                    var wizard = new SummaryOfDiscussionWizard(officeDoc)
                    {
                        TopMost       = true,
                        StartPosition = FormStartPosition.CenterParent,
                        Reload        = (loadType != Enums.FormLoadType.OpenDocument)
                    };
#if DEBUG
                    wizard.TopMost = false;
#endif
                    wizard.ShowDialog();
                }
                else if (String.Equals(templateName, Constants.TemplateNames.PreRenewalAgenda, StringComparison.OrdinalIgnoreCase))
                {
                    var wizard = new PreRenewalAgendaWizard(officeDoc)
                    {
                        TopMost       = true,
                        StartPosition = FormStartPosition.CenterParent,
                        Reload        = (loadType != Enums.FormLoadType.OpenDocument)
                    };
#if DEBUG
                    wizard.TopMost = false;
#endif
                    wizard.ShowDialog();
                }
                else if (String.Equals(templateName, Constants.TemplateNames.InsuranceRenewalReport, StringComparison.OrdinalIgnoreCase))
                {
                    var wizard = new InsuranceRenewalReportWizard(officeDoc, loadType)
                    {
                        TopMost       = true,
                        StartPosition = FormStartPosition.CenterParent,
                        Reload        = (loadType != Enums.FormLoadType.OpenDocument)
                    };
#if DEBUG
                    wizard.TopMost = false;
#endif
                    wizard.ShowDialog();
                }
                else if (String.Equals(templateName, Constants.TemplateNames.RenewalLetter, StringComparison.OrdinalIgnoreCase))
                {
                    var wizard = new RenewalLetterWizard(officeDoc)
                    {
                        TopMost       = true,
                        StartPosition = FormStartPosition.CenterParent,
                        Reload        = (loadType != Enums.FormLoadType.OpenDocument)
                    };
#if DEBUG
                    wizard.TopMost = false;
#endif
                    wizard.ShowDialog();
                }
                else if (String.Equals(templateName, Constants.TemplateNames.ClientDiscovery, StringComparison.OrdinalIgnoreCase))
                {
                    var wizard = new ClientDiscoveryWizard(officeDoc, loadType)
                    {
                        TopMost       = true,
                        StartPosition = FormStartPosition.CenterParent,
                        Reload        = (loadType != Enums.FormLoadType.OpenDocument)
                    };
#if DEBUG
                    wizard.TopMost = false;
#endif
                    wizard.ShowDialog();
                }

                else if (String.Equals(templateName, Constants.TemplateNames.PreRenewalQuestionnaire, StringComparison.OrdinalIgnoreCase))
                {
                    var wizard = new FactFinderWizard(officeDoc, loadType)
                    {
                        TopMost       = true,
                        StartPosition = FormStartPosition.CenterParent,
                        Reload        = (loadType != Enums.FormLoadType.OpenDocument)
                    };
#if DEBUG
                    wizard.TopMost = false;
#endif
                    wizard.ShowDialog();
                }

                else if (String.Equals(templateName, Constants.TemplateNames.GenericLetter, StringComparison.OrdinalIgnoreCase))
                {
                    var wizard = new GenericLetterWizard(officeDoc)
                    {
                        TopMost       = true,
                        StartPosition = FormStartPosition.CenterParent,
                        Reload        = (loadType != Enums.FormLoadType.OpenDocument)
                    };
#if DEBUG
                    wizard.TopMost = false;
#endif
                    wizard.ShowDialog();
                }

                else if (String.Equals(templateName, Constants.TemplateNames.QuoteSlip, StringComparison.OrdinalIgnoreCase))
                {
                    var wizard = new QuoteSlipWizard(officeDoc, loadType)
                    {
                        TopMost       = true,
                        StartPosition = FormStartPosition.CenterParent,
                        Reload        = (loadType != Enums.FormLoadType.OpenDocument)
                    };
#if DEBUG
                    wizard.TopMost = false;
#endif
                    wizard.ShowDialog();
                }

                else if (String.Equals(templateName, Constants.TemplateNames.InsuranceManual, StringComparison.OrdinalIgnoreCase))
                {
                    var wizard = new InsuranceManualWizard(officeDoc, loadType)
                    {
                        TopMost       = true,
                        StartPosition = FormStartPosition.CenterParent,
                        Reload        = (loadType != Enums.FormLoadType.OpenDocument)
                    };
#if DEBUG
                    wizard.TopMost = false;
#endif
                    wizard.ShowDialog();
                }

                else if (String.Equals(templateName, Constants.TemplateNames.ShortFormProposal, StringComparison.OrdinalIgnoreCase)) //we do not show this wizard on docload.
                {
                    var wizard = new ShortFormProposalWizard(officeDoc, loadType)
                    {
                        TopMost       = true,
                        StartPosition = FormStartPosition.CenterParent,
                        Reload        = (loadType != Enums.FormLoadType.OpenDocument)
                    };
#if DEBUG
                    wizard.TopMost = false;
#endif
                    wizard.ShowDialog();
                }
            }
        }
Пример #4
0
        public static void LoadWizard(this Document document, Enums.FormLoadType loadType)
        {
            if (document.Path.Contains("http://")) //do not load on sharepoint documents (or any document loaded via http).
            {
                return;
            }

            var officeDoc = new OfficeDocument(Globals.ThisAddIn.Application.ActiveDocument);

            var templateName =
                ((DocumentProperties)(Globals.ThisAddIn.Application.ActiveDocument.BuiltInDocumentProperties))[
                    WdBuiltInProperty.wdPropertyTitle].Value.ToString();

            if (!String.IsNullOrEmpty(templateName))
            {
                if (String.Equals(templateName, BusinessLogic.Helpers.Constants.TemplateNames.PlacementSlip,
                                  StringComparison.OrdinalIgnoreCase))
                {
                }
                else if (String.Equals(templateName, BusinessLogic.Helpers.Constants.TemplateNames.FileNote,
                                       StringComparison.OrdinalIgnoreCase)) //we do not show this wizard on docload.
                {
                    var wizard = new SummaryOfDiscussionWizard(officeDoc)
                    {
                        TopMost       = true,
                        StartPosition = FormStartPosition.CenterParent,
                        Reload        = (loadType != Enums.FormLoadType.OpenDocument)
                    };
#if DEBUG
                    wizard.TopMost = false;
#endif
                    wizard.Show();
                }
                else if (String.Equals(templateName, BusinessLogic.Helpers.Constants.TemplateNames.PreRenewalAgenda,
                                       StringComparison.OrdinalIgnoreCase))
                {
                    var wizard = new PreRenewalAgendaWizard(officeDoc)
                    {
                        TopMost       = true,
                        StartPosition = FormStartPosition.CenterParent,
                        Reload        = (loadType != Enums.FormLoadType.OpenDocument)
                    };
#if DEBUG
                    wizard.TopMost = false;
#endif
                    wizard.Show();
                }
                else if (String.Equals(templateName,
                                       BusinessLogic.Helpers.Constants.TemplateNames.InsuranceRenewalReport,
                                       StringComparison.OrdinalIgnoreCase))
                {
                    var wizard = new InsuranceRenewalReportWizard(officeDoc, loadType)
                    {
                        TopMost       = true,
                        StartPosition = FormStartPosition.CenterParent,
                        Reload        = (loadType != Enums.FormLoadType.OpenDocument)
                    };
#if DEBUG
                    wizard.TopMost = false;
#endif
                    wizard.Show();
                }
                else if (String.Equals(templateName,
                                       BusinessLogic.Helpers.Constants.TemplateNames.RenewalLetter,
                                       StringComparison.OrdinalIgnoreCase))
                {
                    var wizard = new RenewalLetterWizard(officeDoc)
                    {
                        TopMost       = true,
                        StartPosition = FormStartPosition.CenterParent,
                        Reload        = (loadType != Enums.FormLoadType.OpenDocument)
                    };
#if DEBUG
                    wizard.TopMost = false;
#endif
                    wizard.Show();
                }
                else if (String.Equals(templateName,
                                       BusinessLogic.Helpers.Constants.TemplateNames.ClientDiscovery,
                                       StringComparison.OrdinalIgnoreCase))
                {
                    var wizard = new ClientDiscoveryWizard(officeDoc, loadType)
                    {
                        TopMost       = true,
                        StartPosition = FormStartPosition.CenterParent,
                        Reload        = (loadType != Enums.FormLoadType.OpenDocument)
                    };
#if DEBUG
                    wizard.TopMost = false;
#endif
                    wizard.Show();
                }
            }
        }