Example #1
0
        public const int MAX_TRANSPOSED_COLUMNS    = 7; // The first is for the field-name.

        // -----------------------------------------------------------------------------------------
        public void CreateIdeaDetails(ReportStandardPagesMaker PagesMaker, double LocalNestingMargin,
                                      IEnumerable <ContainedDetail> Details)
        {
            var DetailIndex = 0;

            foreach (var Detail in Details)
            {
                /* var DetailPanel = new StackPanel();
                 *
                 * var DetailHeader = new Grid();
                 * DetailHeader.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.1, GridUnitType.Star) });
                 * DetailHeader.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.15, GridUnitType.Star) });
                 * DetailHeader.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.15, GridUnitType.Star) });
                 * DetailHeader.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.4, GridUnitType.Star) });
                 * DetailHeader.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(0.2, GridUnitType.Star) });
                 *
                 * var Expositor = CreateContentCardPropertyExpositor("Type", Detail.KindName,
                 *                                                 this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground,
                 *                                                 this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground);
                 * DetailHeader.Children.Add(Expositor);
                 *
                 * Expositor = CreateContentCardPropertyExpositor(FormalPresentationElement.__Name.Name, Detail.Designation.Name,
                 *                                             this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground,
                 *                                             this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground);
                 * Grid.SetColumn(Expositor, 1);
                 * DetailHeader.Children.Add(Expositor);
                 *
                 * Expositor = CreateContentCardPropertyExpositor(FormalPresentationElement.__TechName.Name, Detail.Designation.TechName,
                 *                                             this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground,
                 *                                             this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground);
                 * Grid.SetColumn(Expositor, 2);
                 * DetailHeader.Children.Add(Expositor);
                 *
                 * Expositor = CreateContentCardPropertyExpositor(FormalPresentationElement.__Summary.Name, Detail.Designation.Summary,
                 *                                             this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground,
                 *                                             this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground);
                 * Grid.SetColumn(Expositor, 3);
                 * DetailHeader.Children.Add(Expositor);
                 *
                 * Expositor = CreateContentCardPropertyExpositor("Definition", Detail.Designation.Definitor.Name,
                 *                                             this.Configuration.FmtCardFieldLabel, this.Configuration.FmtFieldLabelBackground,
                 *                                             this.Configuration.FmtCardFieldValue, this.Configuration.FmtFieldValueBackground);
                 * Grid.SetColumn(Expositor, 4);
                 * DetailHeader.Children.Add(Expositor);
                 *
                 * DetailPanel.Children.Add(DetailHeader);
                 * DetailPanel.Children.Add(CreateDetailBody(Detail));
                 *
                 * PagesMaker.AppendContent(DetailPanel, true); */

                if (DetailIndex > 0)
                {
                    var Filler = new Border();
                    Filler.Height = INTER_DETAILS_FILLING;
                    PagesMaker.AppendContent(Filler);
                }

                CreateDetailSubsection(PagesMaker, LocalNestingMargin, Detail);   // Detail is directly generated into pages-maker.
                DetailIndex++;
            }
        }
