Beispiel #1
0
        public static IConstraintGenerator NewConstraintGenerator(
            IGSettingsManager igSettings,
            MainDocumentPart mainPart,
            CommentManager cmtMgr,
            FigureCollection figures,
            bool includeSamples,
            IObjectRepository dataSource,
            List <TemplateConstraint> rootConstraints,
            List <TemplateConstraint> allConstraints,
            Template currentTemplate,
            List <Template> allTemplates,
            string constraintHeadingStyle,
            List <string> selectedCategories,
            HyperlinkTracker hyperlinkTracker)
        {
            IConstraintGenerator constraintGenerator = null;

            if (igSettings.GetBoolSetting(IGSettingsManager.SettingProperty.UseConsolidatedConstraintFormat))
            {
                constraintGenerator = new ConsolidatedGeneration();
            }
            else
            {
                constraintGenerator = new LegacyGeneration();
            }

            constraintGenerator.IGSettings             = igSettings;
            constraintGenerator.Figures                = figures;
            constraintGenerator.IncludeSamples         = includeSamples;
            constraintGenerator.DataSource             = dataSource;
            constraintGenerator.RootConstraints        = rootConstraints;
            constraintGenerator.AllConstraints         = allConstraints;
            constraintGenerator.CurrentTemplate        = currentTemplate;
            constraintGenerator.AllTemplates           = allTemplates;
            constraintGenerator.ConstraintHeadingStyle = constraintHeadingStyle;
            constraintGenerator.CommentManager         = cmtMgr;
            constraintGenerator.IncludeCategory        = !string.IsNullOrEmpty(igSettings.GetSetting(IGSettingsManager.SettingProperty.Categories));
            constraintGenerator.SelectedCategories     = selectedCategories;
            constraintGenerator.HyperlinkTracker       = hyperlinkTracker;
            constraintGenerator.MainPart               = mainPart;
            constraintGenerator.DocumentBody           = mainPart.Document.Body;

            return(constraintGenerator);
        }
Beispiel #2
0
        private void SetupStyles()
        {
            WordprocessingCommentsPart commentsPart        = AddTemplatePart <WordprocessingCommentsPart>(this.document, CommentsStyleResource);
            EndnotesPart             endNotesPart          = AddTemplatePart <EndnotesPart>(this.document, EndNotesStyleResource);
            FontTablePart            fontTablePart         = AddTemplatePart <FontTablePart>(this.document, FontsTableStyleResource);
            FootnotesPart            footnotesPart         = AddTemplatePart <FootnotesPart>(this.document, FootNotesStyleResource);
            HeaderPart               headerPart            = AddTemplatePart <HeaderPart>(this.document, HeaderStyleResource);
            DocumentSettingsPart     settingsPart          = AddTemplatePart <DocumentSettingsPart>(this.document, SettingsStyleResource);
            StyleDefinitionsPart     styles                = AddTemplatePart <StyleDefinitionsPart>(this.document, StylesStyleResource);
            StylesWithEffectsPart    stylesWithEffectsPart = AddTemplatePart <StylesWithEffectsPart>(this.document, StylesWithEffectsStyleResource);
            WebSettingsPart          webSettingsPart       = AddTemplatePart <WebSettingsPart>(this.document, WebSettingsStyleResource);
            ThemePart                themePart             = AddTemplatePart <ThemePart>(this.document, ThemeStyleResource);
            NumberingDefinitionsPart numberingPart         = AddTemplatePart <NumberingDefinitionsPart>(this.document, NumberingStyleResource);

            // Initialize the comments manager with the comments part
            this.commentManager = new CommentManager(commentsPart.Comments);

            // Initialize the footer
            string     footerTitle      = this.implementationGuide.GetDisplayName();
            DateTime   footerDate       = this.implementationGuide.PublishDate != null ? this.implementationGuide.PublishDate.Value : DateTime.Now;
            string     footerDateString = footerDate.ToString("m");
            FooterPart newFooterPart    = this.document.MainDocumentPart.AddNewPart <FooterPart>();
            Footer     newFooter        = new Footer();
            Paragraph  pFooter          = new Paragraph(
                new ParagraphProperties(
                    new ParagraphStyleId()
            {
                Val = "Footer"
            }));

            pFooter.Append(
                new Run(
                    new Text(footerTitle)),
                new Run(
                    new TabChar(),
                    new Text(footerDateString)
            {
                Space = SpaceProcessingModeValues.Preserve
            }),
                new Run(
                    new TabChar(),
                    new Text("Page ")
            {
                Space = SpaceProcessingModeValues.Preserve
            }),
                new Run(
                    new FieldChar()
            {
                FieldCharType = FieldCharValues.Begin
            }),
                new Run(
                    new FieldCode(" PAGE ")
            {
                Space = SpaceProcessingModeValues.Preserve
            }),
                new Run(
                    new FieldChar()
            {
                FieldCharType = FieldCharValues.Separate
            }),
                new Run(
                    new RunProperties(
                        new NoProof()),
                    new Text("54")),
                new Run(
                    new FieldChar()
            {
                FieldCharType = FieldCharValues.End
            }));
            newFooter.Append(pFooter);
            newFooterPart.Footer = newFooter;

            // Add numbering for templates
            foreach (Template cTemplate in this.templates)
            {
                NumberingInstance ni = new NumberingInstance(
                    new AbstractNumId()
                {
                    Val = 3
                })
                {
                    NumberID = GenerationConstants.BASE_TEMPLATE_INDEX + (int)cTemplate.Id
                };

                for (int i = 0; i < 9; i++)
                {
                    ni.Append(new LevelOverride(
                                  new StartOverrideNumberingValue()
                    {
                        Val = 1
                    })
                    {
                        LevelIndex = i
                    });
                }

                numberingPart.Numbering.Append(ni);
            }
        }