Exemplo n.º 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initialize a new note.
        /// </summary>
        /// <param name="guidAnnotationType">GUID representing the type of annotation.</param>
        /// <param name="startRef">beginning reference note refers to</param>
        /// <param name="endRef">ending reference note refers to</param>
        /// <param name="beginObj">beginning object note refers to</param>
        /// <param name="endObj">ending object note refers to</param>
        /// <param name="startOffset">The starting character offset.</param>
        /// <param name="endOffset">The ending character offset.</param>
        /// <param name="bldrQuote">Para builder to use to build the Quote paragraph</param>
        /// <param name="bldrDiscussion">Para builder to use to build the Discussion
        /// paragraph</param>
        /// <param name="bldrRecommendation">Para builder to use to build the
        /// Recommendation paragraph</param>
        /// <param name="bldrResolution">Para builder to use to build the Resolution
        /// paragraph</param>
        /// ------------------------------------------------------------------------------------
        public void InitializeNote(Guid guidAnnotationType, BCVRef startRef, BCVRef endRef,
                                   ICmObject beginObj, ICmObject endObj, int startOffset, int endOffset,
                                   StTxtParaBldr bldrQuote, StTxtParaBldr bldrDiscussion, StTxtParaBldr bldrRecommendation,
                                   StTxtParaBldr bldrResolution)
        {
            AnnotationTypeRA = Services.GetInstance <ICmAnnotationDefnRepository>().GetObject(guidAnnotationType);
            BeginObjectRA    = beginObj;
            EndObjectRA      = endObj;
            BeginRef         = startRef;
            EndRef           = endRef;
            BeginOffset      = startOffset;
            EndOffset        = endOffset;

            // Now, initialize all the texts
            QuoteOA = new StJournalText();
            InitializeText(bldrQuote, QuoteOA);

            DiscussionOA = new StJournalText();
            InitializeText(bldrDiscussion, DiscussionOA);

            RecommendationOA = new StJournalText();
            InitializeText(bldrRecommendation, RecommendationOA);

            ResolutionOA = new StJournalText();
            InitializeText(bldrResolution, ResolutionOA);
        }
Exemplo n.º 2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initialize a new note.
        /// </summary>
        /// <param name="guidAnnotationType">GUID representing the type of annotation.</param>
        /// <param name="startRef">beginning reference note refers to</param>
        /// <param name="endRef">ending reference note refers to</param>
        /// <param name="beginObj">beginning object note refers to</param>
        /// <param name="endObj">ending object note refers to</param>
        /// <param name="wsSelector">The writing system selector.</param>
        /// <param name="startOffset">The starting character offset.</param>
        /// <param name="endOffset">The ending character offset.</param>
        /// <param name="bldrQuote">Para builder to use to build the Quote paragraph</param>
        /// <param name="bldrDiscussion">Para builder to use to build the Discussion
        /// paragraph</param>
        /// <param name="bldrRecommendation">Para builder to use to build the
        /// Recommendation paragraph</param>
        /// <param name="bldrResolution">Para builder to use to build the Resolution
        /// paragraph</param>
        /// ------------------------------------------------------------------------------------
        public void InitializeNote(Guid guidAnnotationType, BCVRef startRef, BCVRef endRef,
                                   ICmObject beginObj, ICmObject endObj, int wsSelector, int startOffset, int endOffset,
                                   StTxtParaBldr bldrQuote, StTxtParaBldr bldrDiscussion, StTxtParaBldr bldrRecommendation,
                                   StTxtParaBldr bldrResolution)
        {
            AnnotationTypeRA = new CmAnnotationDefn(Cache, guidAnnotationType);
            BeginObjectRA    = beginObj;
            EndObjectRA      = endObj;
            BeginRef         = startRef;
            EndRef           = endRef;
            WsSelector       = wsSelector;
            BeginOffset      = startOffset;
            EndOffset        = endOffset;

            // Now, initialize all the texts
            QuoteOA = new StJournalText();
            InitializeText(bldrQuote, QuoteOA);

            DiscussionOA = new StJournalText();
            InitializeText(bldrDiscussion, DiscussionOA);

            RecommendationOA = new StJournalText();
            InitializeText(bldrRecommendation, RecommendationOA);

            ResolutionOA = new StJournalText();
            InitializeText(bldrResolution, ResolutionOA);
        }
Exemplo n.º 3
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Writes this response to the the specified annotation
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public void WriteToCache(IScrScriptureNote ann, FwStyleSheet styleSheet)
        {
            ParagraphCollection parasResponse = new ParagraphCollection(Paragraphs, styleSheet);

            ParagraphCollection.ParaMatchType type;
            int matchIndex = FindMatchingResponse(parasResponse, ann.ResponsesOS, out type);

            switch (type)
            {
            case ParagraphCollection.ParaMatchType.Exact:
            case ParagraphCollection.ParaMatchType.Contains:
                break;                         // we can ignore the new response -- it's a subset of the old.

            case ParagraphCollection.ParaMatchType.IsContained:
                IStJournalText oldText = ann.ResponsesOS[matchIndex];
                oldText.ParagraphsOS.RemoveAll();
                parasResponse.WriteToCache(oldText);
                break;

            case ParagraphCollection.ParaMatchType.None:
                IStJournalText newText = new StJournalText();
                ann.ResponsesOS.Append(newText);
                parasResponse.WriteToCache(newText);
                break;
            }
        }
