Exemple #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Gets the number of levels for the given tag.
        /// </summary>
        /// <param name="tag">The tag.</param>
        /// <param name="contentType">The kind of selection to return info about</param>
        /// <returns>Number of levels</returns>
        /// ------------------------------------------------------------------------------------
        public static int GetLevelCountForTag(int tag, StVc.ContentTypes contentType)
        {
            int levelCount;

            switch (tag)
            {
            case (int)ScrBook.ScrBookTags.kflidTitle:
                levelCount = kBookTitleLevelCount;
                break;

            case (int)ScrSection.ScrSectionTags.kflidHeading:
            case (int)ScrSection.ScrSectionTags.kflidContent:
                levelCount = kSectionLevelCount;
                break;

            case (int)ScrBook.ScrBookTags.kflidFootnotes:
                levelCount = kFootnoteLevelCount;
                break;

            default:
                Debug.Fail("Invalid tag in GetLevelCountForTag");
                return(-1);
            }

            return(levelCount + LevelOffset(contentType));
        }
Exemple #2
0
        static int LevelOffset(StVc.ContentTypes contentType)
        {
            switch (contentType)
            {
            case StVc.ContentTypes.kctSimpleBT:
                // Selection is in Translation of CmTranslation in Translations of StTxtPara (in StText...)
                return(1);

            case StVc.ContentTypes.kctSegmentBT:
                // Selection is in FreeTranslation of Segment in StTxtPara (in StText...)
                return(1);

            default:                     // StVc.ContentTypes.kctNormal
                // Selection is in contents of StTxtPara (in StText in Contents or Heading of ScrSection in ...)
                return(0);
            }
        }
Exemple #3
0
        static int LevelOffset(StVc.ContentTypes contentType)
        {
            switch (contentType)
            {
            case StVc.ContentTypes.kctNormal:
                // Selection is in contents of StTxtPara (in StText in Contents or Heading of ScrSection in ...)
                return(0);

            case StVc.ContentTypes.kctSimpleBT:
                // Selection is in Translation of CmTranslation in Translations of StTxtPara (in StText...)
                return(1);

            case StVc.ContentTypes.kctSegmentBT:
                // Selection is in Comment of CmIndirectAnnotation (free trans) in FT of CmBaseAnnotation (segment)
                // in segments of StTxtPara (in StText...)
                return(2);
            }
            return(0);            // make compiler happy :-)
        }
Exemple #4
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Gets the index of the level for the given tag.
        /// </summary>
        /// <param name="tag">The tag.</param>
        /// <param name="contentType">Kind of selection for which to adjust level</param>
        /// <returns>Index of the level, or -1 if unknown level.</returns>
        /// ------------------------------------------------------------------------------------
        public static int GetLevelIndexForTag(int tag, StVc.ContentTypes contentType)
        {
            int levelIndex;

            switch (tag)
            {
            case (int)CmPicture.CmPictureTags.kflidCaption:
                return(0);

            case (int)StTxtPara.StTxtParaTags.kflidTranslations:
                return(0);                        // always 0 (except when in a BT of a picture caption)

            case (int)StText.StTextTags.kflidParagraphs:
                levelIndex = 0;
                break;

            case (int)ScrSection.ScrSectionTags.kflidHeading:
            case (int)ScrSection.ScrSectionTags.kflidContent:
            case (int)ScrBook.ScrBookTags.kflidTitle:
            case (int)ScrBook.ScrBookTags.kflidFootnotes:
                levelIndex = 1;
                break;

            case (int)ScrBook.ScrBookTags.kflidSections:
                levelIndex = 2;
                break;

            case (int)Scripture.ScriptureTags.kflidScriptureBooks:
                levelIndex = 3;
                break;

            default:
                Debug.Fail("Invalid tag in GetLevelIndexForTag");
                return(-1);
            }

            return(levelIndex + LevelOffset(contentType));
        }
Exemple #5
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Insert the body of a paragraph. This is normally (with fApplyProps true) the body
 /// of case kfrPara and kfrFootnotePara in the Display method, but some subclasses
 /// need to separate this from applying the properties.
 /// </summary>
 /// <param name="vwenv"></param>
 /// <param name="hvo"></param>
 /// <param name="frag"></param>
 /// <param name="fApplyProps"></param>
 /// <param name="contentType"></param>
 /// <param name="vc">The view constructor used to create the paragraphs</param>
 /// ------------------------------------------------------------------------------------
 void IBtPrintLayoutSideBySideVc.InsertParagraphBody(IVwEnv vwenv, int hvo, int frag,
                                                     bool fApplyProps, StVc.ContentTypes contentType, StVc vc)
 {
     InsertParagraphBody(vwenv, hvo, frag, fApplyProps, contentType, vc);
 }
