SIL.FieldWorks.IText.InterlinearExporter.AddObjVecItems C# (CSharp) Method

AddObjVecItems() public method

This method (as far as I know) will be first called on the StText object, and then recursively from the base implementation for vector items in component objects.
public AddObjVecItems ( int tag, IVwViewConstructor vc, int frag ) : void
tag int
vc IVwViewConstructor
frag int
return void
		public override void AddObjVecItems(int tag, IVwViewConstructor vc, int frag)
		{
			ICmObject text = null;
			switch(frag)
			{
				case InterlinVc.kfragInterlinPara:
					m_writer.WriteStartElement("interlinear-text");
					//here the m_hvoCurr object is an StText object, store the IText owner
					//so that we can pull data from it to close out the interlinear-text element
					//Naylor 11-2011
					text = m_repoObj.GetObject(m_hvoCurr).Owner;
					if(text is IScrBook || text is IScrSection)
					{
						m_writer.WriteAttributeString("guid", m_repoObj.GetObject(m_hvoCurr).Guid.ToString());
					}
					else
					{
						m_writer.WriteAttributeString("guid", text.Guid.ToString());
					}
					foreach (var mTssPendingTitle in pendingTitles)
					{
						var hystericalRaisens = mTssPendingTitle;
						WritePendingItem("title", ref hystericalRaisens);
					}
					foreach (var mTssPendingAbbrev in pendingAbbreviations)
					{
						var hystericalRaisens = mTssPendingAbbrev;
						WritePendingItem("title-abbreviation", ref hystericalRaisens);
					}
					foreach(var source in pendingSources)
					{
						var hystericalRaisens = source;
						WritePendingItem("source", ref hystericalRaisens);
					}
					foreach (var desc in pendingComments)
					{
						var hystericalRaisens = desc;
						WritePendingItem("comment", ref hystericalRaisens);
					}
					m_writer.WriteStartElement("paragraphs");
					break;
				case InterlinVc.kfragParaSegment:
					m_writer.WriteStartElement("phrases");
					break;
				case InterlinVc.kfragBundle:
					m_writer.WriteStartElement("words");
					break;
				case InterlinVc.kfragMorphBundle:
					m_writer.WriteStartElement("morphemes");
					break;
				default:
					break;
			}
			base.AddObjVecItems (tag, vc, frag);
			switch(frag)
			{
				case InterlinVc.kfragInterlinPara:
					m_writer.WriteEndElement(); // paragraphs
					m_writer.WriteStartElement("languages");
					foreach (int wsActual in m_usedWritingSystems)
					{
						m_writer.WriteStartElement("language");
						// we don't have enough context at this point to get all the possible writing system
						// information we may encounter in the word bundles.
						string icuCode = m_cache.LanguageWritingSystemFactoryAccessor.GetStrFromWs(wsActual);
						m_writer.WriteAttributeString("lang", icuCode);
						IWritingSystem ws = m_wsManager.Get(wsActual);
						string fontName = ws.DefaultFontName;
						m_writer.WriteAttributeString("font", fontName);
						if (m_cache.ServiceLocator.WritingSystems.VernacularWritingSystems.Contains(ws))
							m_writer.WriteAttributeString("vernacular", "true");
						if (ws.RightToLeftScript)
							m_writer.WriteAttributeString("RightToLeft", "true");
						m_writer.WriteEndElement();
					}
					m_writer.WriteEndElement();	// languages
					//Media files section
					if (text != null && text is FDO.IText && ((FDO.IText)text).MediaFilesOA != null)
					{
						FDO.IText theText = (FDO.IText) text;
						m_writer.WriteStartElement("media-files");
						m_writer.WriteAttributeString("offset-type", theText.MediaFilesOA.OffsetType);
						foreach (var mediaFile in theText.MediaFilesOA.MediaURIsOC)
						{
							m_writer.WriteStartElement("media");
							m_writer.WriteAttributeString("guid", mediaFile.Guid.ToString());
							m_writer.WriteAttributeString("location", mediaFile.MediaURI);
							m_writer.WriteEndElement(); //media
						}
						m_writer.WriteEndElement(); //media-files
					}
					m_writer.WriteEndElement(); // interlinear-text

					//wipe out the pending items to be clean for next text.
					pendingTitles.Clear();
					pendingSources.Clear();
					pendingAbbreviations.Clear();
					pendingComments.Clear();
					break;
				case InterlinVc.kfragParaSegment:
				case InterlinVc.kfragBundle:
				case InterlinVc.kfragMorphBundle:
					m_writer.WriteEndElement();
					break;
				default:
					break;
			}
		}