Exemplo n.º 4
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initialize a new note.
		/// </summary>
		/// <param name="guidAnnotationType">GUID representing the type of annotation.</param>
		/// <param name="startRef">beginning reference note refers to</param>
		/// <param name="endRef">ending reference note refers to</param>
		/// <param name="beginObj">beginning object note refers to</param>
		/// <param name="endObj">ending object note refers to</param>
		/// <param name="wsSelector">The writing system selector.</param>
		/// <param name="startOffset">The starting character offset.</param>
		/// <param name="endOffset">The ending character offset.</param>
		/// <param name="bldrQuote">Para builder to use to build the Quote paragraph</param>
		/// <param name="bldrDiscussion">Para builder to use to build the Discussion
		/// paragraph</param>
		/// <param name="bldrRecommendation">Para builder to use to build the
		/// Recommendation paragraph</param>
		/// <param name="bldrResolution">Para builder to use to build the Resolution
		/// paragraph</param>
		/// ------------------------------------------------------------------------------------
		public void InitializeNote(Guid guidAnnotationType, BCVRef startRef, BCVRef endRef,
			ICmObject beginObj, ICmObject endObj, int wsSelector, int startOffset, int endOffset,
			StTxtParaBldr bldrQuote, StTxtParaBldr bldrDiscussion, StTxtParaBldr bldrRecommendation,
			StTxtParaBldr bldrResolution)
		{
			AnnotationTypeRA = new CmAnnotationDefn(Cache, guidAnnotationType);
			BeginObjectRA = beginObj;
			EndObjectRA = endObj;
			BeginRef = startRef;
			EndRef = endRef;
			WsSelector = wsSelector;
			BeginOffset = startOffset;
			EndOffset = endOffset;

			// Now, initialize all the texts
			QuoteOA = new StJournalText();
			InitializeText(bldrQuote, QuoteOA);

			DiscussionOA = new StJournalText();
			InitializeText(bldrDiscussion, DiscussionOA);

			RecommendationOA = new StJournalText();
			InitializeText(bldrRecommendation, RecommendationOA);

			ResolutionOA = new StJournalText();
			InitializeText(bldrResolution, ResolutionOA);
		}
Exemplo n.º 5
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Writes this response to the the specified annotation
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public void WriteToCache(IScrScriptureNote ann, FwStyleSheet styleSheet)
		{
			ParagraphCollection parasResponse = new ParagraphCollection(Paragraphs, styleSheet);

			ParagraphCollection.ParaMatchType type;
			int matchIndex = FindMatchingResponse(parasResponse, ann.ResponsesOS, out type);

			switch (type)
			{
				case ParagraphCollection.ParaMatchType.Exact:
				case ParagraphCollection.ParaMatchType.Contains:
					break; // we can ignore the new response -- it's a subset of the old.
				case ParagraphCollection.ParaMatchType.IsContained:
					IStJournalText oldText = ann.ResponsesOS[matchIndex];
					oldText.ParagraphsOS.RemoveAll();
					parasResponse.WriteToCache(oldText);
					break;
				case ParagraphCollection.ParaMatchType.None:
					IStJournalText newText = new StJournalText();
					ann.ResponsesOS.Append(newText);
					parasResponse.WriteToCache(newText);
					break;
			}
		}
Exemplo n.º 6
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initialize a new note.
		/// </summary>
		/// <param name="guidAnnotationType">GUID representing the type of annotation.</param>
		/// <param name="startRef">beginning reference note refers to</param>
		/// <param name="endRef">ending reference note refers to</param>
		/// <param name="beginObj">beginning object note refers to</param>
		/// <param name="endObj">ending object note refers to</param>
		/// <param name="startOffset">The starting character offset.</param>
		/// <param name="endOffset">The ending character offset.</param>
		/// <param name="bldrQuote">Para builder to use to build the Quote paragraph</param>
		/// <param name="bldrDiscussion">Para builder to use to build the Discussion
		/// paragraph</param>
		/// <param name="bldrRecommendation">Para builder to use to build the
		/// Recommendation paragraph</param>
		/// <param name="bldrResolution">Para builder to use to build the Resolution
		/// paragraph</param>
		/// ------------------------------------------------------------------------------------
		public void InitializeNote(Guid guidAnnotationType, BCVRef startRef, BCVRef endRef,
			ICmObject beginObj, ICmObject endObj, int startOffset, int endOffset,
			StTxtParaBldr bldrQuote, StTxtParaBldr bldrDiscussion, StTxtParaBldr bldrRecommendation,
			StTxtParaBldr bldrResolution)
		{
			AnnotationTypeRA = Services.GetInstance<ICmAnnotationDefnRepository>().GetObject(guidAnnotationType);
			BeginObjectRA = beginObj;
			EndObjectRA = endObj;
			BeginRef = startRef;
			EndRef = endRef;
			BeginOffset = startOffset;
			EndOffset = endOffset;

			// Now, initialize all the texts
			QuoteOA = new StJournalText();
			InitializeText(bldrQuote, QuoteOA);

			DiscussionOA = new StJournalText();
			InitializeText(bldrDiscussion, DiscussionOA);

			RecommendationOA = new StJournalText();
			InitializeText(bldrRecommendation, RecommendationOA);

			ResolutionOA = new StJournalText();
			InitializeText(bldrResolution, ResolutionOA);
		}