Exemple #6
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="LocationTrackerImpl"/> class.
 /// </summary>
 /// <param name="cache">The cache.</param>
 /// <param name="filterInstance">The filter instance. If 0, then the normal DB book list
 /// is used</param>
 /// <param name="contentType">Indicates the kind of data in the view about which we
 /// are returning selection information.</param>
 /// ------------------------------------------------------------------------------------
 public LocationTrackerImpl(FdoCache cache, int filterInstance, StVc.ContentTypes contentType)
 {
     m_cache       = cache;
     m_bookFilter  = FilteredScrBooks.GetFilterInstance(cache, filterInstance);
     m_contentType = contentType;
 }
Exemple #7
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="LocationTrackerImpl"/> class.
 /// </summary>
 /// <param name="cache">The cache.</param>
 /// <param name="filterInstance">The filter instance. If 0, then the normal DB book list
 /// is used</param>
 /// <param name="contentType">Indicates the kind of data in the view about which we
 /// are returning selection information.</param>
 /// ------------------------------------------------------------------------------------
 public LocationTrackerImpl(FdoCache cache, int filterInstance, StVc.ContentTypes contentType)
 {
     m_cache       = cache;
     m_bookFilter  = cache.ServiceLocator.GetInstance <IFilteredScrBookRepository>().GetFilterInstance(filterInstance);
     m_contentType = contentType;
 }
Exemple #8
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the DraftView class as a draft view editing pane,
		/// for either vernacular or back translation.
		/// </summary>
		/// <param name="cache">The cache.</param>
		/// <param name="contentType">specifies normal or some kind of BT</param>
		/// <param name="showInTable">True to show the text layed out in a table, false
		/// otherwise</param>
		/// <param name="makeRootAutomatically">attempt to construct the rootbox automatically
		/// when the window handle is created</param>
		/// <param name="persistSettings">true to save and load settings for the window</param>
		/// <param name="viewType">Type of the view.</param>
		/// <param name="filterInstance"></param>
		/// ------------------------------------------------------------------------------------
		public DraftView(FdoCache cache, StVc.ContentTypes contentType, bool showInTable,
			bool makeRootAutomatically, bool persistSettings, TeViewType viewType,
			int filterInstance) : base(cache)
		{
			if (contentType == StVc.ContentTypes.kctSegmentBT)
				LexEntryUi.EnsureFlexVirtuals(Cache, Mediator);

			AutoScroll = false;
			m_contentType = contentType;
			m_fShowInTable = showInTable;
			m_fMakeRootWhenHandleIsCreated = makeRootAutomatically;
			m_persistSettings = persistSettings;
			m_filterInstance = filterInstance;

			m_bookFilter = FilteredScrBooks.GetFilterInstance(cache, m_filterInstance);
			// if the filter is still null then make one for testing
			if (m_bookFilter == null && TheMainWnd == null)
				m_bookFilter = new FilteredScrBooks(cache, m_filterInstance);

			m_locationTracker = new LocationTrackerImpl(cache, m_filterInstance,
				m_contentType);

			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();

			BackColor = EditableColor;
			m_viewType = viewType;
			DoSpellCheck = (EditingHelper as TeEditingHelper).ShowSpellingErrors;
		}
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="LocationTrackerImpl"/> class.
		/// </summary>
		/// <param name="cache">The cache.</param>
		/// <param name="filterInstance">The filter instance. If 0, then the normal DB book list
		/// is used</param>
		/// <param name="contentType">Indicates the kind of data in the view about which we
		/// are returning selection information.</param>
		/// ------------------------------------------------------------------------------------
		public LocationTrackerImpl(FdoCache cache, int filterInstance, StVc.ContentTypes contentType)
		{
			m_cache = cache;
			m_bookFilter = cache.ServiceLocator.GetInstance<IFilteredScrBookRepository>().GetFilterInstance(filterInstance);
			m_contentType = contentType;
		}