public void BuildCmFilter2() { // Setup test values Cache.LangProject.PeopleOA = Cache.ServiceLocator.GetInstance <ICmPossibilityListFactory>().Create(); ICmPossibility person1 = Cache.ServiceLocator.GetInstance <ICmPersonFactory>().Create(); Cache.LangProject.PeopleOA.PossibilitiesOS.Add(person1); person1.ForeColor = 5; person1.BackColor = 10; // Setup filter ILcmOwningCollection <ICmFilter> filtersCol = Cache.LangProject.FiltersOC; ICmFilter filter = Cache.ServiceLocator.GetInstance <ICmFilterFactory>().Create(); filtersCol.Add(filter); filter.ColumnInfo = CmPossibilityTags.kClassId + "," + CmPossibilityTags.kflidForeColor + "|" + CmPossibilityTags.kClassId + "," + CmPossibilityTags.kflidBackColor; ICmRow row = Cache.ServiceLocator.GetInstance <ICmRowFactory>().Create(); filter.RowsOS.Add(row); ICmCell cell1 = Cache.ServiceLocator.GetInstance <ICmCellFactory>().Create(); row.CellsOS.Add(cell1); cell1.Contents = MakeString("= 5"); ICmCell cell2 = Cache.ServiceLocator.GetInstance <ICmCellFactory>().Create(); row.CellsOS.Add(cell2); cell2.Contents = MakeString("= 10"); // Check the result filter.InitCriteria(); Assert.IsTrue(filter.MatchesCriteria(person1.Hvo)); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Create a new style on the specified style list. /// </summary> /// <param name="styleList">The style list to add the style to</param> /// <param name="name">style name</param> /// <param name="context">style context</param> /// <param name="structure">style structure</param> /// <param name="function">style function</param> /// <param name="isCharStyle">true if character style, otherwise false</param> /// <param name="userLevel">User level</param> /// <param name="isBuiltIn">true if style is a bult-in style</param> /// ------------------------------------------------------------------------------------ public IStStyle AddStyle(ILcmOwningCollection <IStStyle> styleList, string name, ContextValues context, StructureValues structure, FunctionValues function, bool isCharStyle, int userLevel, bool isBuiltIn) { IStStyle style = Cache.ServiceLocator.GetInstance <IStStyleFactory>().Create(); styleList.Add(style); style.Name = name; style.Context = context; style.Structure = structure; style.Function = function; style.Type = (isCharStyle ? StyleType.kstCharacter : StyleType.kstParagraph); style.UserLevel = userLevel; ITsPropsBldr bldr = TsStringUtils.MakePropsBldr(); style.Rules = bldr.GetTextProps(); style.IsBuiltIn = isBuiltIn; return(style); }