private void TestFeatureStructureContent(IFsFeatStruc featStruct)
        {
            IFdoOwningCollection <IFsFeatureSpecification> specCol = featStruct.FeatureSpecsOC;

            Assert.AreEqual(1, specCol.Count, "Count of top level feature specs");
            foreach (IFsFeatureSpecification spec in specCol)
            {
                IFsComplexValue complex = spec as IFsComplexValue;
                Assert.IsNotNull(complex, "complex feature value is null and should not be");
                Assert.AreEqual("subject agreement", complex.FeatureRA.Name.AnalysisDefaultWritingSystem.Text, "Expected complex feature name");
                IFsFeatStruc fsNested = complex.ValueOA as IFsFeatStruc;
                IFdoOwningCollection <IFsFeatureSpecification> fsNestedCol = fsNested.FeatureSpecsOC;
                Assert.AreEqual(2, fsNestedCol.Count, "Nested fs has one feature");
                foreach (IFsFeatureSpecification specNested in fsNestedCol)
                {
                    IFsClosedValue closed = specNested as IFsClosedValue;
                    Assert.IsNotNull(closed, "closed feature value is null and should not be");
                    if (!(((closed.FeatureRA.Name.AnalysisDefaultWritingSystem.Text == "gender") &&
                           (closed.ValueRA.Name.AnalysisDefaultWritingSystem.Text == "feminine gender")) ||
                          ((closed.FeatureRA.Name.AnalysisDefaultWritingSystem.Text == "person") &&
                           (closed.ValueRA.Name.AnalysisDefaultWritingSystem.Text == "first person"))))
                    {
                        Assert.Fail("Unexpected value found: {0}:{1}",
                                    closed.FeatureRA.Name.AnalysisDefaultWritingSystem.Text,
                                    closed.ValueRA.Name.AnalysisDefaultWritingSystem.Text);
                    }
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            System.Diagnostics.Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** ");
            // Must not be run more than once.
            if (IsDisposed)
            {
                return;
            }

            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }
                if (m_tvMasterList != null)
                {
                    m_tvMasterList.Dispose();
                }
            }
            m_cache        = null;
            m_selFeatDefn  = null;
            m_featureList  = null;
            m_mediator     = null;
            m_tvMasterList = null;

            base.Dispose(disposing);
        }
예제 #3
0
        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
            IFdoOwningCollection <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));
        }
예제 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="featSys"></param>
        /// <param name="mediator"></param>
        /// <param name="launchedFromInsertMenu"></param>
        /// <param name="sWindowKey">used to store location and size of dialog window</param>
        /// <param name="sXmlFile">file containing the XML form of the gloss list</param>
        public void SetDlginfo(IFsFeatureSystem featSys, Mediator mediator, bool launchedFromInsertMenu, string sWindowKey, string sXmlFile)
        {
            CheckDisposed();

            m_featureSystem          = featSys;
            m_featureList            = featSys.FeaturesOC;
            m_launchedFromInsertMenu = launchedFromInsertMenu;
            m_mediator = mediator;
            if (mediator != null)
            {
                m_sWindowKeyLocation = sWindowKey + "Location";
                m_sWindowKeySize     = sWindowKey + "Size";

                ResetWindowLocationAndSize();

                m_helpTopicProvider        = m_mediator.HelpTopicProvider;
                helpProvider               = new HelpProvider();
                helpProvider.HelpNamespace = m_helpTopicProvider.HelpFile;
                helpProvider.SetHelpKeyword(this, m_helpTopicProvider.GetHelpString(s_helpTopic));
                helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
            }
            m_cache = featSys.Cache;
            LoadMasterFeatures(sXmlFile);
            m_tvMasterList.Cache = m_cache;
        }
        public override void TestSetup()
        {
            base.TestSetup();

            m_hfSets = Cache.LanguageProject.LexDbOA.HeaderFooterSetsOC;
            IPublication pub = CreateFakeHFSets();

            m_dlg      = new DummyHeaderFooterSetupDlg(Cache, pub, Cache.LanguageProject.LexDbOA);
            m_pageInfo = new HFDialogsPageInfo(true);
            m_vc       = new DummyHFSetupDlgVC(m_pageInfo, Cache.DefaultVernWs, DateTime.Now, Cache);
        }
        public override void TestTearDown()
        {
            if (m_dlg != null)
            {
                m_dlg.Dispose();
                m_dlg = null;
            }
            m_hfSets   = null;
            m_pageInfo = null;

            base.TestTearDown();
        }
