/// <summary> /// Test whether a particular StTxtPara is part of Scripture. /// </summary> /// <param name="hvoPara"></param> /// <param name="cache"></param> /// <returns></returns> public static bool IsScripturePara(int hvoPara, FdoCache cache) { int flidOfOwnerOfSttext = cache.GetOwningFlidOfObject(cache.GetOwnerOfObject(hvoPara)); return(Scripture.Scripture.IsScriptureTextFlid(flidOfOwnerOfSttext)); }
/// <summary> /// Test whether a particular StTxtPara is part of Scripture. /// </summary> /// <param name="hvoPara"></param> /// <param name="cache"></param> /// <returns></returns> public static bool IsScripturePara(int hvoPara, FdoCache cache) { int flidOfOwnerOfSttext = cache.GetOwningFlidOfObject(cache.GetOwnerOfObject(hvoPara)); return Scripture.Scripture.IsScriptureTextFlid(flidOfOwnerOfSttext); }
private static bool CheckAndReportBadTagListAdd(FdoCache cache, int hvoItem, int hvoRootItem, int hvoPossList) { if (cache.GetOwningFlidOfObject(hvoPossList) != (int) LangProject.LangProjectTags.kflidTextMarkupTags) return false; // some other list we don't care about. // Confirm the two-level rule. if (hvoItem != hvoRootItem) { MessageBox.Show(FdoUiStrings.ksMarkupTagsTooDeep, FdoUiStrings.ksHierarchyLimit, MessageBoxButtons.OK, MessageBoxIcon.Warning); return true; } return false; }
private static bool CheckAndReportBadDiscourseTemplateAdd(FdoCache cache, int hvoItem, int hvoRootItem, int hvoList) { if (cache.GetOwningFlidOfObject(hvoList) != (int)DsDiscourseData.DsDiscourseDataTags.kflidConstChartTempl) return false; // some other list we don't care about. // We can't turn a column into a group if it's in use. CmPossibility col = CmPossibility.CreateFromDBObject(cache, hvoItem) as CmPossibility; // If the item doesn't already have children, we can only add them if it isn't already in use // as a column: we don't want to change a column into a group. Thus, if there are no // children, we generally call the same routine as when deleting. // However, that routine has a special case to prevent deletion of the default template even // if NOT in use...and we must not prevent adding to that when it is empty! Indeed any // empty CHART can always be added to, so only if col's owner is a CmPossibility (it's not a root // item in the templates list) do we need to check for it being in use. if (col.SubPossibilitiesOS.Count == 0 && col.Owner is CmPossibility && col.CheckAndReportProtectedChartColumn()) return true; // Finally, we have to confirm the two-level rule. if (hvoItem != hvoRootItem && cache.GetOwnerOfObject(hvoItem) != hvoRootItem) { MessageBox.Show(FdoUiStrings.ksTemplateTooDeep, FdoUiStrings.ksHierarchyLimit, MessageBoxButtons.OK, MessageBoxIcon.Warning); return true; } return false; }
/// <summary> /// Takes the information from a dummy object and allows its owner to create a real object in the database. /// NOTE: after calling this, users need to make sure they no longer try to use the old hvoDummy object. /// </summary> /// <param name="fcCache"></param> /// <param name="hvoDummy">id corresponding to the object to convert. Minimally it should have a class id cached /// and an OwningFlid corresponding to a virtual handler that implements IDummyRequestConversion. </param> /// <returns>real object based on new database entry created for the dummy object, /// null if conversion did not take place.</returns> public static ICmObject ConvertDummyToReal(FdoCache fcCache, int hvoDummy) { // suppress changes in display. using (new IgnorePropChanged(fcCache, PropChangedHandling.SuppressView)) { // This conversion should not be an undoable task, so suppress the action handler. // (cf. LT-5330, LT-5417). using (SuppressSubTasks supressActionHandler = new SuppressSubTasks(fcCache, true)) { ICmObject realObj = null; Debug.Assert(fcCache.IsDummyObject(hvoDummy)); if (fcCache.IsDummyObject(hvoDummy)) { // see if we can convert this to a real object before loading it. int owningFlid = fcCache.GetOwningFlidOfObject(hvoDummy); IVwVirtualHandler vh = fcCache.VwCacheDaAccessor.GetVirtualHandlerId(owningFlid); Debug.Assert(vh != null && vh is IDummyRequestConversion); if (vh != null && vh is IDummyRequestConversion) { RequestConversionToRealEventArgs args = new RequestConversionToRealEventArgs(hvoDummy, 0, null, true); args.OwningFlid = owningFlid; (vh as IDummyRequestConversion).OnRequestConversionToReal(hvoDummy, args); realObj = args.RealObject as ICmObject; } } return realObj; } } }