Пример #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected override void Dispose(bool disposing)
        {
            //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
            // Must not be run more than once.
            if (IsDisposed)
            {
                return;
            }

            base.Dispose(disposing);

            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }
                if (m_FootnoteVc != null)
                {
                    m_FootnoteVc.Dispose();
                }
            }
            m_FootnoteVc  = null;
            m_Scripture   = null;
            m_persistence = null;
            m_draftView   = null;
            m_bookFilter  = null;
        }
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="FootnoteEditingHelper"/> class.
 /// </summary>
 /// <param name="callbacks">implementation of <see cref="IEditingCallbacks"/></param>
 /// <param name="cache">The cache for the DB connection</param>
 /// <param name="filterInstance">The special tag for the book filter</param>
 /// <param name="draftView">The corresponding draftview pane. If we determine that the
 /// "other pane" is supposed to be the other pane in the split window, then this
 /// should be used as the other pane as well.</param>
 /// <param name="viewType">Bit-flags indicating type of view.</param>
 /// <param name="app">The app.</param>
 /// ------------------------------------------------------------------------------------
 public FootnoteEditingHelper(IEditingCallbacks callbacks, FdoCache cache,
                              int filterInstance, FwRootSite draftView, TeViewType viewType, IApp app) :
     base(callbacks, cache, filterInstance, viewType, app)
 {
     m_draftView = draftView;
     if (m_draftView != null)             // can be null for tests
     {
         m_draftViewEditingHelper = m_draftView.EditingHelper as TeEditingHelper;
         Debug.Assert(m_draftViewEditingHelper != null);
     }
 }
Пример #3
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="FootnoteEditingHelper"/> class.
 /// </summary>
 /// <param name="callbacks">implementation of <see cref="IEditingCallbacks"/></param>
 /// <param name="cache">The cache for the DB connection</param>
 /// <param name="filterInstance">The special tag for the book filter</param>
 /// <param name="draftView">The corresponding draftview pane. If we determine that the
 /// "other pane" is supposed to be the other pane in the split window, then this
 /// should be used as the other pane as well.</param>
 /// <param name="isBacktranslation">if set to <c>true</c> we're dealing with
 /// backtranslations.</param>
 /// ------------------------------------------------------------------------------------
 public FootnoteEditingHelper(IEditingCallbacks callbacks, FdoCache cache,
                              int filterInstance, FwRootSite draftView, bool isBacktranslation) :
     base(callbacks, cache, filterInstance, TeViewType.FootnoteView | TeViewType.Horizontal |
          (isBacktranslation ? TeViewType.BackTranslation : TeViewType.Scripture))
 {
     m_draftView = draftView;
     if (m_draftView != null)             // can be null for tests
     {
         m_draftViewEditingHelper = m_draftView.EditingHelper as TeEditingHelper;
         Debug.Assert(m_draftViewEditingHelper != null);
     }
 }
Пример #4
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the FootnoteView class
 /// </summary>
 /// <param name="cache"></param>
 /// <param name="filterInstance">The special tag for the book filter</param>
 /// <param name="draftView">The corresponding draftview pane</param>
 /// <param name="btWs">The HVO of the writing system to display in this view if it is
 /// a back translation view; otherwise less than or equal to 0</param>
 /// ------------------------------------------------------------------------------------
 public FootnoteView(FdoCache cache, int filterInstance, FwRootSite draftView,
                     int btWs) : base(cache)
 {
     InitializeComponent();
     m_filterInstance    = filterInstance;
     m_draftView         = draftView;
     m_btWs              = btWs;
     m_isBackTranslation = (btWs > 0);
     BackColor           = EditableColor;
     //AutoScroll = false;
     // Enhance JohnT: probably footnote view needs to support the three ContentTypes, too.
     m_locationTracker = new LocationTrackerImpl(cache, m_filterInstance, ContentType);
     DoSpellCheck      = (EditingHelper as TeEditingHelper).ShowSpellingErrors;
 }
 /// --------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="T:DummyTeFootnoteEditingHelper"/> class.
 /// </summary>
 /// <param name="callbacks">The callbacks.</param>
 /// <param name="cache">The cache.</param>
 /// <param name="filterInstance">The filter instance.</param>
 /// <param name="draftView">The draft view.</param>
 /// --------------------------------------------------------------------------------
 public DummyTeFootnoteEditingHelper(IEditingCallbacks callbacks,
                                     FdoCache cache, int filterInstance, FwRootSite draftView)
     : base(callbacks, cache, filterInstance, draftView, false)
 {
     InTestMode = true;
 }
 /// --------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="T:DummyTeFootnoteEditingHelper"/> class.
 /// </summary>
 /// <param name="callbacks">The callbacks.</param>
 /// <param name="cache">The cache.</param>
 /// <param name="filterInstance">The filter instance.</param>
 /// <param name="draftView">The draft view.</param>
 /// --------------------------------------------------------------------------------
 public DummyTeFootnoteEditingHelper(IEditingCallbacks callbacks,
                                     FdoCache cache, int filterInstance, FwRootSite draftView)
     : base(callbacks, cache, filterInstance, draftView,
            TeViewType.FootnoteView | TeViewType.Horizontal, null)
 {
 }