예제 #7
0
 public ObjectValuePartGenerator(FdoCache cache, XmlNode input, XmlVc vc, int rootClassId)
     : base(cache, input, vc, rootClassId)
 {
     m_objectPath = XmlUtils.GetAttributeValue(input, "objectPath");
     if (m_objectPath == null)
     {
         throw new ArgumentException("ObjectValuePartGenerator expects input to have objectPath attribute.");
     }
     // Enhance: generalize this
     if (m_objectPath == "PhFeatureSystem.Features")
     {
         m_collectionToGeneratePartsFrom = cache.LangProject.PhFeatureSystemOA.FeaturesOC;
         m_sortedCollection = from s in m_collectionToGeneratePartsFrom
                              orderby s.Abbreviation.BestAnalysisAlternative.Text
                              select s;
     }
 }
예제 #8
0
        /// ------------------------------------------------------------------------------------
        /// <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(IFdoOwningCollection <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 = TsPropsBldrClass.Create();

            style.Rules     = bldr.GetTextProps();
            style.IsBuiltIn = isBuiltIn;
            return(style);
        }
예제 #9
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Load all styles from the XML file and create styles in the database for them.
		/// </summary>
		/// <param name="progressDlg">The progress dialog.</param>
		/// <param name="parameters">The parameters. First parameter is the style objects
		/// (a FdoOwningCollection&lt;IStStyle&gt;), second is the styles (an XmlNode).</param>
		/// ------------------------------------------------------------------------------------
		protected object CreateStyles(IProgress progressDlg, params object[] parameters)
		{
			Debug.Assert(parameters.Length == 2);
			m_databaseStyles = (IFdoOwningCollection<IStStyle>)parameters[0];
			m_sourceStyles = (XmlNode)parameters[1];
			m_progressDlg = progressDlg;

			NonUndoableUnitOfWorkHelper.DoUsingNewOrCurrentUOW(m_cache.ActionHandlerAccessor, CreateStyles);

			return null;
		}
예제 #10
0
		/// <summary>
		///
		/// </summary>
		/// <param name="featSys"></param>
		/// <param name="mediator"></param>
		/// <param name="launchedFromInsertMenu"></param>
		/// <param name="sWindowKey">used to store location and size of dialog window</param>
		/// <param name="sXmlFile">file containing the XML form of the gloss list</param>
		public void SetDlginfo(IFsFeatureSystem featSys, Mediator mediator, bool launchedFromInsertMenu, string sWindowKey, string sXmlFile)
		{
			CheckDisposed();

			m_featureSystem = featSys;
			m_featureList = featSys.FeaturesOC;
			m_launchedFromInsertMenu = launchedFromInsertMenu;
			m_mediator = mediator;
			if (mediator != null)
			{
				m_sWindowKeyLocation = sWindowKey + "Location";
				m_sWindowKeySize = sWindowKey + "Size";

				ResetWindowLocationAndSize();

				m_helpTopicProvider = m_mediator.HelpTopicProvider;
				helpProvider = new HelpProvider();
				helpProvider.HelpNamespace = m_helpTopicProvider.HelpFile;
				helpProvider.SetHelpKeyword(this, m_helpTopicProvider.GetHelpString(s_helpTopic));
				helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
			}
			m_cache = featSys.Cache;
			LoadMasterFeatures(sXmlFile);
			m_tvMasterList.Cache = m_cache;
		}
예제 #11
0
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			System.Diagnostics.Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** ");
			// Must not be run more than once.
			if (IsDisposed)
				return;

			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			m_cache = null;
			m_selFeatDefn = null;
			m_featureList = null;
			m_mediator = null;

			base.Dispose( disposing );
		}
		public override void TestTearDown()
		{
			if (m_dlg != null)
			{
				m_dlg.Dispose();
				m_dlg = null;
			}
			m_hfSets = null;
			m_pageInfo = null;

			base.TestTearDown();
		}
		public override void TestSetup()
		{
			base.TestSetup();

			m_hfSets = Cache.LanguageProject.LexDbOA.HeaderFooterSetsOC;
			IPublication pub = CreateFakeHFSets();
			m_dlg = new DummyHeaderFooterSetupDlg(Cache, pub, Cache.LanguageProject.LexDbOA);
			m_pageInfo = new HFDialogsPageInfo(true);
			m_vc = new DummyHFSetupDlgVC(m_pageInfo, Cache.DefaultVernWs, DateTime.Now, Cache);
		}
예제 #14
0
		/// ------------------------------------------------------------------------------------
		/// <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(IFdoOwningCollection<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 = TsPropsBldrClass.Create();
			style.Rules = bldr.GetTextProps();
			style.IsBuiltIn = isBuiltIn;
			return style;
		}