Example #2
0
        public void CreateCollectionOfIdeaCompanionLinks(ReportStandardPagesMaker PagesMaker,
                                                         IEnumerable <RoleBasedLink> Source, string GroupKey)
        {
            // Notice the order by self-info, later related-info
            Source = Source.OrderBy(tlk => tlk.OwnerRelationship.Name + "~" + tlk.AssociatedIdea.Name);

            // Create initial Header
            var ColumnHeaderDefs = new Dictionary <string, Capsule <string, double, Func <IMModelClass, object> > >();

            ColumnHeaderDefs.Add("Idea", Capsule.Create("Companion Idea", 0.5, (Func <IMModelClass, object>)null));

            ColumnHeaderDefs.Add("Relationship", Capsule.Create("In Relationship", 0.25, (Func <IMModelClass, object>)null));

            ColumnHeaderDefs.Add("RoleDesc", Capsule.Create("Link Desc.", 0.1, (Func <IMModelClass, object>)null));
            ColumnHeaderDefs.Add("RoleDef", Capsule.Create("Link Role", 0.075, (Func <IMModelClass, object>)null));
            ColumnHeaderDefs.Add("RoleVar", Capsule.Create("Link Var.", 0.075, (Func <IMModelClass, object>)null));

            var Header = CreateListHeader(PagesMaker, ColumnHeaderDefs,
                                          this.Configuration.FmtListFieldLabel,
                                          this.Configuration.FmtFieldLabelBackground);

            PagesMaker.PageBreakStartCreator = (() => CreateListHeader(PagesMaker, ColumnHeaderDefs,
                                                                       this.Configuration.FmtListFieldLabel,
                                                                       this.Configuration.FmtFieldLabelBackground,
                                                                       this.Configuration.FmtListLinesForeground).Item1);
            PagesMaker.AppendContent(Header.Item1, false, GroupKey);

            var ColumnValueDefs = Header.Item2;
            var VerticalAlign   = VerticalAlignment.Stretch;
            var HorizontalAlign = HorizontalAlignment.Stretch;

            // Travel Records...
            Source.ForEachIndexing((record, index) =>
            {
                int ColIndex            = 0;
                FrameworkElement Cell   = null;
                var RecordFrame         = new StackPanel(); // Grid is too expensive for each record
                RecordFrame.Orientation = Orientation.Horizontal;

                Cell = CreateListCell(record.AssociatedIdea.ToString(), ColumnValueDefs.ElementAt(ColIndex).Value.Value0, HorizontalAlign, VerticalAlign);
                RecordFrame.Children.Add(Cell);

                ColIndex++;
                Cell = CreateListCell(record.OwnerRelationship.ToString(),
                                      ColumnValueDefs.ElementAt(ColIndex).Value.Value0, HorizontalAlign, VerticalAlign);
                RecordFrame.Children.Add(Cell);

                ColIndex++;
                Cell = CreateListCell((record.Descriptor == null ? "" : record.Descriptor.ToString()),
                                      ColumnValueDefs.ElementAt(ColIndex).Value.Value0, HorizontalAlign, VerticalAlign);
                RecordFrame.Children.Add(Cell);

                ColIndex++;
                Cell = CreateListCell(record.RoleDefinitor.ToString(), ColumnValueDefs.ElementAt(ColIndex).Value.Value0, HorizontalAlign, VerticalAlign);
                RecordFrame.Children.Add(Cell);

                ColIndex++;
                Cell = CreateListCell(record.RoleVariant.ToString(), ColumnValueDefs.ElementAt(ColIndex).Value.Value0, HorizontalAlign, VerticalAlign);
                RecordFrame.Children.Add(Cell);

                PagesMaker.AppendContent(RecordFrame, false, (index > 0 ? null : GroupKey));
            });

            PagesMaker.PageBreakStartCreator = null;
        }
