Subversion Repositories DevTools

Rev

Rev 2132 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2132 Rev 2136
Line 1... Line 1...
1
using System;
1
using System;
2
using System.Collections;
2
using System.Collections;
3
using System.Text;
3
using System.Text;
4
using System.ComponentModel;
4
using System.ComponentModel;
5
using System.Windows.Forms;
5
using System.Windows.Forms;
-
 
6
using Microsoft.Office.Interop.Word;
6
 
7
 
7
namespace EA_DocGen
8
namespace EA_DocGen
8
{
9
{
9
	/// <summary>
10
	/// <summary>
10
	/// Summary description for EA_RelationshipMatrix.
11
	/// Summary description for EA_RelationshipMatrix.
Line 405... Line 406...
405
      /// </summary>
406
      /// </summary>
406
      /// <param name="EA_RelMatrix"></param>
407
      /// <param name="EA_RelMatrix"></param>
407
      private static void processRelationshipMatrixElementStyle1()
408
      private static void processRelationshipMatrixElementStyle1()
408
      {
409
      {
409
         int tableNum = 0;
410
         int tableNum = 0;
410
         Word.Table table = null;
411
         Table table = null;
411
 
412
 
412
         // Scan the fromPackage to find all the "from elements".
413
         // Scan the fromPackage to find all the "from elements".
413
         Main.WriteOutput("   Finding elements in fromPackage", -1);
414
         Main.WriteOutput("   Finding elements in fromPackage", -1);
414
         ElementAccumulator fromLister = new ElementAccumulator(RM_Matrix.from.elementTypes);
415
         ElementAccumulator fromLister = new ElementAccumulator(RM_Matrix.from.elementTypes);
415
         EA_Utilities.findAndProcessPackageElements( fromPackage, fromLister, RM_Matrix.from.packageRecursion );
416
         EA_Utilities.findAndProcessPackageElements( fromPackage, fromLister, RM_Matrix.from.packageRecursion );
Line 548... Line 549...
548
 
549
 
549
            Main.WriteOutput("   Creating from-to table", -1);
550
            Main.WriteOutput("   Creating from-to table", -1);
550
 
551
 
551
            if (RM_Matrix.fromToTable.introText != null && RM_Matrix.fromToTable.introText.Length > 0)
552
            if (RM_Matrix.fromToTable.introText != null && RM_Matrix.fromToTable.introText.Length > 0)
552
            {
553
            {
553
               Word.Range wr = TextualContent.appendAndSelectText( RM_Matrix.fromToTable.introText, EA_Constants.styleName_Body1 );
554
               Range wr = TextualContent.appendAndSelectText( RM_Matrix.fromToTable.introText, EA_Constants.styleName_Body1 );
554
               object obj = string.Format("EA_DocGen Informational Comment - This table has been produced using the following options:\n\n{0}", RM_Element.Notes);
555
               object obj = string.Format("EA_DocGen Informational Comment - This table has been produced using the following options:\n\n{0}", RM_Element.Notes);
555
               createWordDoc.WordDocument.Comments.Add(wr, ref obj);
556
               createWordDoc.WordDocument.Comments.Add(wr, ref obj);
556
            }
557
            }
557
 
558
 
558
            // create the from-to table in the word doc
559
            // create the from-to table in the word doc
Line 634... Line 635...
634
            // Now begin to add the to-from table to the word document
635
            // Now begin to add the to-from table to the word document
635
            Main.WriteOutput("   Creating to-from table", -1);
636
            Main.WriteOutput("   Creating to-from table", -1);
636
 
637
 
637
            if (RM_Matrix.toFromTable.introText != null && RM_Matrix.toFromTable.introText.Length > 0)
638
            if (RM_Matrix.toFromTable.introText != null && RM_Matrix.toFromTable.introText.Length > 0)
638
            {
639
            {
639
               Word.Range wr = TextualContent.appendAndSelectText( RM_Matrix.toFromTable.introText, EA_Constants.styleName_Body1 );
640
               Range wr = TextualContent.appendAndSelectText( RM_Matrix.toFromTable.introText, EA_Constants.styleName_Body1 );
640
 
641
 
641
               // add options comment only if user did not generate a from-to table, since there is no point in repeating
642
               // add options comment only if user did not generate a from-to table, since there is no point in repeating
642
               // the options comment which applies to both from-to and to-from table pair.
643
               // the options comment which applies to both from-to and to-from table pair.
643
               if (!needFromToTable)
644
               if (!needFromToTable)
644
               {
645
               {
Line 657... Line 658...
657
            fillInTable(fromToDictionary, table, DictionaryValueType.DVT_STRING);
658
            fillInTable(fromToDictionary, table, DictionaryValueType.DVT_STRING);
658
         }
659
         }
659
      }
660
      }
660
 
661
 
661
 
662
 
662
      private static void fillInTable(ArrayList fromToDictionary, Word.Table table, DictionaryValueType valueType )
663
        private static void fillInTable(ArrayList fromToDictionary, Table table, DictionaryValueType valueType)
663
      {
664
      {
664
         int lastFromElementId = -1;
665
         int lastFromElementId = -1;
665
         bool firstCellContent = true;
666
         bool firstCellContent = true;
666
         int row = 1;
667
         int row = 1;
667
         foreach (DictionaryEntry de in fromToDictionary)
668
         foreach (DictionaryEntry de in fromToDictionary)
Line 683... Line 684...
683
                     table.Cell(row,1).Range.Text += ((EA.Element)de.Key).Notes;
684
                     table.Cell(row,1).Range.Text += ((EA.Element)de.Key).Notes;
684
                  }
685
                  }
685
                  // Because we are including both the short description and the notes of the requirement
686
                  // Because we are including both the short description and the notes of the requirement
686
                  // in the cell, we need to discriminate them. We do this by bolding the short description,
687
                  // in the cell, we need to discriminate them. We do this by bolding the short description,
687
                  // and reducing the font size of the notes to 8.
688
                  // and reducing the font size of the notes to 8.
688
                  Word.Range wr = table.Cell(row,1).Range;
689
                  Range wr = table.Cell(row,1).Range;
689
                  wr.Sentences[1].Font.Bold = 1;
690
                  wr.Sentences[1].Font.Bold = 1;
690
                  for(int i=2; i<=wr.Sentences.Count; i++)
691
                  for(int i=2; i<=wr.Sentences.Count; i++)
691
                     wr.Sentences[i].Font.Size = 8;
692
                     wr.Sentences[i].Font.Size = 8;
692
               }
693
               }
693
            }
694
            }