예제 #15
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Save the in-memory mapping lists for the given mapping set
		/// </summary>
		/// <param name="mappingsOC">The owning collection of ScrMarkerMapping objects in the
		/// database</param>
		/// <param name="mappingInfoList">The in-memory list of ImportMappingInfo objects</param>
		/// ------------------------------------------------------------------------------------
		private void SaveMappings(IFdoOwningCollection<IScrMarkerMapping> mappingsOC, ScrMappingList mappingInfoList)
		{
			UndoableUnitOfWorkHelper.DoUsingNewOrCurrentUOW("Save mappings", "Save mappings",
				m_cache.ServiceLocator.GetInstance<IActionHandler>(), () =>
			{
				mappingsOC.Clear();
				foreach (ImportMappingInfo info in mappingInfoList)
				{
					IScrMarkerMapping mapping = Services.GetInstance<IScrMarkerMappingFactory>().Create();
					mappingsOC.Add(mapping);
					// The "Default Paragraph Characters" style is not a real style. So, we save it as
					// as separate target type. We want to set the style now for the in-memory info.
					if (info.StyleName == StyleUtils.DefaultParaCharsStyleName)
						info.MappingTarget = MappingTargetType.DefaultParaChars;
					else if (info.Style == null || info.Style.Name != info.StyleName)
						info.SetStyle(m_cache.LangProject.TranslatedScriptureOA.FindStyle(info.StyleName));
					((ScrMarkerMapping)mapping).InitFromImportMappingInfo(info);
				}
			});
		}
예제 #16
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Create a new style and add it to the Language Project stylesheet.
		/// </summary>
		/// <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">The user level.</param>
		/// <param name="styleCollection">The style collection.</param>
		/// <returns>The style</returns>
		/// ------------------------------------------------------------------------------------
		public IStStyle AddTestStyle(string name, ContextValues context, StructureValues structure,
			FunctionValues function, bool isCharStyle, int userLevel, IFdoOwningCollection<IStStyle> styleCollection)
		{
			return AddStyle(styleCollection, name, context, structure, function, isCharStyle, userLevel, true);
		}
예제 #17
0
		/// <summary>
		/// Make a slot which can be identified as the specified type.
		/// For this to be true, the slot must have an msa, owned by a LexEntry, which owns a form, which has
		/// the required type.
		/// </summary>
		IMoInflAffixSlot MakeSlot(IFdoServiceLocator services, IFdoOwningCollection<IMoInflAffixSlot> dest, Guid slotType)
		{
			var entry = services.GetInstance<ILexEntryFactory>().Create();
			var form = services.GetInstance<IMoAffixAllomorphFactory>().Create();
			entry.LexemeFormOA = form;
			form.MorphTypeRA = services.GetInstance<IMoMorphTypeRepository>().GetObject(slotType);
			var msa = services.GetInstance<IMoInflAffMsaFactory>().Create();
			entry.MorphoSyntaxAnalysesOC.Add(msa);
			var slot = services.GetInstance<IMoInflAffixSlotFactory>().Create();
			dest.Add(slot);
			msa.SlotsRC.Add(slot);
			// slot.Affixes.Add(msa); does not add it!
			return slot;
		}
예제 #18
0
		/// ------------------------------------------------------------------------------------
		/// <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 for a builtin style, otherwise, false.</param>
		/// <returns>The new created (and properly owned style.</returns>
		/// ------------------------------------------------------------------------------------
		public IStStyle Create(IFdoOwningCollection<IStStyle> styleList, string name,
			ContextValues context, StructureValues structure, FunctionValues function,
			bool isCharStyle, int userLevel, bool isBuiltin)
		{
			var retval = new StStyle();
			styleList.Add(retval);
			retval.Name = name;
			retval.Context = context;
			retval.Structure = structure;
			retval.Function = function;
			retval.Type = (isCharStyle ? StyleType.kstCharacter : StyleType.kstParagraph);
			retval.UserLevel = userLevel;
			retval.IsBuiltIn = isBuiltin;

			return retval;
		}
예제 #19
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Create a new style and add it to the Language Project stylesheet.
 /// </summary>
 /// <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">The user level.</param>
 /// <param name="styleCollection">The style collection.</param>
 /// <returns>The style</returns>
 /// ------------------------------------------------------------------------------------
 public IStStyle AddTestStyle(string name, ContextValues context, StructureValues structure,
                              FunctionValues function, bool isCharStyle, int userLevel, IFdoOwningCollection <IStStyle> styleCollection)
 {
     return(AddStyle(styleCollection, name, context, structure, function, isCharStyle, userLevel, true));
 }
예제 #20
0
		public ObjectValuePartGenerator(FdoCache cache, XmlNode input, XmlVc vc, int rootClassId)
			: base(cache, input, vc, rootClassId)
		{
			m_objectPath = XmlUtils.GetAttributeValue(input, "objectPath");
			if (m_objectPath == null)
				throw new ArgumentException("ObjectValuePartGenerator expects input to have objectPath attribute.");
			// Enhance: generalize this
			if (m_objectPath == "PhFeatureSystem.Features")
			{
				m_collectionToGeneratePartsFrom = cache.LangProject.PhFeatureSystemOA.FeaturesOC;
				m_sortedCollection = from s in m_collectionToGeneratePartsFrom
								 orderby s.Abbreviation.BestAnalysisAlternative.Text
								 select s;
			}
		}