Example #3
0
        // -----------------------------------------------------------------------------------------
        public void CreateDetailContentTableConventional(ReportStandardPagesMaker PagesMaker, double LocalNestingMargin, string GroupKey,
                                                         Table Detail, TableAppearance Look)
        {
            var AvailableWidth = this.WorkingPageContentWidth - LocalNestingMargin;

            // Determine total column/field-def header rows and their widths needed per row.
            var MultiLineRows    = new List <List <Capsule <FieldDefinition, double> > >();
            var NewMultiLineCols = new List <Capsule <FieldDefinition, double> >();

            MultiLineRows.Add(NewMultiLineCols);
            var ConsumedWidth     = 0.0;
            var WidthAdjustFactor = 1.0;

            foreach (var FieldDef in Detail.Definition.FieldDefinitions)
            {
                var ColumnWidth = FieldDef.GetEstimatedColumnPixelsWidth(5);
                ConsumedWidth += ColumnWidth;

                if (ConsumedWidth > AvailableWidth)
                {
                    WidthAdjustFactor = AvailableWidth / (ConsumedWidth - ColumnWidth);
                    foreach (var RowCols in NewMultiLineCols)
                    {
                        RowCols.Value1 = RowCols.Value1 * WidthAdjustFactor;
                    }

                    NewMultiLineCols = new List <Capsule <FieldDefinition, double> >();
                    MultiLineRows.Add(NewMultiLineCols);
                    ConsumedWidth = ColumnWidth;
                }

                NewMultiLineCols.Add(Capsule.Create(FieldDef, ColumnWidth));
            }

            WidthAdjustFactor = AvailableWidth / ConsumedWidth;
            foreach (var RowCols in NewMultiLineCols)
            {
                RowCols.Value1 = RowCols.Value1 * WidthAdjustFactor;
            }

            // Create list-header panel creator (to be re-used on each page-break)
            Func <FrameworkElement> ListHeaderCreator =
                (() =>
            {
                var HeaderPanel = new StackPanel();

                foreach (var RowCols in MultiLineRows)
                {
                    var RowPanel = new StackPanel();
                    RowPanel.Orientation = Orientation.Horizontal;

                    foreach (var FieldColumn in RowCols)
                    {
                        var LabelCell = CreateListCell(FieldColumn.Value0.NameCaption, FieldColumn.Value1,
                                                       HorizontalAlignment.Left, VerticalAlignment.Stretch,
                                                       this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtListRowLinesForeground,
                                                       this.Configuration.FmtDetailFieldLabel, LINES_LISTROW_THICKNESS);

                        RowPanel.Children.Add(LabelCell);
                    }

                    HeaderPanel.Children.Add(RowPanel);
                }

                return(HeaderPanel);
            });

            PagesMaker.PageBreakStartCreator = ListHeaderCreator;

            // Start creating the main header
            var MainHeaderPanel = ListHeaderCreator();

            PagesMaker.AppendContent(MainHeaderPanel, false, GroupKey);

            // Generate list-rows
            foreach (var Record in Detail)
            {
                var RecordRowsPanel = new StackPanel();

                if (MultiLineRows.Count > 1)
                {
                    var LineSeparator = new Border {
                        Height = 0.5, Background = Brushes.DimGray
                    };
                    RecordRowsPanel.Children.Add(LineSeparator);
                }

                foreach (var RowCols in MultiLineRows)
                {
                    var RowPanel = new StackPanel();
                    RowPanel.Orientation = Orientation.Horizontal;

                    foreach (var FieldColumn in RowCols)
                    {
                        var Alignment = (FieldColumn.Value0.FieldType is BasicDataType
                                         ? ((BasicDataType)FieldColumn.Value0.FieldType).DisplayAlignment
                                         : TextAlignment.Left).ToHorizontalAlignment();

                        var Value = (FieldColumn.Value0.FieldType.IsEqual(DataType.DataTypePicture)
                                     ? (object)(Record.GetStoredValue(FieldColumn.Value0) as ImageAssignment).Get(ias => ias.Image)
                                     : Record.GetStoredValueForDisplay(FieldColumn.Value0));

                        var ValueCell = CreateListCell(Value, FieldColumn.Value1,
                                                       Alignment, VerticalAlignment.Stretch,
                                                       this.Configuration.FmtFieldValueBackground, this.Configuration.FmtListRowLinesForeground,
                                                       this.Configuration.FmtDetailFieldLabel, LINES_LISTROW_THICKNESS);

                        RowPanel.Children.Add(ValueCell);
                    }

                    RecordRowsPanel.Children.Add(RowPanel);
                }

                PagesMaker.AppendContent(RecordRowsPanel, false, GroupKey);

                /*? Separation by little filler
                 * if (MultiLineRows.Count > 1)
                 * {
                 *  var Filler = new Border();
                 *  Filler.Height = INTER_SEGMENTS_FILLING / 4.0;
                 *  PagesMaker.AppendContent(Filler);
                 * } */
            }

            // Reset page-break header creator
            PagesMaker.PageBreakStartCreator = null;
        }
