/// ------------------------------------------------------------------------------------ /// <summary> /// Parse the existing Contents to determine the integer match criteria and set member /// data needed by MatchesCriteria. /// </summary> /// ------------------------------------------------------------------------------------ public void ParseIntegerMatchCriteria() { string filterCellContents = Contents.Text; int iSpace = filterCellContents.IndexOf(' '); string strOperator = filterCellContents.Substring(0, iSpace).Trim(); string strMatchValue = filterCellContents.Substring(iSpace).Trim(); switch (strOperator) { case "=": m_comparisonType = ComparisionTypes.kEquals; break; case ">=": m_comparisonType = ComparisionTypes.kGreaterThanEqual; break; case "<=": m_comparisonType = ComparisionTypes.kLessThanEqual; break; default: Debug.Fail("Unexpected operator!"); break; } m_matchValue = Int32.Parse(strMatchValue); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Save this set of match criteria. /// </summary> /// <param name="matchVal">Match value</param> /// <param name="fIncludeSubitems">Indicates whether to include the subitems of the /// given macthVal (which is assumed to be the HVO of a cmPossibility) when looking for /// a match</param> /// <param name="fMatchEmpty">Indicates whether an empty collection should be counted /// as a match</param> /// ------------------------------------------------------------------------------------ public void BuildObjectMatchCriteria(int matchVal, bool fIncludeSubitems, bool fMatchEmpty) { m_comparisonType = ComparisionTypes.kMatches; m_matchValue = matchVal; m_matchSubitems = fIncludeSubitems; m_matchEmpty = fMatchEmpty; SaveObjectMatchCriteria(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Builds a match criteria that will match on an empty object. /// </summary> /// ------------------------------------------------------------------------------------ public void BuildObjectMatchCriteria() { m_comparisonType = ComparisionTypes.kEmpty; m_matchValue = 0; m_matchSubitems = false; m_matchEmpty = true; SaveObjectMatchCriteria(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Save this set of match criteria. /// </summary> /// <param name="comparisonType">Type of camparison</param> /// <param name="min">Minimum (or only) match value</param> /// <param name="max"></param> /// ------------------------------------------------------------------------------------ public void BuildIntegerMatchCriteria(CmCell.ComparisionTypes comparisonType, int min, int max) { m_comparisonType = comparisonType; m_matchValue = min; m_maxMatchValue = max; SaveIntegerMatchCriteria(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Parse the existing Contents to determine the object match criteria and set member /// data needed by MatchesCriteria. /// </summary> /// ------------------------------------------------------------------------------------ public void ParseObjectMatchCriteria() { string criteria = Contents.Text; m_comparisonType = ComparisionTypes.kUndefined; m_matchValue = 0; m_matchSubitems = criteria.IndexOf("+subitems") >= 0; m_matchEmpty = criteria.IndexOf("Empty") >= 0; if (criteria.IndexOf("Matches") >= 0) { m_comparisonType = ComparisionTypes.kMatches; } else if (m_matchEmpty) { m_comparisonType = ComparisionTypes.kEmpty; } Debug.Assert(m_comparisonType != ComparisionTypes.kUndefined); m_matchValues = null; // Check to see whether the criteria specifies a specific (default) object. if (criteria.IndexOf(StringUtils.kchObject) >= 0) { ITsTextProps ttp = Contents.UnderlyingTsString.get_Properties(1); //assume second run string objData = ttp.GetStrPropValue((int)FwTextPropType.ktptObjData); if (objData[0] == (char)FwObjDataTypes.kodtNameGuidHot) { Guid guid = MiscUtils.GetGuidFromObjData(objData.Substring(1)); m_matchValue = m_cache.GetIdFromGuid(guid); } if (m_matchValue != 0) //Filter is no longer valid if zero, happens when note categories are modified in TLE (TE-8571) { InitializeMatchValuesArray(); } } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Parse the existing Contents to determine the object match criteria and set member /// data needed by MatchesCriteria. /// </summary> /// ------------------------------------------------------------------------------------ public void ParseObjectMatchCriteria() { string criteria = Contents.Text; m_comparisonType = ComparisionTypes.kUndefined; m_matchValue = 0; m_matchSubitems = criteria.IndexOf("+subitems") >= 0; m_matchEmpty = criteria.IndexOf("Empty") >= 0; if (criteria.IndexOf("Matches") >= 0) m_comparisonType = ComparisionTypes.kMatches; else if (m_matchEmpty) m_comparisonType = ComparisionTypes.kEmpty; Debug.Assert(m_comparisonType != ComparisionTypes.kUndefined); m_matchValues = null; // Check to see whether the criteria specifies a specific (default) object. if (criteria.IndexOf(StringUtils.kchObject) >= 0) { ITsTextProps ttp = Contents.UnderlyingTsString.get_Properties(1); //assume second run string objData = ttp.GetStrPropValue((int)FwTextPropType.ktptObjData); if (objData[0] == (char)FwObjDataTypes.kodtNameGuidHot) { Guid guid = MiscUtils.GetGuidFromObjData(objData.Substring(1)); m_matchValue = m_cache.GetIdFromGuid(guid); } if (m_matchValue != 0) //Filter is no longer valid if zero, happens when note categories are modified in TLE (TE-8571) InitializeMatchValuesArray(); } }