public void SetRoot(int hvo) { CheckDisposed(); if (hvo != 0) { ICmObject co = CmObject.CreateFromDBObject(Cache, hvo); if (Scripture.IsResponsibleFor(co as StText)) { m_hvoRoot = hvo; // StText (i.e. Scripture) } else { m_hvoRoot = co.OwnerHVO; // Text (i.e. non-scripture). Editable. } SetupVc(); } else { m_hvoRoot = 0; ReadOnlyView = true; if (m_vc != null) { m_vc.IsScripture = false; m_vc.Editable = false; } } ChangeOrMakeRoot(m_hvoRoot, m_vc, TitleContentsVc.kfragRoot, m_styleSheet); }
void SetupVc() { if (m_vc == null || m_hvoRoot == 0) { return; } Debug.Assert(m_hvoRoot != 0, "m_hvoRoot should be set before using SetupVc()."); ICmObject co = CmObject.CreateFromDBObject(Cache, m_hvoRoot); m_vc.IsScripture = Scripture.IsResponsibleFor(co as StText); // don't allow editing scripture titles. m_vc.Editable = !m_vc.IsScripture; this.ReadOnlyView = !m_vc.Editable; }
private void SetupVc() { if (m_vc == null || m_hvoRoot == 0) { return; } int wsFirstPara = Cache.LangProject.ActualWs(LangProject.kwsVernInParagraph, m_hvoRoot, (int)StText.StTextTags.kflidParagraphs); if (wsFirstPara == -1) { // The paragraph's first character has no valid writing system...this seems to be possible // when it consists entirely of a picture. Rather than crashing, presume the default. wsFirstPara = Cache.DefaultVernWs; } m_vc.SetupVernWsForText(wsFirstPara); StText stText = new StText(Cache, m_hvoRoot); if (m_configurationParameters != null) { m_vc.Editable = SIL.Utils.XmlUtils.GetOptionalBooleanAttributeValue( m_configurationParameters, "editable", true) && !Scripture.IsResponsibleFor(stText); } }