Пример #7
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Sets up the specifed SelectionHelper for the specified paragraph and StText.
        /// </summary>
        /// <param name="helper">The SelectionHelper.</param>
        /// <param name="text">The StText.</param>
        /// <param name="para">The para.</param>
        /// <param name="limit">The limit.</param>
        /// <param name="view">The view</param>
        /// ------------------------------------------------------------------------------------
        private void SetupSelectionFor(SelectionHelper helper, IStText text, IStTxtPara para,
                                       SelectionHelper.SelLimitType limit, FwRootSite view)
        {
            Debug.Assert((view is DraftView && ((DraftView)view).TeEditingHelper != null) ||
                         (view is FootnoteView && ((FootnoteView)view).EditingHelper != null));

            helper.SetTextPropId(limit, StTxtParaTags.kflidContents);

            if (view is DraftView)
            {
                DraftView draftView = (DraftView)view;

                if ((text.OwningFlid == ScrSectionTags.kflidContent ||
                     text.OwningFlid == ScrSectionTags.kflidHeading))
                {
                    // text belongs to section heading or contents
                    IScrSection section = (IScrSection)text.Owner;
                    Debug.Assert(section.OwningFlid == ScrBookTags.kflidSections);

                    helper.SetNumberOfLevels(limit, 4);
                    SelLevInfo[] info = helper.GetLevelInfo(limit);
                    info[0].ihvo = para.IndexInOwner;
                    info[0].tag  = StTextTags.kflidParagraphs;
                    info[1].ihvo = 0;
                    info[1].tag  = text.OwningFlid;
                    info[2].ihvo = section.IndexInOwner;
                    info[2].tag  = ScrBookTags.kflidSections;
                    info[3].ihvo = draftView.TeEditingHelper.BookFilter.GetBookIndex((IScrBook)section.Owner);
                    info[3].tag  = draftView.TeEditingHelper.BookFilter.Tag;
                }
                else
                {
                    // text belongs to a book title
                    Debug.Assert(text.OwningFlid == ScrBookTags.kflidTitle);
                    IScrBook book = (IScrBook)text.Owner;

                    helper.SetNumberOfLevels(limit, 3);
                    SelLevInfo[] info = helper.GetLevelInfo(limit);
                    info[0].ihvo = para.IndexInOwner;
                    info[0].tag  = StTextTags.kflidParagraphs;
                    info[1].ihvo = 0;
                    info[1].tag  = text.OwningFlid;
                    info[2].ihvo = draftView.TeEditingHelper.BookFilter.GetBookIndex(book);
                    info[2].tag  = draftView.TeEditingHelper.BookFilter.Tag;
                }
            }
            else if (view is FootnoteView && text.OwningFlid == ScrBookTags.kflidFootnotes)
            {
                // text belongs to a footnote
                FootnoteView footnoteView = (FootnoteView)view;
                IStFootnote  footnote     = (IStFootnote)para.Owner;
                IScrBook     book         = (IScrBook)text.Owner;

                helper.SetNumberOfLevels(limit, 3);
                SelLevInfo[] info = helper.GetLevelInfo(limit);
                info[0].hvo  = text.Hvo;
                info[0].tag  = StTextTags.kflidParagraphs;
                info[1].hvo  = footnote.Hvo;
                info[1].ihvo = footnote.IndexInOwner;
                info[1].tag  = ScrBookTags.kflidFootnotes;
                info[2].hvo  = book.Hvo;
                info[2].ihvo = footnoteView.BookFilter.GetBookIndex(book);
                info[2].tag  = footnoteView.BookFilter.Tag;
                info[0].ich  = info[1].ich = info[2].ich = -1;
            }
        }