Example #4
0
        // -----------------------------------------------------------------------------------------
        public void CreateDetailContentTableTransposed(ReportStandardPagesMaker PagesMaker, double LocalNestingMargin, string GroupKey,
                                                       Table Detail, TableAppearance Look)
        {
            var MaxColumns    = Math.Min(Detail.Count + 1, MAX_TRANSPOSED_COLUMNS);
            var SegmentsCount = (int)Math.Ceiling((double)Detail.Count / (double)(MaxColumns - 1));
            var SegmentKey    = GroupKey;
            var FieldIndex    = 0;
            var SegmentIndex  = 0;
            var ColumnIndex   = 0;
            var RecordIndex   = 0;
            var RecordStart   = 0;
            var ColumnWidth   = ((this.WorkingPageContentWidth - LocalNestingMargin) / (double)MaxColumns);

            while (SegmentIndex < SegmentsCount)
            {
                if (SegmentIndex > 0)
                {
                    var Filler = new Border();
                    Filler.Height = INTER_SEGMENTS_FILLING;
                    PagesMaker.AppendContent(Filler);
                }

                while (FieldIndex < Detail.Definition.FieldDefinitions.Count)
                {
                    var RowPanel = new StackPanel();
                    RowPanel.Orientation = Orientation.Horizontal;

                    var FieldDef  = Detail.Definition.FieldDefinitions[FieldIndex];
                    var LabelCell = CreateListCell(FieldDef.NameCaption, ColumnWidth,
                                                   HorizontalAlignment.Left, VerticalAlignment.Stretch,
                                                   this.Configuration.FmtFieldLabelBackground, this.Configuration.FmtListRowLinesForeground,
                                                   this.Configuration.FmtDetailFieldLabel, LINES_LISTROW_THICKNESS);
                    RowPanel.Children.Add(LabelCell);

                    RecordIndex = RecordStart;

                    var ColumnsLimit = Math.Min(Detail.Count, MaxColumns - 1);
                    while (ColumnIndex < ColumnsLimit && RecordIndex < Detail.Count)
                    {
                        var Value = (FieldDef.FieldType.IsEqual(DataType.DataTypePicture)
                                     ? (object)(Detail[RecordIndex].GetStoredValue(FieldDef) as ImageAssignment).Get(ias => ias.Image)
                                     : Detail[RecordIndex].GetStoredValueForDisplay(FieldDef));

                        // NOTE: As when drawing transposed records on symbols, it is better to let the values as left-aligned.
                        var ValueCell = CreateListCell(Value, ColumnWidth,
                                                       HorizontalAlignment.Left, VerticalAlignment.Stretch,
                                                       this.Configuration.FmtFieldValueBackground, this.Configuration.FmtListRowLinesForeground,
                                                       this.Configuration.FmtDetailFieldLabel, LINES_LISTROW_THICKNESS);
                        RowPanel.Children.Add(ValueCell);

                        RecordIndex++;
                        ColumnIndex++;
                    }

                    PagesMaker.AppendContent(RowPanel, false, SegmentKey);
                    SegmentKey = GroupKey + "_" + SegmentIndex.ToString();

                    ColumnIndex = 0;
                    FieldIndex++;
                }

                RecordStart += (MaxColumns - 1);
                FieldIndex   = 0;
                SegmentIndex++;
            }
        }
        // -----------------------------------------------------------------------------------------
        public void CreateListOfMarkers(ReportStandardPagesMaker PagesMaker, string GroupKey, IEnumerable <MarkerAssignment> Source)
        {
            // Create initial Header
            var ColumnHeaderDefs = new Dictionary <string, Capsule <string, double, Func <IMModelClass, object> > >();

            if (this.Configuration.CompositeIdea_Markers_List.Definitor)
            {
                ColumnHeaderDefs.Add(MarkerAssignment.__Definitor.TechName, Capsule.Create(MarkerAssignment.__Definitor.Name, 0.25, (Func <IMModelClass, object>)null));
            }

            if (this.Configuration.CompositeIdea_Markers_List.PropPictogram)
            {
                ColumnHeaderDefs.Add(SimplePresentationElement.__Pictogram.TechName, Capsule.Create("Pict.", 0.05, (Func <IMModelClass, object>)null));
            }

            if (this.Configuration.CompositeIdea_Markers_List.PropName)
            {
                ColumnHeaderDefs.Add(SimplePresentationElement.__Name.TechName, Capsule.Create(SimplePresentationElement.__Name.Name, 0.2, (Func <IMModelClass, object>)null));
            }

            if (this.Configuration.CompositeIdea_Markers_List.PropTechName)
            {
                ColumnHeaderDefs.Add(SimplePresentationElement.__TechName.TechName, Capsule.Create(SimplePresentationElement.__TechName.Name, 0.2, (Func <IMModelClass, object>)null));
            }

            if (this.Configuration.CompositeIdea_Markers_List.PropSummary)
            {
                ColumnHeaderDefs.Add(SimplePresentationElement.__Summary.TechName, Capsule.Create(SimplePresentationElement.__Summary.Name, 0.3, (Func <IMModelClass, object>)null));
            }

            var Header = CreateListHeader(PagesMaker, ColumnHeaderDefs,
                                          this.Configuration.FmtListFieldLabel,
                                          this.Configuration.FmtFieldLabelBackground);

            PagesMaker.PageBreakStartCreator = (() => CreateListHeader(PagesMaker, ColumnHeaderDefs,
                                                                       this.Configuration.FmtListFieldLabel,
                                                                       this.Configuration.FmtFieldLabelBackground,
                                                                       this.Configuration.FmtListLinesForeground).Item1);
            PagesMaker.AppendContent(Header.Item1, false, GroupKey);

            var ColumnValueDefs = Header.Item2;
            var VerticalAlign   = VerticalAlignment.Stretch;
            var HorizontalAlign = HorizontalAlignment.Stretch;

            // Travel Records...
            Source.ForEachIndexing((record, index) =>
            {
                int ColIndex            = 0;
                FrameworkElement Cell   = null;
                var RecordFrame         = new StackPanel(); // Grid is too expensive for each record
                RecordFrame.Orientation = Orientation.Horizontal;

                if (this.Configuration.CompositeIdea_Markers_List.Definitor)
                {
                    Cell = CreateListCell(record.Definitor.Name, ColumnValueDefs.ElementAt(ColIndex).Value.Value0, HorizontalAlign, VerticalAlign);
                    RecordFrame.Children.Add(Cell);
                }

                if (this.Configuration.CompositeIdea_Markers_List.PropPictogram)
                {
                    ColIndex++;
                    Cell = CreateListCell(record.Descriptor != null && record.Descriptor.Pictogram != null
                                          ? record.Descriptor.Pictogram : record.Definitor.Pictogram,
                                          ColumnValueDefs.ElementAt(ColIndex).Value.Value0, HorizontalAlign, VerticalAlign);
                    RecordFrame.Children.Add(Cell);
                }

                if (this.Configuration.CompositeIdea_Markers_List.PropName)
                {
                    ColIndex++;
                    Cell = CreateListCell(record.Descriptor == null ? "" : record.Descriptor.Name.RemoveNewLines(), ColumnValueDefs.ElementAt(ColIndex).Value.Value0, HorizontalAlign, VerticalAlign);
                    RecordFrame.Children.Add(Cell);
                }

                if (this.Configuration.CompositeIdea_Markers_List.PropTechName)
                {
                    ColIndex++;
                    Cell = CreateListCell(record.Descriptor == null ? "" : record.Descriptor.TechName, ColumnValueDefs.ElementAt(ColIndex).Value.Value0, HorizontalAlign, VerticalAlign);
                    RecordFrame.Children.Add(Cell);
                }

                if (this.Configuration.CompositeIdea_Markers_List.PropSummary)
                {
                    ColIndex++;
                    Cell = CreateListCell(record.Descriptor == null ? "" : record.Descriptor.Summary, ColumnValueDefs.ElementAt(ColIndex).Value.Value0, HorizontalAlign, VerticalAlign);
                    RecordFrame.Children.Add(Cell);
                }

                PagesMaker.AppendContent(RecordFrame, false, (index > 0 ? null : GroupKey));
            });

            PagesMaker.PageBreakStartCreator = null;
        }
