Exemplo n.º 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Adjusts the references of the section and creates any needed BT's
        /// </summary>
        /// <param name="hvoText">The StText that was changed</param>
        /// <param name="ivMin">the starting index where the change occurred</param>
        /// <param name="cvIns">the number of paragraphs inserted</param>
        /// <param name="cvDel">the number of paragraphs deleted</param>
        /// ------------------------------------------------------------------------------------
        protected override void DoEffectsOfPropChange(int hvoText, int ivMin, int cvIns, int cvDel)
        {
            if (cvIns == 0 && cvDel == 0)
            {
                return;                 // Nothing actually changed
            }
            int    flid = m_cache.GetOwningFlidOfObject(hvoText);
            StText text = new StText(m_cache, hvoText, false, false);
            FdoOwningSequence <IStPara> paras = text.ParagraphsOS;

            // Create back translations for any new paragraphs
            if (flid == (int)ScrSection.ScrSectionTags.kflidContent ||
                flid == (int)ScrSection.ScrSectionTags.kflidHeading ||
                flid == (int)ScrBook.ScrBookTags.kflidTitle)
            {
                for (int iPara = ivMin; iPara < ivMin + cvIns; iPara++)
                {
                    ScrTxtPara para = new ScrTxtPara(m_cache, paras.HvoArray[iPara]);
                    para.GetOrCreateBT();
                }
            }

            // Adjust section references for section contents if we have some paragraphs left
            if (flid == (int)ScrSection.ScrSectionTags.kflidContent && paras.Count > 0)
            {
                ScrTxtPara.AdjustSectionRefsForStTextParaChg(text, ivMin);
            }

            // If we show boundary markers and we insert or delete a paragraph, we have to
            // update the marker of the previous paragraph as well, as that might
            // now be no longer the last paragraph (and thus needs to show the paragraph
            // marker instead of the section marker).
            if (((cvIns > 0 && cvDel == 0) || (cvIns == 0 && cvDel > 0)) && ivMin > 0 &&
                Options.ShowFormatMarksSetting)
            {
                text.Cache.PropChanged(null, PropChangeType.kpctNotifyAll, hvoText,
                                       (int)StText.StTextTags.kflidParagraphs, ivMin - 1, 1, 1);
            }
        }