Exemplo n.º 7
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Display a response to an annotation.
		/// </summary>
		/// <param name="vwenv"></param>
		/// <param name="text">StJournalText containing the response</param>
		/// <param name="expanded">whether response should be expanded</param>
		/// ------------------------------------------------------------------------------------
		private void DisplayResponse(IVwEnv vwenv, StJournalText text, bool expanded)
		{
			#region Response text
			// Display response text
			vwenv.OpenTableRow();
			// Display empty first, second, and third cells
			vwenv.OpenTableCell(1, 3);
			vwenv.CloseTableCell();

			vwenv.set_IntProperty((int)FwTextPropType.ktptBorderTop,
				(int)FwTextPropVar.ktpvMilliPoint, 500);
			vwenv.OpenTableCell(1, 2);
			vwenv.AddObjVecItems((int)StText.StTextTags.kflidParagraphs, this, (int)StTextFrags.kfrPara);
			vwenv.CloseTableCell();
			vwenv.CloseTableRow();
			#endregion

			#region Author and creation date
			// Author and creation date
			vwenv.OpenTableRow();

			// Display empty first, second, and third cells
			vwenv.OpenTableCell(1, 3);
			vwenv.CloseTableCell();

			// Display author in the third cell
			vwenv.OpenTableCell(1, 1);
			SetDisabledColorForNote(vwenv);
			vwenv.OpenConcPara(0, 0, 0, 0);
			vwenv.AddString(m_authorLabel);
			vwenv.CloseParagraph();
			vwenv.CloseTableCell();

			// Display creation date in the fourth cell
			vwenv.OpenTableCell(1, 1);
			vwenv.OpenConcPara(0, 0, 0, 0);
			vwenv.AddString(m_createdLabel);
			vwenv.AddString(m_tsStrFactory.MakeString(text.DateCreated.ToShortDateString(),
				m_cache.DefaultUserWs));
			vwenv.CloseParagraph();
			vwenv.CloseTableCell();
			vwenv.CloseTableRow();
			#endregion
		}
Exemplo n.º 8
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Displays the response fragment.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private void DisplayResponseFragment(IVwEnv vwenv, int hvo)
		{
			StJournalText text = new StJournalText(m_cache, hvo);

			// Open a table to display the the response.
			VwLength vlTable; // we use this to specify that the table takes 100% of the width.
			vlTable.nVal = 10000;
			vlTable.unit = VwUnit.kunPercent100;

			VwFramePosition framePos = VwFramePosition.kvfpVoid;
			if (text.OwnerHVO == SelectedNoteHvo)
			{
				framePos = (VwFramePosition.kvfpBelow | VwFramePosition.kvfpVsides);
			}

			vwenv.OpenTable(5, // Number of columns.
				vlTable, // Table uses 100% of available width.
				2000, // Border thickness.
				VwAlignment.kvaLeft, // Default alignment.
				framePos, // No border.
				//VwFramePosition.kvfpBox,
				//VwRule.kvrlAll, // rule lines between cells
				VwRule.kvrlNone,
				0, //No space between cells.
				0, //No padding inside cells.
				false);

			// Specify column widths. The first argument is the number of columns,
			// not a column index.
			VwLength vlColumn; // and this one to specify 90% for the text
			vlColumn.nVal = 12000;
			vlColumn.unit = VwUnit.kunPoint1000;
			vwenv.MakeColumns(3, vlColumn);
			//					vlColumn.nVal = 60000;
			//					vlColumn.unit = VwUnit.kunPoint1000;
			//					vwenv.MakeColumns(1, vlColumn);
			vlColumn.nVal = 1;
			vlColumn.unit = VwUnit.kunRelative;
			vwenv.MakeColumns(2, vlColumn);
			vwenv.OpenTableBody();

			DisplayResponse(vwenv, text, m_expandTable.ContainsKey(hvo) && m_expandTable[hvo]);

			// Close table
			vwenv.CloseTableBody();
			vwenv.CloseTable();
		}