Example #6
0
        /// <summary>
        /// Generates a Report based on the current Configuration.
        /// Returns operation-result.
        /// </summary>
        // IMPORTANT: See this page about the VisualsToXpsDocument class:
        // http://msdn.microsoft.com/en-us/library/system.windows.xps.visualstoxpsdocument.aspx
        public OperationResult <int> Generate(ThreadWorker <int> Worker)
        {
            General.ContractRequiresNotNull(Worker);

            try
            {
                this.Configuration = this.OriginalConfiguration.GenerateDeepClone();    // Cloned to allow inter-thread use.

                var Result = new FixedDocument();
                IsAtGenerationStart = true;

                this.CurrentWorker = Worker;
                this.CurrentWorker.ReportProgress(0, "Starting.");

                // IMPORTANT: This page must be created to determine initial dimensions,
                //            even when the user selected to exclude it from the document.
                var TitlePage = this.CreateTitlePage(this.Configuration.DocSection_TitlePage);

                if (this.Configuration.DocSection_TitlePage)
                {
                    Result.Pages.Add(this.CreatePageContainer(TitlePage));
                }

                this.CurrentWorker.ReportProgress(1, "Generating Composition content.");

                // IMPORTANT: This ReportPagesMaker creation must be after the first page to get the page's dimensions.
                var PagesMaker = new ReportStandardPagesMaker(this);

                /* PENDING
                 * if (this.Configuration.DocSection_TableOfContents)
                 *  this.CreateTableOfContents().ForEach(page => Result.Pages.Add(this.CreatePageContainer(page))); */

                if (this.Configuration.DocSection_Composition)
                {
                    this.CreateCompositeContent(PagesMaker, this.SourceComposition, 0.0, 1.0, 90.0);
                }

                this.CurrentWorker.ReportProgress(90, "Generating Domain content.");
                if (this.Configuration.DocSection_Domain)
                {
                    this.CreateDomainContent(PagesMaker, this.SourceComposition.CompositeContentDomain);
                }

                this.CurrentWorker.ReportProgress(93, "Paginating.");
                var Pages = PagesMaker.GetPages();

                foreach (var Page in Pages)
                {
                    Result.Pages.Add(this.CreatePageContainer(Page));
                }

                this.CurrentWorker.ReportProgress(97, "Saving to temporal XPS document.");
                var FileName = General.GenerateRandomFileName(this.SourceComposition.TechName + "_TMP", "xps");
                this.GeneratedDocumentTempFilePath = Path.Combine(AppExec.ApplicationUserTemporalDirectory, FileName);

                Display.SaveDocumentAsXPS(Result, this.GeneratedDocumentTempFilePath);

                this.CurrentWorker.ReportProgress(100, "Generation complete.");
                this.CurrentWorker = null;
            }
            catch (Exception Problem)
            {
                this.CurrentWorker = null;
                return(OperationResult.Failure <int>("Cannot execute generation.\nProblem: " + Problem.Message));
            }

            return(OperationResult.Success <int>(0, "Generation complete."));
        }
        // -----------------------------------------------------------------------------------------
        public void CreateCompositeContent(ReportStandardPagesMaker PagesMaker, Idea Source, double LocalNestingMargin,
                                           double ProgressPercentageStart, double ProgressPercentageEnd)
        {
            this.CurrentWorker.ReportProgress((int)ProgressPercentageStart, "Generating " + Source.ToStringAlways());

            PagesMaker.NestingMargin = LocalNestingMargin;

            var IdeaGroupKeySuffix = Source.GlobalId.ToString();

            var Text = CreateText(Source.Definitor.NameCaption /* Source.SelfKind.Name */ + ": " +
                                  Source.NameCaption, this.Configuration.FmtSubjectTitle);

            PagesMaker.AppendContent(Text, true, "Idea" + IdeaGroupKeySuffix);

            // Main Info
            var Card = (Source is Composition ? this.Configuration.Composition_Card
                                              : (Source is Concept ? this.Configuration.CompositeIdea_Concepts_Card
                                                                   : this.Configuration.CompositeIdea_Relationships_Card));

            if (Card.Show)
            {
                var CompositionCardSections = this.CreateContentCard(Source, Card);

                CompositionCardSections.ForEachIndexing(
                    (section, index) => PagesMaker.AppendContent(
                        section, false, (index > 0 ? null : "Idea" + IdeaGroupKeySuffix)));
            }

            // View
            if (this.Configuration.CompositeIdea_View_Diagram &&
                Source.CompositeActiveView != null)
            {
                var ViewSnapshot = this.CurrentWorker.AtOriginalThreadInvoke(
                    () =>
                {
                    var Snapshot = Source.CompositeActiveView.ToSnapshot();
                    if (Snapshot == null || Snapshot.Item1 == null)
                    {
                        return(null);
                    }

                    Snapshot.Item1.Freeze();
                    return(Snapshot.Item1);
                });

                if (ViewSnapshot != null)
                {
                    Text = CreateText(View.__ClassDefinitor.Name + ": " + Source.CompositeActiveView, this.Configuration.FmtSectionTitle);
                    PagesMaker.AppendContent(Text, true, "View" + IdeaGroupKeySuffix);

                    var ViewImage   = ViewSnapshot.ToDrawingImage();
                    var ViewContent = this.CreateContentView(ViewImage, this.WorkingPageContentWidth, this.WorkingPageContentHeight * 0.95);

                    PagesMaker.AppendContent(ViewContent, false, "View" + IdeaGroupKeySuffix, true);
                }
            }

            // Details...
            var Details = Source.Details.Where(det => !(det is InternalLink)).OrderBy(det => det.Designation.Name);

            if (this.Configuration.CompositeIdea_Details && Details.Any())
            {
                Text = CreateText("Details", this.Configuration.FmtSectionTitle);
                PagesMaker.AppendContent(Text, true, "Details" + IdeaGroupKeySuffix);
                this.CreateIdeaDetails(PagesMaker, LocalNestingMargin, Details);
            }

            // Markers...
            if (this.Configuration.CompositeIdea_Markers_List.Show && Source.Markings.Count > 0)
            {
                Text = CreateText("Markers", this.Configuration.FmtSectionTitle);
                PagesMaker.AppendContent(Text, true, "Markers" + IdeaGroupKeySuffix);
                this.CreateListOfMarkers(PagesMaker, "Markers" + IdeaGroupKeySuffix,
                                         Source.Markings.OrderBy(reg => (reg.Descriptor == null ? "~" : reg.Descriptor.Name)));
            }

            // Related from...
            if (this.Configuration.CompositeIdea_RelatedFrom_Collection)
            {
                var OriginCounterpartLinks = Source.AssociatingLinks.Where(lnk => lnk.RoleDefinitor.RoleType == ERoleType.Target)
                                             .SelectMany(lnk => lnk.OwnerRelationship.Links.Where(rlk => rlk.RoleDefinitor.RoleType == ERoleType.Origin)
                                                         .Select(rlk => Tuple.Create(lnk, rlk)));

                var TargetCompanionLinks = Source.AssociatingLinks.Where(lnk => lnk.RoleDefinitor.RoleType == ERoleType.Target)
                                           .SelectMany(lnk => lnk.OwnerRelationship.Links.Where(rlk => rlk.RoleDefinitor.RoleType == ERoleType.Target &&
                                                                                                !rlk.AssociatedIdea.IsEqual(Source)));

                if (OriginCounterpartLinks.Any() || TargetCompanionLinks.Any())
                {
                    Text = CreateText("Related From...", this.Configuration.FmtSectionTitle);
                    PagesMaker.AppendContent(Text, true, "RelatedFrom" + IdeaGroupKeySuffix);
                }

                if (OriginCounterpartLinks.Any())
                {
                    this.CreateCollectionOfIdeaCounterpartLinks(PagesMaker, ERoleType.Origin.GetFieldName(), ERoleType.Target.GetFieldName(),
                                                                OriginCounterpartLinks, "RelatedFrom" + IdeaGroupKeySuffix);
                }

                if (this.Configuration.CompositeIdea_IncludeTargetCompanions && TargetCompanionLinks.Any())
                {
                    this.CreateCollectionOfIdeaCompanionLinks(PagesMaker, TargetCompanionLinks, "TargetCompanions" + IdeaGroupKeySuffix);
                }
            }

            // Related to...
            if (this.Configuration.CompositeIdea_RelatedTo_Collection)
            {
                var TargetCounterpartLinks = Source.AssociatingLinks.Where(lnk => lnk.RoleDefinitor.RoleType == ERoleType.Origin)
                                             .SelectMany(lnk => lnk.OwnerRelationship.Links.Where(rlk => rlk.RoleDefinitor.RoleType == ERoleType.Target)
                                                         .Select(rlk => Tuple.Create(lnk, rlk)));

                var OriginCompanionLinks = Source.AssociatingLinks.Where(lnk => lnk.RoleDefinitor.RoleType == ERoleType.Origin)
                                           .SelectMany(lnk => lnk.OwnerRelationship.Links.Where(rlk => rlk.RoleDefinitor.RoleType == ERoleType.Origin &&
                                                                                                !rlk.AssociatedIdea.IsEqual(Source)));

                if (TargetCounterpartLinks.Any() || OriginCompanionLinks.Any())
                {
                    Text = CreateText("Related To...", this.Configuration.FmtSectionTitle);
                    PagesMaker.AppendContent(Text, true, "RelatedTo" + IdeaGroupKeySuffix);
                }

                if (TargetCounterpartLinks.Any())
                {
                    this.CreateCollectionOfIdeaCounterpartLinks(PagesMaker, ERoleType.Target.GetFieldName(), ERoleType.Origin.GetFieldName(),
                                                                TargetCounterpartLinks, "RelatedTo" + IdeaGroupKeySuffix);
                }

                if (this.Configuration.CompositeIdea_IncludeOriginCompanions && OriginCompanionLinks.Any())
                {
                    this.CreateCollectionOfIdeaCompanionLinks(PagesMaker, OriginCompanionLinks, "OriginCompanions" + IdeaGroupKeySuffix);
                }
            }

            // Grouped Ideas...
            if (this.Configuration.CompositeIdea_GroupedIdeas_List.Show)
            {
                var GroupedIdeas = Source.VisualRepresentators
                                   .SelectMany(vrep => vrep.MainSymbol.GetGroupedSymbols()
                                               .Select(rep => rep.OwnerRepresentation.RepresentedIdea))
                                   .Distinct().OrderBy(idea => idea.Name);

                if (GroupedIdeas.Any())
                {
                    Text = CreateText("Grouped Ideas", this.Configuration.FmtSectionTitle);
                    PagesMaker.AppendContent(Text, true, "GroupedIdeas" + IdeaGroupKeySuffix);
                    this.CreateContentList(PagesMaker, "GroupedIdeas" + IdeaGroupKeySuffix, GroupedIdeas,
                                           this.Configuration.CompositeIdea_GroupedIdeas_List,
                                           "Definition", "Definition");
                }
            }

            // Complements collection...
            if (this.Configuration.CompositeIdea_Complements)
            {
                // Consider symbol's appended floaters: call-outs and quotes
                var Complements = Source.VisualRepresentators
                                  .SelectMany(vrep => vrep.MainSymbol.AttachedComplements.Where(atc => atc.IsAttachedFloater));

                // Consider composite view's free complements (notes, texts, stamps)
                if (Source.CompositeViews.Count > 0)
                {
                    Complements = Complements.Concat(Source.CompositeViews
                                                     .SelectMany(cvw => cvw.GetFreeComplements().Where(frc =>
                                                                                                       frc.IsComplementNote || frc.IsComplementStamp || frc.IsComplementText)));
                }

                if (Complements.Any())
                {
                    Text = CreateText("Complements", this.Configuration.FmtSectionTitle);
                    PagesMaker.AppendContent(Text, true, "IdeaComplements" + IdeaGroupKeySuffix);
                    this.CreateCollectionOfComplements(PagesMaker, "IdeaComplements" + IdeaGroupKeySuffix, Complements);
                }
            }

            // Relationship Links (only when this Idea is a Relationship)
            var SourceRelationship = Source as Relationship;

            if (SourceRelationship != null && SourceRelationship.Links.Count > 0 &&
                this.Configuration.CompositeRelationship_Links_Collection)
            {
                Text = CreateText("Links", this.Configuration.FmtSectionTitle);
                PagesMaker.AppendContent(Text, true, "RelLinks" + IdeaGroupKeySuffix);
                this.CreateCollectionOfRelationshipLinks(PagesMaker, SourceRelationship.Links, "RelLinks" + IdeaGroupKeySuffix);
            }

            // Composing Concepts List
            var Concepts = Source.CompositeConcepts.OrderBy(idea => idea.Name).ToList();

            if (this.Configuration.CompositeIdea_Concepts_List.Show && Concepts.Any())
            {
                Text = CreateText("List of composing Concepts", this.Configuration.FmtSectionTitle);
                PagesMaker.AppendContent(Text, true, "Concepts" + IdeaGroupKeySuffix);
                this.CreateContentList(PagesMaker, "Concepts" + IdeaGroupKeySuffix, Concepts,
                                       this.Configuration.CompositeIdea_Concepts_List,
                                       Concept.__ConceptDefinitor.TechName,
                                       Concept.__ConceptDefinitor.Name);
            }

            // Composing Relationships List
            var Relationships = Source.CompositeRelationships.OrderBy(idea => idea.Name).ToList();

            if (this.Configuration.CompositeIdea_Relationships_List.Show && Relationships.Any())
            {
                Text = CreateText("List of composing Relationships", this.Configuration.FmtSectionTitle);
                PagesMaker.AppendContent(Text, true, "Relationships" + IdeaGroupKeySuffix);
                this.CreateContentList(PagesMaker, "Relationships" + IdeaGroupKeySuffix, Relationships,
                                       this.Configuration.CompositeIdea_Relationships_List,
                                       Relationship.__RelationshipDefinitor.TechName,
                                       Relationship.__RelationshipDefinitor.Name);
            }

            // Determine progress
            var ProgressStep = ((ProgressPercentageEnd - ProgressPercentageStart) /
                                (double)(Concepts.Count + Relationships.Count));
            var ProgressPercentage = ProgressPercentageStart;

            // Composing Concepts Contents
            if (this.Configuration.CompositeIdea_Concepts_ReportCompositeContent && Concepts.Any())
            {
                Text = CreateText("Content of the composing Concepts", this.Configuration.FmtSectionTitle);
                PagesMaker.AppendContent(Text, true);
                foreach (var Composite in Concepts)
                {
                    ProgressPercentage += ProgressStep;
                    CreateCompositeContent(PagesMaker, Composite,
                                           (LocalNestingMargin + COMPOSITE_NESTING_MARGIN).EnforceMaximum(COMPOSITE_NESTING_MARGIN * MAX_NESTED_LEVELS),
                                           ProgressPercentage, (ProgressPercentage + ProgressStep));
                }
            }

            PagesMaker.NestingMargin = LocalNestingMargin;   // Reset to current-level nesting

            // Composing Relationships Contents
            if (this.Configuration.CompositeIdea_Relationships_ReportCompositeContent && Relationships.Any())
            {
                Text = CreateText("Content of the composing Relationships", this.Configuration.FmtSectionTitle);
                PagesMaker.AppendContent(Text, true);
                {
                    ProgressPercentage += ProgressStep;
                    foreach (var Composite in Relationships)
                    {
                        CreateCompositeContent(PagesMaker, Composite,
                                               (LocalNestingMargin + COMPOSITE_NESTING_MARGIN).EnforceMaximum(COMPOSITE_NESTING_MARGIN * MAX_NESTED_LEVELS),
                                               ProgressPercentage, (ProgressPercentage + ProgressStep));
                    }
                }
            }

            PagesMaker.NestingMargin = LocalNestingMargin;   // Reset to current-level nesting
        }