Line 719... Line 720...
719
            else
720
            else
720
            {
721
            {
721
               if (EA_DocGenOptions.optionValue(EA_DocGenOptions.boolean_options_e.SUPPRESS_UN_ALLOCATED_RELATIONSHIP_WARNINGS) == false)
722
               if (EA_DocGenOptions.optionValue(EA_DocGenOptions.boolean_options_e.SUPPRESS_UN_ALLOCATED_RELATIONSHIP_WARNINGS) == false)
722
               {
723
               {
723
                  table.Cell(row,2).Range.Text = "Un-allocated relationship!";
724
                  table.Cell(row,2).Range.Text = "Un-allocated relationship!";
724
                  table.Cell(row,2).Range.Font.Color = Word.WdColor.wdColorRed;
725
                  table.Cell(row,2).Range.Font.Color = WdColor.wdColorRed;
725
               }
726
               }
726
            }
727
            }
727
         }
728
         }
728
      }
729
      }
729
 
730
 
Line 741... Line 742...
741
      /// <param name="EA_RelMatrix"></param>
742
      /// <param name="EA_RelMatrix"></param>
742
      private static void processRelationshipMatrixElementStyle2()
743
      private static void processRelationshipMatrixElementStyle2()
743
      {
744
      {
744
         int i;
745
         int i;
745
         int tableNum = 0;
746
         int tableNum = 0;
746
         Word.Table table = null;
747
         Table table = null;
747
 
748
 
748
         // Scan the fromPackage to find all the "from elements".
749
         // Scan the fromPackage to find all the "from elements".
749
         Main.WriteOutput("   Finding elements in fromPackage", -1);
750
         Main.WriteOutput("   Finding elements in fromPackage", -1);
750
 
751
 
751
         ElementAccumulator fromLister = new ElementAccumulator(RM_Matrix.from.elementTypes);
752
         ElementAccumulator fromLister = new ElementAccumulator(RM_Matrix.from.elementTypes);
Line 812... Line 813...
812
         
813
         
813
         Main.WriteOutput("   Creating from-to table", -1);
814
         Main.WriteOutput("   Creating from-to table", -1);
814
 
815
 
815
         if (RM_Matrix.fromToTable.introText != null && RM_Matrix.fromToTable.introText.Length > 0)
816
         if (RM_Matrix.fromToTable.introText != null && RM_Matrix.fromToTable.introText.Length > 0)
816
         {
817
         {
817
            Word.Range wr = TextualContent.appendAndSelectText( RM_Matrix.fromToTable.introText, EA_Constants.styleName_Body1 );
818
            Range wr = TextualContent.appendAndSelectText( RM_Matrix.fromToTable.introText, EA_Constants.styleName_Body1 );
818
            object obj = string.Format("EA_DocGen Informational Comment - This table has been produced using the following options:\n\n{0}", RM_Element.Notes);
819
            object obj = string.Format("EA_DocGen Informational Comment - This table has been produced using the following options:\n\n{0}", RM_Element.Notes);
819
            createWordDoc.WordDocument.Comments.Add(wr, ref obj);
820
            createWordDoc.WordDocument.Comments.Add(wr, ref obj);
820
         }
821
         }
821
 
822
 
822
         // create the from-to table in the word doc
823
         // create the from-to table in the word doc