/// <summary> /// Therefore this method, called once we have a cache and object, is our first chance to /// actually create the embedded control. /// </summary> public override void FinishInit() { CheckDisposed(); IWritingSystemContainer wsContainer = Cache.ServiceLocator.WritingSystems; bool fVernRTL = wsContainer.DefaultVernacularWritingSystem.RightToLeftScript; bool fAnalRTL = wsContainer.DefaultAnalysisWritingSystem.RightToLeftScript; System.Xml.XmlAttribute xa = ConfigurationNode.Attributes["layout"]; // To properly fix LT-6239, we need to consider all four mixtures of directionality // involving the vernacular (table) and analysis (slot name) writing systems. // These four possibilities are marked RTL, LTRinRTL, RTLinLTR, and <nothing>. if (fVernRTL && fAnalRTL) { if (xa.Value.EndsWith("RTLinLTR") || xa.Value.EndsWith("LTRinRTL")) xa.Value = xa.Value.Substring(0, xa.Value.Length - 8); if (!xa.Value.EndsWith("RTL")) xa.Value += "RTL"; // both vern and anal are RTL } else if (fVernRTL && !fAnalRTL) { if (xa.Value.EndsWith("RTLinLTR")) xa.Value = xa.Value.Substring(0, xa.Value.Length - 8); else if (xa.Value.EndsWith("RTL") && !xa.Value.EndsWith("LTRinRTL")) xa.Value = xa.Value.Substring(0, xa.Value.Length - 3); if (!xa.Value.EndsWith("LTRinRTL")) xa.Value += "LTRinRTL"; // LTR anal name in RTL vern table } else if (!fVernRTL && fAnalRTL) { if (xa.Value.EndsWith("LTRinRTL")) xa.Value = xa.Value.Substring(0, xa.Value.Length - 8); else if (xa.Value.EndsWith("RTL")) xa.Value = xa.Value.Substring(0, xa.Value.Length - 3); if (!xa.Value.EndsWith("RTLinLTR")) xa.Value += "RTLinLTR"; // RTL anal name in LTR vern table } else { if (xa.Value.EndsWith("RTLinLTR") || xa.Value.EndsWith("LTRinRTL")) xa.Value = xa.Value.Substring(0, xa.Value.Length - 8); else if (xa.Value.EndsWith("RTL")) xa.Value = xa.Value.Substring(0, xa.Value.Length - 3); // both vern and anal are LTR (unmarked case) } var ctrl = new InflAffixTemplateControl((FdoCache)Mediator.PropertyTable.GetValue("cache"), Object.Hvo, ConfigurationNode, StringTbl); Control = ctrl; m_menuHandler = InflAffixTemplateMenuHandler.Create(ctrl, ConfigurationNode); #if !Want m_menuHandler.Init(Mediator, null); #else m_menuHandler.Init(null, null); #endif ctrl.SetContextMenuHandler(m_menuHandler.ShowSliceContextMenu); ctrl.Mediator = Mediator; ctrl.SetStringTableValues(Mediator.StringTbl); if (ctrl.RootBox == null) ctrl.MakeRoot(); }