Пример #8
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Setups the specifed SelectionHelper for the specified paragraph and StText.
        /// </summary>
        /// <param name="helper">The SelectionHelper.</param>
        /// <param name="text">The StText.</param>
        /// <param name="para">The para.</param>
        /// <param name="limit">The limit.</param>
        /// <param name="view">The view</param>
        /// ------------------------------------------------------------------------------------
        private void SetupSelectionFor(SelectionHelper helper, StText text, StTxtPara para,
                                       SelectionHelper.SelLimitType limit, FwRootSite view)
        {
            Debug.Assert((view is DraftView && ((DraftView)view).TeEditingHelper != null) ||
                         (view is FootnoteView && ((FootnoteView)view).EditingHelper != null));
            if (view is DraftView)
            {
                DraftView draftView = (DraftView)view;

                if ((text.OwningFlid == (int)ScrSection.ScrSectionTags.kflidContent ||
                     text.OwningFlid == (int)ScrSection.ScrSectionTags.kflidHeading))
                {
                    // text belongs to section heading or contents
                    ScrSection section = new ScrSection(m_fdoCache, text.OwnerHVO);
                    Debug.Assert(section.OwningFlid == (int)ScrBook.ScrBookTags.kflidSections);

                    helper.SetNumberOfLevels(limit, 4);
                    SelLevInfo[] info = helper.GetLevelInfo(limit);
                    info[0].ihvo = para.IndexInOwner;
                    info[0].tag  = (int)StText.StTextTags.kflidParagraphs;
                    info[1].ihvo = text.IndexInOwner;
                    info[1].tag  = text.OwningFlid;
                    info[2].ihvo = section.IndexInBook;
                    info[2].tag  = (int)ScrBook.ScrBookTags.kflidSections;
                    info[3].ihvo = draftView.TeEditingHelper.BookFilter.GetBookIndex(section.OwnerHVO);
                    info[3].tag  = draftView.TeEditingHelper.BookFilter.Tag;
                    helper.SetLevelInfo(SelectionHelper.SelLimitType.End, info);
                }
                else
                {
                    // text belongs to a book title
                    Debug.Assert(text.OwningFlid == (int)ScrBook.ScrBookTags.kflidTitle);
                    ScrBook book = new ScrBook(m_fdoCache, text.OwnerHVO);

                    helper.SetNumberOfLevels(limit, 3);
                    SelLevInfo[] info = helper.GetLevelInfo(limit);
                    info[0].ihvo = para.IndexInOwner;
                    info[0].tag  = (int)StText.StTextTags.kflidParagraphs;
                    info[1].ihvo = text.IndexInOwner;
                    info[1].tag  = text.OwningFlid;
                    info[2].ihvo = draftView.TeEditingHelper.BookFilter.GetBookIndex(book.Hvo);
                    info[2].tag  = draftView.TeEditingHelper.BookFilter.Tag;
                    helper.SetLevelInfo(SelectionHelper.SelLimitType.End, info);
                }
            }
            else if (view is FootnoteView && text.OwningFlid == (int)ScrBook.ScrBookTags.kflidFootnotes)
            {
                // text belongs to a footnote
                FootnoteView footnoteView = (FootnoteView)view;
                StFootnote   footnote     = new StFootnote(m_fdoCache, para.OwnerHVO);
                ScrBook      book         = new ScrBook(m_fdoCache, text.OwnerHVO);

                helper.SetNumberOfLevels(limit, 3);
                SelLevInfo[] info = helper.GetLevelInfo(limit);
                info[0].hvo  = text.Hvo;
                info[0].tag  = (int)StText.StTextTags.kflidParagraphs;
                info[1].hvo  = footnote.Hvo;
                info[1].ihvo = footnote.IndexInOwner;
                info[1].tag  = (int)ScrBook.ScrBookTags.kflidFootnotes;
                info[2].hvo  = book.Hvo;
                info[2].ihvo = footnoteView.BookFilter.GetBookIndex(book.Hvo);
                info[2].tag  = footnoteView.BookFilter.Tag;
                info[0].ich  = info[1].ich = info[2].ich = -1;
                helper.SetLevelInfo(SelectionHelper.SelLimitType.End, info);
            }
        }