internal void AddField(int flid, string fieldName, CellarPropertyType cpt, int destClsid)
        {
            var clsid = flid / 1000;
            var mfi   = new MockFieldInfo
            {
                m_flid          = flid,
                m_name          = fieldName,
                m_cpt           = cpt,
                m_destClsid     = destClsid,
                m_fCustom       = false,
                m_fieldHelp     = null,
                m_fieldWs       = WritingSystemServices.kwsAnal,
                m_fieldListRoot = Guid.Empty
            };

            m_fieldsById.Add(flid, mfi);
            List <MockFieldInfo> list;

            if (!m_fieldsByClassId.TryGetValue(clsid, out list))
            {
                list = new List <MockFieldInfo>();
                m_fieldsByClassId.Add(clsid, list);
            }
            list.Add(mfi);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Note a virtual property. The type is the simulated type, one of the original types,
        /// NOT with the virtual bit OR'd in.
        ///</summary>
        /// <param name='bstrClass'> </param>
        /// <param name='bstrField'> </param>
        /// <param name='luFlid'> </param>
        /// <param name='type'> </param>
        public void AddVirtualProp(string bstrClass, string bstrField, int luFlid, int type)
        {
            var clsid = luFlid / 1000;
            var mfi   = new MockFieldInfo
            {
                m_flid          = luFlid,
                m_name          = bstrField,
                m_cpt           = (CellarPropertyType)type,
                m_destClsid     = 0,
                m_fCustom       = false,
                m_fieldHelp     = null,
                m_fieldWs       = WritingSystemServices.kwsAnal,
                m_fieldListRoot = Guid.Empty,
                m_isVirtual     = true
            };

            m_fieldsById.Add(luFlid, mfi);
            List <MockFieldInfo> list;

            if (!m_fieldsByClassId.TryGetValue(clsid, out list))
            {
                list = new List <MockFieldInfo>();
                m_fieldsByClassId.Add(clsid, list);
            }
            list.Add(mfi);
        }
        public int AddCustomField(string className, string fieldName, CellarPropertyType fieldType,
                                  int destinationClass, string fieldHelp, int fieldWs, Guid fieldListRoot)
        {
            int clid;

            if (m_classesByName.TryGetValue(className, out clid))
            {
                List <MockFieldInfo> list;
                var flid = (clid * 1000) + 500;
                if (m_fieldsByClassId.TryGetValue(clid, out list))
                {
                    var flidMax = flid - 1;
                    foreach (MockFieldInfo mfi in list)
                    {
                        if (mfi.m_fCustom && mfi.m_flid > flid)
                        {
                            flidMax = mfi.m_flid;
                        }
                    }
                    flid = flidMax + 1;
                }
                else
                {
                    list = new List <MockFieldInfo>();
                    m_fieldsByClassId.Add(clid, list);
                }
                var mfiNew = new MockFieldInfo
                {
                    m_flid          = flid,
                    m_name          = fieldName,
                    m_cpt           = fieldType,
                    m_destClsid     = destinationClass,
                    m_fCustom       = true,
                    m_fieldHelp     = fieldHelp,
                    m_fieldWs       = fieldWs,
                    m_fieldListRoot = fieldListRoot
                };
                list.Add(mfiNew);
                m_fieldsById.Add(flid, mfiNew);
                return(flid);
            }

            return(0);
        }
Ejemplo n.º 4
0
		internal void AddField(int flid, string fieldName, CellarPropertyType cpt, int destClsid)
		{
			var clsid = flid / 1000;
			var mfi = new MockFieldInfo
				{
					m_flid = flid,
					m_name = fieldName,
					m_cpt = cpt,
					m_destClsid = destClsid,
					m_fCustom = false,
					m_isVirtual = false,
					m_fieldHelp = null,
					m_fieldWs = WritingSystemServices.kwsAnal,
					m_fieldListRoot = Guid.Empty
				};
			m_fieldsById.Add(flid, mfi);
			List<MockFieldInfo> list;
			if (!m_fieldsByClassId.TryGetValue(clsid, out list))
			{
				list = new List<MockFieldInfo>();
				m_fieldsByClassId.Add(clsid, list);
			}
			list.Add(mfi);
		}
Ejemplo n.º 5
0
		public int AddCustomField(string className, string fieldName, CellarPropertyType fieldType,
			int destinationClass, string fieldHelp, int fieldWs, Guid fieldListRoot)
		{
			int clid;
			if (m_classesByName.TryGetValue(className, out clid))
			{
				List<MockFieldInfo> list;
				var flid = (clid * 1000) + 500;
				if (m_fieldsByClassId.TryGetValue(clid, out list))
				{
					var flidMax = flid - 1;
					foreach (MockFieldInfo mfi in list)
					{
						if (mfi.m_fCustom && mfi.m_flid >= flid)
							flidMax = mfi.m_flid;
					}
					flid = flidMax + 1;
				}
				else
				{
					list = new List<MockFieldInfo>();
					m_fieldsByClassId.Add(clid, list);
				}
				var mfiNew = new MockFieldInfo
					{
						m_flid = flid,
						m_name = fieldName,
						m_cpt = fieldType,
						m_destClsid = destinationClass,
						m_fCustom = true,
						m_fieldHelp = fieldHelp,
						m_fieldWs = fieldWs,
						m_fieldListRoot = fieldListRoot
					};
				list.Add(mfiNew);
				m_fieldsById.Add(flid, mfiNew);
				return flid;
			}

			return 0;
		}
Ejemplo n.º 6
0
		/// <summary>
		/// Note a virtual property. The type is the simulated type, one of the original types,
		/// NOT with the virtual bit OR'd in.
		///</summary>
		/// <param name='bstrClass'> </param>
		/// <param name='bstrField'> </param>
		/// <param name='luFlid'> </param>
		/// <param name='type'> </param>
		public void AddVirtualProp(string bstrClass, string bstrField, int luFlid, int type)
		{
			var clsid = luFlid / 1000;
			var mfi = new MockFieldInfo
			{
				m_flid = luFlid,
				m_name = bstrField,
				m_cpt = (CellarPropertyType)type,
				m_destClsid = 0,
				m_fCustom = false,
				m_fieldHelp = null,
				m_fieldWs = WritingSystemServices.kwsAnal,
				m_fieldListRoot = Guid.Empty,
				m_isVirtual = true
			};
			m_fieldsById.Add(luFlid, mfi);
			List<MockFieldInfo> list;
			if (!m_fieldsByClassId.TryGetValue(clsid, out list))
			{
				list = new List<MockFieldInfo>();
				m_fieldsByClassId.Add(clsid, list);
			}
			list.Add(mfi);
		}