Esempio n. 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Go to the previous footnote in the footnote view
        /// </summary>
        /// <returns></returns>
        /// ------------------------------------------------------------------------------------
        public override ScrFootnote GoToPreviousFootnote()
        {
            CheckDisposed();

            // In case no footnote is selected - can happen when footnote pane is first opened.
            if (CurrentSelection == null)
            {
                return(null);
            }

            // Get the information needed from the current selection
            int     iBook     = CurrentSelection.GetLevelInfoForTag(BookFilter.Tag).ihvo;
            int     iFootnote = CurrentSelection.GetLevelInfoForTag((int)ScrBook.ScrBookTags.kflidFootnotes).ihvo;
            ScrBook book      = BookFilter.GetBook(iBook);

            // Get the previous footnote if it exists
            if (--iFootnote < 0)
            {
                return(null);
            }
            ScrFootnote footnote = new ScrFootnote(m_cache, book.FootnotesOS.HvoArray[iFootnote]);

            ScrollToFootnote(iBook, iFootnote, 0);
            return(footnote);
        }
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Determine if the pasting of text from the clipboard is possible.
 /// </summary>
 /// <returns>
 /// Returns <c>true</c> if pasting is possible.
 /// </returns>
 /// ------------------------------------------------------------------------------------
 public override bool CanPaste()
 {
     if (base.CanPaste())
     {
         // Currently, can not paste if the current selection covers more than one paragraph.
         // The deletion of the range will cause the a new selection to be requested at the
         // end of the UOW which will destroy the current selection. This could be solved by
         // splitting the UOW inot 2 parts, but it was decided not to do this right now.
         SelLevInfo anchorInfo;
         SelLevInfo endInfo;
         if (CurrentSelection.GetLevelInfoForTag(StTextTags.kflidParagraphs,
                                                 SelectionHelper.SelLimitType.Anchor, out anchorInfo) &&
             CurrentSelection.GetLevelInfoForTag(StTextTags.kflidParagraphs,
                                                 SelectionHelper.SelLimitType.End, out endInfo))
         {
             return(anchorInfo.hvo == endInfo.hvo);
         }
     }
     return(false);
 }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Goto the next footnote in the footnote view
        /// </summary>
        /// <returns></returns>
        /// ------------------------------------------------------------------------------------
        public override IScrFootnote GoToNextFootnote()
        {
            CheckDisposed();

            // In case no footnote is selected - can happen when footnote pane is first opened.
            if (CurrentSelection == null)
            {
                return(null);
            }

            // Get the information needed from the current selection
            int      iBook     = CurrentSelection.GetLevelInfoForTag(BookFilter.Tag).ihvo;
            int      iFootnote = CurrentSelection.GetLevelInfoForTag(ScrBookTags.kflidFootnotes).ihvo;
            IScrBook book      = BookFilter.GetBook(iBook);

            // Get the next footnote if it exists
            if (++iFootnote >= book.FootnotesOS.Count)
            {
                return(null);
            }

            ScrollToFootnote(iBook, iFootnote, 0);
            return((IScrFootnote)book.FootnotesOS[iFootnote]);
        }