/// <summary>
		/// Return the object (actually a possibility list) that owns the possible targets for the
		/// properties of a particular field of an RnGenericRec.
		/// </summary>
		public static ICmObject RnGenericRecReferenceTargetOwner(FdoCache cache, int flid)
		{
			switch (flid)
			{
				case RnGenericRecTags.kflidAnthroCodes:
					return cache.LanguageProject.AnthroListOA;
				case RnGenericRecTags.kflidConfidence:
					return cache.LanguageProject.ConfidenceLevelsOA;
				case RnGenericRecTags.kflidLocations:
					return cache.LanguageProject.LocationsOA;
				case RnGenericRecTags.kflidResearchers:
				case RnGenericRecTags.kflidSources:
					return cache.LanguageProject.PeopleOA;
				case RnGenericRecTags.kflidRestrictions:
					return cache.LanguageProject.RestrictionsOA;
				case RnGenericRecTags.kflidStatus:
					return cache.LanguageProject.StatusOA;
				case RnGenericRecTags.kflidTimeOfEvent:
					return cache.LanguageProject.TimeOfDayOA;
				case RnGenericRecTags.kflidType:
					return cache.LanguageProject.ResearchNotebookOA.RecTypesOA;
				case RnGenericRecTags.kflidParticipants:
					// This one is anomolous because it is an owning property of RnGenericRec.
					// However supporting it makes it easier to set up the ghost slice for participants
					// in the Text Info tab. The RnRoledPartic is something most users are not even aware of.
					// They choose items from the People list.
					return cache.LanguageProject.PeopleOA;
				default:
					return CmObjectReferenceTargetOwner(cache, flid);
			}
		}
Exemplo n.º 2
0
		/// <summary>
		/// Get the destination class for the specified flid, as used in bulk edit. For this purpose
		/// we need to override the destination class of the fields that have ghost parent helpers,
		/// since the properties hold a mixture of classes and therefore have CmObject as their
		/// signature, but the bulk edit code needs to treat them as having the class they primarily contain.
		/// </summary>
		/// <param name="cache"></param>
		/// <param name="listFlid"></param>
		/// <returns></returns>
		public static int GetBulkEditDestinationClass(FdoCache cache, int listFlid)
		{
			int destClass = cache.GetDestinationClass(listFlid);
			if (destClass == 0)
			{
				// May be a special "ghost" property used for bulk edit operations which primarily contains,
				// say, example sentences, but also contains senses and entries so we can bulk edit to senses
				// with no examples and entries with no senses.
				// We don't want to lie to the MDC, but here, we need to treat these properties as having the
				// primary destination class.
				switch (cache.MetaDataCacheAccessor.GetFieldName(listFlid))
				{
					case "AllExampleSentenceTargets":
						return LexExampleSentenceTags.kClassId;
					case "AllPossiblePronunciations":
						return LexPronunciationTags.kClassId;
					case "AllPossibleAllomorphs":
						return MoFormTags.kClassId;
					case "AllExampleTranslationTargets":
						return CmTranslationTags.kClassId;
					case "AllComplexEntryRefPropertyTargets":
					case "AllVariantEntryRefPropertyTargets":
						return LexEntryRefTags.kClassId;
				}
			}
			return destClass;
		}
Exemplo n.º 3
0
		/// <summary>
		/// Find (create, if needed) a wordform for the given ITsString.
		/// </summary>
		/// <param name="cache"></param>
		/// <param name="tssContents">The form to find.</param>
		/// <returns>A wordform with the given form.</returns>
		public static IWfiWordform FindOrCreateWordform(FdoCache cache, ITsString tssContents)
		{
			IWfiWordform wf;
			if (!cache.ServiceLocator.GetInstance<IWfiWordformRepository>().TryGetObject(tssContents, out wf))
				wf = cache.ServiceLocator.GetInstance<IWfiWordformFactory>().Create(tssContents);
			return wf;
		}
Exemplo n.º 4
0
		public SemDomSearchEngine(FdoCache cache)
		{
			if (cache == null)
				throw new ApplicationException("Can't search domains without a cache.");

			m_semdomRepo = cache.ServiceLocator.GetInstance<ICmSemanticDomainRepository>();
		}
Exemplo n.º 5
0
		/// <summary>
		/// This method will check if the project is an fwdata project, that can be locked.
		/// </summary>
		/// <param name="cache"></param>
		/// <returns>true if the IDataStorer is an XMLBackendProvider, false otherwise.</returns>
		public static bool CanLockProject(FdoCache cache)
		{
			var ds = cache.ServiceLocator.GetInstance<IDataStorer>() as XMLBackendProvider;
			if (ds != null)
				return false;
			return true;
		}
Exemplo n.º 6
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Import a file containing translations for one or more lists.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public bool ImportTranslatedLists(string filename, FdoCache cache, IProgress progress)
		{
#if DEBUG
			DateTime dtBegin = DateTime.Now;
#endif
			using (var inputStream = FileUtils.OpenStreamForRead(filename))
			{
				var type = Path.GetExtension(filename).ToLowerInvariant();
				if (type == ".zip")
				{
					using (var zipStream = new ZipInputStream(inputStream))
					{
						var entry = zipStream.GetNextEntry(); // advances it to where we can read the one zipped file.
						using (var reader = new StreamReader(zipStream, Encoding.UTF8))
							ImportTranslatedLists(reader, cache, progress);
					}
				}
				else
				{
					using (var reader = new StreamReader(inputStream, Encoding.UTF8))
						ImportTranslatedLists(reader, cache, progress);
				}
			}
#if DEBUG
			DateTime dtEnd = DateTime.Now;
			TimeSpan span = new TimeSpan(dtEnd.Ticks - dtBegin.Ticks);
			Debug.WriteLine(String.Format("Elapsed time for loading translated list(s) from {0} = {1}",
				filename, span.ToString()));
#endif
			return true;
		}
		internal SharedXMLBackendProvider(FdoCache cache, IdentityMap identityMap, ICmObjectSurrogateFactory surrogateFactory, IFwMetaDataCacheManagedInternal mdc,
			IDataMigrationManager dataMigrationManager, IFdoUI ui, IFdoDirectories dirs, FdoSettings settings)
			: base(cache, identityMap, surrogateFactory, mdc, dataMigrationManager, ui, dirs, settings)
		{
			m_peerProcesses = new Dictionary<int, Process>();
			m_peerID = Guid.NewGuid();
		}
Exemplo n.º 8
0
		public void DestroyTestCache()
		{
			if (m_cache != null)
			{
				m_cache.Dispose();
				m_cache = null;
			}
		}
Exemplo n.º 9
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Make one for converting the specified paragraph.
		/// </summary>
		/// <param name="para">The paragraph.</param>
		/// <param name="wsBt">The writing system for which to do the conversion.</param>
		/// ------------------------------------------------------------------------------------
		private BtConverter(IStTxtPara para, int wsBt)
		{
			m_para = para;
			m_cache = para.Cache;
			m_cpe = m_cache.ServiceLocator.UnicodeCharProps;
			m_scr = para.Cache.LangProject.TranslatedScriptureOA;
			m_wsBt = wsBt;
		}
			internal AnalysisGuessBaseSetup(FdoCache cache, params Flags[] options)
				: this(cache)
			{
				if (options.Contains(Flags.PartsOfSpeech))
					SetupPartsOfSpeech();
				if (options.Contains(Flags.VariantEntryTypes))
					SetupVariantEntryTypes();
			}
Exemplo n.º 11
0
		/// <summary>
		/// This method will lock the current project in the cache given this service
		/// </summary>
		public static void LockCurrentProject(FdoCache cache)
		{
			//Make sure all the changes the user has made are on the disc before we begin.
			// Make sure any changes we want backup are saved.
			var ds = cache.ServiceLocator.GetInstance<IDataStorer>() as XMLBackendProvider;
			if (ds != null)
				ds.LockProject();
		}
		protected ClientServerBackendProvider(FdoCache cache,
			IdentityMap identityMap,
			ICmObjectSurrogateFactory surrogateFactory,
			IFwMetaDataCacheManagedInternal mdc,
			IDataMigrationManager dataMigrationManager,
			IFdoUI ui, IFdoDirectories dirs, FdoSettings settings) : base(cache, identityMap, surrogateFactory, mdc, dataMigrationManager, ui, dirs, settings)
		{
		}
			internal AnalysisGuessBaseSetup(FdoCache cache) : this()
			{
				Cache = cache;
				UserAgent = Cache.LanguageProject.DefaultUserAgent;
				ParserAgent = Cache.LangProject.DefaultParserAgent;
				GuessServices = new AnalysisGuessServices(Cache);
				EntryFactory = Cache.ServiceLocator.GetInstance<ILexEntryFactory>();
				DoDataSetup();
			}
Exemplo n.º 14
0
		/// <summary>
		/// Indicates if there are multiple applications that are currently using this project.
		/// </summary>
		public static bool AreMultipleApplicationsConnected(FdoCache cache)
		{
			if (cache == null) // Can happen when creating a new project and adding a new writing system. (LT-15624)
				return false;

			var sharedBep = cache.ServiceLocator.GetInstance<IDataStorer>() as SharedXMLBackendProvider;
			if (sharedBep != null)
				return sharedBep.OtherApplicationsConnectedCount > 0;
			return false;
		}
Exemplo n.º 15
0
		/// <summary>
		/// Constructor.
		/// </summary>
		/// <remarks>
		/// This Constructor is used for lazy load cases.
		/// The stored XML string (from the data store) is used to instantiate m_object.
		/// </remarks>
		internal CmObjectSurrogate(FdoCache cache, byte[] xmlData)
		{
			if (cache == null) throw new ArgumentNullException("cache");
			if (xmlData == null) throw new ArgumentNullException("xmlData");

			m_cache = cache;
			m_object = null;
			RawXmlBytes = xmlData;
			SetBasics();
		}
Exemplo n.º 16
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Gets a resource matching the specified name from the Owning object from a collection
		/// of resources specified by the field id.
		/// </summary>
		/// <param name="cache">database</param>
		/// <param name="hvoOwner">id of the owning object</param>
		/// <param name="flid">field id in the owning object</param>
		/// <param name="name">name of the specified resource</param>
		/// <returns>resource with the specified name</returns>
		/// ------------------------------------------------------------------------------------
		public static CmResource GetResource(FdoCache cache, int hvoOwner, int flid, string name)
		{
			FdoOwningCollection<ICmResource> resources =
				new FdoOwningCollection<ICmResource>(cache, hvoOwner, flid);
			foreach (CmResource resource in resources)
			{
				if (resource.Name.Equals(name))
					return resource;
			}
			return null;
		}
Exemplo n.º 17
0
		internal SharedXMLBackendProvider(FdoCache cache, IdentityMap identityMap, ICmObjectSurrogateFactory surrogateFactory, IFwMetaDataCacheManagedInternal mdc,
			IDataMigrationManager dataMigrationManager, IFdoUI ui, IFdoDirectories dirs, FdoSettings settings)
			: base(cache, identityMap, surrogateFactory, mdc, dataMigrationManager, ui, dirs, settings)
		{
			m_peerProcesses = new Dictionary<int, Process>();
			m_peerID = Guid.NewGuid();
#if __MonoCS__
			// /dev/shm is not guaranteed to be available on all systems, so fall back to temp
			m_commitLogDir = Directory.Exists("/dev/shm") ? "/dev/shm" : Path.GetTempPath();
#endif
		}
Exemplo n.º 18
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="StTxtParaBldr"/> class.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public StTxtParaBldr(FdoCache cache)
		{
			System.Diagnostics.Debug.Assert(cache != null);
			m_cache = cache;

			ITsStrFactory tsStringFactory = cache.TsStrFactory;
			m_ParaStrBldr = tsStringFactory.GetBldr();

			// Give the builder a default WS so a created string will be legal. If any text
			// is added to the builder, it should replace this WS with the correct WS.
			m_ParaStrBldr.Replace(0, 0, null, StyleUtils.CharStyleTextProps(null, cache.DefaultVernWs));
		}
		/// <summary>
		/// Actually do the test between the source data in 'sourceGuids'
		/// and the target data in 'targetCache'.
		/// </summary>
		/// <param name="sourceGuids"></param>
		/// <param name="targetCache"></param>
		private static void CompareResults(ICollection<Guid> sourceGuids, FdoCache targetCache)
		{
			var allTargetObjects = GetAllCmObjects(targetCache);
			foreach (var obj in allTargetObjects)
				Assert.IsTrue(sourceGuids.Contains(obj.Guid), "Missing guid in target DB.: " + obj.Guid);
			var targetGuids = allTargetObjects.Select(obj => obj.Guid).ToList();
			foreach (var guid in sourceGuids)
			{
				Assert.IsTrue(targetGuids.Contains(guid), "Missing guid in source DB.: " + guid);
			}
			Assert.AreEqual(sourceGuids.Count, allTargetObjects.Length, "Wrong number of objects in target DB.");
		}
Exemplo n.º 20
0
		/// <summary>
		/// Constructor for new search strategy.
		/// </summary>
		/// <param name="cache"></param>
		protected SemDomSearchStrategy(FdoCache cache)
		{
			Cache = cache;
			m_appropriateCulture = GetAppropriateCultureInfo();
			// Starting after whitespace or the beginning of a line, finds runs of either letters or
			// singlequote or hyphen followed by either whitespace or the end of a line.
			// The first look-ahead, (?=\w), means that single quote and hyphen are only included
			// if there is an adjacent following letter, that is, if they occur word-medially.
			WordParsingRegex = new Regex(@"(?<=(^|\s))(\w|['-](?=\w))*(?=(\s|,|$))");

			SetupSearchResults();
		}
Exemplo n.º 21
0
		/// <summary>
		/// This method will unlock the current project in the cache given this service.
		/// </summary>
		public static void UnlockCurrentProject(FdoCache cache)
		{

			//Make sure all the changes the user has made are on the disc before we begin.
			// Make sure any changes we want backup are saved.
			var ds = cache.ServiceLocator.GetInstance<IDataStorer>() as XMLBackendProvider;
			if (ds != null)
			{
				cache.ServiceLocator.GetInstance<IUndoStackManager>().Save();
				ds.CompleteAllCommits();
				ds.UnlockProject();
			}
		}
Exemplo n.º 22
0
		/// <summary>
		/// Create an (uninitialized) cache of Semantic Domains by word string and writing system
		/// integer to provide quick searching for multiple keys (bulk edit of the
		/// LexSense.SemanticDomains collection; Suggest button).
		/// </summary>
		/// <param name="cache">FdoCache</param>
		public SemDomSearchCache(FdoCache cache)
		{
			CacheIsInitialized = false;
			m_cache = cache;
			m_semDomRepo = m_cache.ServiceLocator.GetInstance<ICmSemanticDomainRepository>();
			m_semDomCache = new Dictionary<Tuple<string, int>, HashSet<ICmSemanticDomain>>();
			m_appropriateCulture = GetAppropriateCultureInfo();
			// Starting after whitespace or the beginning of a line, finds runs of either letters or
			// singlequote or hyphen followed by either whitespace or the end of a line.
			// The first look-ahead, (?=\w), means that single quote and hyphen are only included
			// if there is an adjacent following letter, that is, if they occur word-medially.
			m_wordParsingRegex = new Regex(@"(?<=(^|\s))(\w|['-](?=\w))*(?=(\s|,|$))");
		}
Exemplo n.º 23
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="cache">The cache.</param>
		/// <param name="backupInfo">The backup info.</param>
		/// <param name="destFolder">The destination folder.</param>
		/// ------------------------------------------------------------------------------------
		public BackupProjectSettings(FdoCache cache, IBackupInfo backupInfo, string destFolder) :
			this(Path.GetDirectoryName(cache.ProjectId.ProjectFolder), cache.ProjectId.Name,
			cache.LanguageProject.LinkedFilesRootDir, cache.ProjectId.SharedProjectFolder,
			cache.ProjectId.Type, destFolder)
		{
			if (backupInfo != null)
			{
				Comment = backupInfo.Comment;
				IncludeConfigurationSettings = backupInfo.IncludeConfigurationSettings;
				IncludeLinkedFiles = backupInfo.IncludeLinkedFiles;
				IncludeSupportingFiles = backupInfo.IncludeSupportingFiles;
				IncludeSpellCheckAdditions = backupInfo.IncludeSpellCheckAdditions;
			}
		}
Exemplo n.º 24
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Import a file (encapsulated by a TextReader) containing translations for one or more lists.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public bool ImportTranslatedLists(TextReader reader, FdoCache cache, IProgress progress)
		{
			m_cache = cache;
			m_mdc = cache.ServiceLocator.GetInstance<IFwMetaDataCacheManaged>();
			m_rgItemClasses = m_mdc.GetAllSubclasses(CmPossibilityTags.kClassId);
			m_wsf = cache.WritingSystemFactory;
			m_wsEn = GetWsFromStr("en");
			Debug.Assert(m_wsEn != 0);
			m_progress = progress;

			using (var xreader = XmlReader.Create(reader))
				Import(xreader);

			return true;
		}
Exemplo n.º 25
0
		//	protected string m_helpId;

		/// <summary>
		/// constructor using a simple string explanation.
		/// Often, work is needed to make (and/or remove) an annotation related to this constraint.
		/// If so, there are two usage patterns, depending on how important it is to avoid making database changes
		/// if nothing changed.
		///
		/// The simple pattern:
		/// ConstraintFailure.RemoveObsoleteAnnotations(obj);
		/// if (there's a problem)
		///	{
		///		var failure = new ConstraintFailure(...);
		///		failure.MakeAnnotation();
		/// }
		///
		/// The more complex pattern:
		///
		/// var anyChanges = false;
		/// ConstraintFailure failure = null;
		/// if (there's a problem)
		/// {
		///		failure = new ConstraintFailure(...);
		///		anyChanges = failure.IsAnnotationCorrect();
		/// }
		/// else
		///		anyChanges = ConstraintFailure.AreThereObsoleteChanges(obj);
		/// if (anyChanges)
		/// {
		///		...wrap in a UOW...
		///		ConstraintFailure.RemoveObsoleteAnnotations(obj);
		///		if (failure != null)
		///			failure.MakeAnnotation();
		/// }
		/// </summary>
		public ConstraintFailure(ICmObject problemObject, int flid, string explanation)
		{
			m_cache = problemObject.Cache;
			m_object = problemObject;
			m_flid = flid;
			m_explanation = explanation;
//			m_explanation = new StText();
//			StTxtParaBldr paraBldr = new StTxtParaBldr(m_cache);
//			//review: I have no idea what this is as to be
//			paraBldr.ParaProps = StyleUtils.ParaStyleTextProps("Paragraph");
//			//todo: this pretends that the default analysis writing system is also the user interface 1.
//			//but I don't really know what's the right thing to do.
//			paraBldr.AppendRun(m_explanation, StyleUtils.CharStyleTextProps(null, m_cache.DefaultAnalWs));
//			paraBldr.CreateParagraph(annotation.TextOAHvo);
		}
Exemplo n.º 26
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Sets a resource matching the specified name from the Owning object from a collection
		/// of resources specified by the field id.
		/// </summary>
		/// <param name="cache">database</param>
		/// <param name="hvoOwner">id of the owning object</param>
		/// <param name="flid">field id in the owning object</param>
		/// <param name="name">name of the specified resource</param>
		/// <param name="newVersion">new version number for the resource</param>
		/// ------------------------------------------------------------------------------------
		public static void SetResource(FdoCache cache, int hvoOwner, int flid, string name,
			Guid newVersion)
		{
			CmResource resource = GetResource(cache, hvoOwner, flid, name);
			if (resource == null)
			{
				// Resource does not exist yet. Add it to the collection.
				FdoOwningCollection<ICmResource> resources =
					new FdoOwningCollection<ICmResource>(cache, hvoOwner, flid);
				CmResource newResource = new CmResource();
				resources.Add(newResource);
				newResource.Name = name;
				newResource.Version = newVersion;
				return;
			}

			resource.Version = newVersion;
		}
Exemplo n.º 27
0
		/// <summary>
		/// Return the object (actually a possibility list) that owns the possible targets for the
		/// properties a particular field of of a CmObject (if any). This only handles the default,
		/// that is, any custom fields. Some more specific method should be used (perhaps created)
		/// if you need the object for some real field.
		/// </summary>
		public static ICmObject CmObjectReferenceTargetOwner(FdoCache cache, int flid)
		{
			var mdc = cache.ServiceLocator.GetInstance<IFwMetaDataCacheManaged>();
			if (mdc.IsCustom(flid))
			{
				Guid listGuid = mdc.GetFieldListRoot(flid);
				if (listGuid != Guid.Empty)
					return cache.ServiceLocator.GetInstance<ICmPossibilityListRepository>().GetObject(listGuid);
			}

			// Is this the best default? It clearly indicates that no target is known.
			// However, the default implementation of ReferenceTargetCandidates returns the
			// current contents of the list. It would be consistent with that for this method
			// to return 'this'. But that would seldom be useful (the user is presumably
			// already editing 'this'), and would require overrides wherever there is
			// definitely NO sensible object to jump to and edit. On the whole I (JohnT) think
			// it is best to make null the default.
			return null;
		}
Exemplo n.º 28
0
		public void CreateTestCache()
		{
			m_now = DateTime.Now;
			m_cache = FdoCache.CreateCacheWithNewBlankLangProj(
				new TestProjectId(FDOBackendProviderType.kMemoryOnly, "MemoryOnly.mem"), "en", "fr", "en", new DummyFdoUI(),
				FwDirectoryFinder.FdoDirectories, new FdoSettings());
			IDataSetup dataSetup = m_cache.ServiceLocator.GetInstance<IDataSetup>();
			dataSetup.LoadDomain(BackendBulkLoadDomain.All);
			if (m_cache.LangProject != null)
			{
				if (m_cache.LangProject.DefaultVernacularWritingSystem == null)
				{
					List<IWritingSystem> rglgws = m_cache.ServiceLocator.WritingSystemManager.LocalWritingSystems.ToList();
					if (rglgws.Count > 0)
					{
						m_cache.DomainDataByFlid.BeginNonUndoableTask();
						m_cache.LangProject.DefaultVernacularWritingSystem = rglgws[rglgws.Count - 1];
						m_cache.DomainDataByFlid.EndNonUndoableTask();
					}
				}
			}
		}
Exemplo n.º 29
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="T:DummyMainLazyViewVc"/> class.
 /// </summary>
 /// <param name="cache">The cache.</param>
 /// <param name="fParaWithContent">set to <c>true</c> to add paragraphs with contents,
 /// otherwise just add rectangles instead.</param>
 /// ------------------------------------------------------------------------------------
 public DummyMainLazyViewVc(FdoCache cache, bool fParaWithContent)
 {
     m_cache            = cache;
     m_wsDefault        = m_cache.DefaultVernWs;
     m_fParaWithContent = fParaWithContent;
 }
Exemplo n.º 30
0
        public void     PrintCmPossibility(FdoCache fcTLP)
        {
            CmPossibility p = new CmPossibility(fcTLP, 190);

            Console.WriteLine(p.Description.AnalysisDefaultWritingSystem);
        }
Exemplo n.º 31
0
 /// -----------------------------------------------------------------------------------
 /// <summary>
 /// Bogus implementation
 /// </summary>
 ///
 /// <param name="cache">Instance of the FW Data Objects cache that the new main window
 /// will use for accessing the database.</param>
 /// <param name="fNewCache">Flag indicating whether one-time, application-specific
 /// initialization should be done for this cache.</param>
 /// <param name="wndCopyFrom"> Must be null for creating the original app window.
 /// Otherwise, a reference to the main window whose settings we are copying.</param>
 /// <param name="fOpeningNewProject"><c>true</c> if opening a brand spankin' new
 /// project</param>
 /// <returns>New instance of DummyFwMainWnd</returns>
 /// -----------------------------------------------------------------------------------
 protected override Form NewMainAppWnd(FdoCache cache, bool fNewCache, Form wndCopyFrom,
                                       bool fOpeningNewProject)
 {
     throw new Exception("NewMainAppWnd Not implemented");
 }
Exemplo n.º 32
0
 /// <summary>
 /// Make one and set the other stuff later.
 /// </summary>
 /// <param name="cache"></param>
 internal TestCCLogic(FdoCache cache) : base(cache)
 {
     m_isRtL = false;
 }
Exemplo n.º 33
0
 public override void SetDlgInfo(FdoCache cache, WindowParams wp, Mediator mediator, string form)
 {
     SetDlgInfo(cache, wp, mediator, form, cache.DefaultAnalWs);
 }
Exemplo n.º 34
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 ///
 /// </summary>
 /// <param name="cache"></param>
 /// ------------------------------------------------------------------------------------
 public LexEntryVc(FdoCache cache)
     : base(cache)
 {
     m_ws = cache.DefaultVernWs;
 }
Exemplo n.º 35
0
 public InterlinPrintVc(FdoCache cache) : base(cache)
 {
 }
Exemplo n.º 36
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="DummyLazyPrintConfigurer"/> class.
 /// </summary>
 /// <param name="cache">The cache.</param>
 /// <param name="fAddSubordinateStreams">If set to <c>true</c> add subordinate streams</param>
 /// <param name="fAddContent">If set to <c>true</c> add content, otherwise add rectangle
 /// instead of paragraph.</param>
 /// ------------------------------------------------------------------------------------
 public DummyLazyPrintConfigurer(FdoCache cache, bool fAddSubordinateStreams,
                                 bool fAddContent) : base(cache, null)
 {
     m_fAddSubordinateStreams = fAddSubordinateStreams;
     m_fAddContent            = fAddContent;
 }
Exemplo n.º 37
0
 /// -----------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="FilterScrSectionDialog"/> class.
 /// </summary>
 /// <param name="cache"></param>
 /// <param name="hvoList">A list of books to check as an array of hvos</param>
 /// -----------------------------------------------------------------------------------
 public FilterScrSectionDialog(FdoCache cache, int[] hvoList)
     : base(cache, hvoList)
 {
     InitializeComponent();
     m_helpTopicId = "khtpScrSectionFilter";
 }
Exemplo n.º 38
0
 /// <summary>
 /// </summary>
 /// <param name="cache"></param>
 /// <param name="mediator"></param>
 /// <param name="componentLexeme">the entry we wish to find or create a variant for.</param>
 public void SetDlgInfo(FdoCache cache, Mediator mediator, IVariantComponentLexeme componentLexeme)
 {
     SetDlgInfoForComponentLexeme(cache, mediator, componentLexeme);
 }
Exemplo n.º 39
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="LocationTrackerImpl"/> class.
 /// </summary>
 /// <param name="diffView">The diff view</param>
 /// <param name="cache">The cache.</param>
 /// ------------------------------------------------------------------------------------
 public DiffViewLocationTracker(DiffView diffView, FdoCache cache) : base(cache, 0)
 {
     m_diffView = diffView;
 }
Exemplo n.º 40
0
        /// <summary>
        /// Initialize an Concorder dlg.
        /// </summary>
        /// <param name="xwindow">The main window for this modeless dlg.</param>
        /// <param name="configurationNode">The XML node to control the ConcorderControl.</param>
        internal void SetDlgInfo(XWindow xwindow, XmlNode configurationNode)
        {
            CheckDisposed();

            if (xwindow == null)
            {
                throw new ArgumentNullException("Main window is missing.");
            }

            if (m_myOwnPrivateMediator != null)
            {
                throw new InvalidOperationException("It is not legal to call this method more than once.");
            }

            m_xwindow = xwindow;
            m_cache   = m_xwindow.Mediator.PropertyTable.GetValue("cache") as FdoCache;
            m_myOwnPrivateMediator = new Mediator();
            // The extension XML files should be stored in the data area, not in the code area.
            // This reduces the need for users to have administrative privileges.
            string dir = DirectoryFinder.GetFWDataSubDirectory(@"Language Explorer\Configuration\Extensions\Concorder");

            m_myOwnPrivateMediator.StringTbl = new StringTable(dir);
            m_myOwnPrivateMediator.PropertyTable.SetProperty("cache", m_cache, false);
            m_myOwnPrivateMediator.PropertyTable.SetPropertyPersistence("cache", false);
            m_myOwnPrivateMediator.PropertyTable.SetPropertyDispose("cache", false);
            m_myOwnPrivateMediator.SpecificToOneMainWindow = true;
            //FwStyleSheet styleSheet = m_xwindow.Mediator.PropertyTable.GetValue("FwStyleSheet") as FwStyleSheet;
            //m_myOwnPrivateMediator.PropertyTable.SetProperty("FwStyleSheet", styleSheet);
            //m_myOwnPrivateMediator.PropertyTable.SetPropertyPersistence("FwStyleSheet", false);
            //m_myOwnPrivateMediator.PropertyTable.SetPropertyPersistence("FwStyleSheet", false);
            List <ConcorderControl.FindComboFillerBase> fcfList = new List <ConcorderControl.FindComboFillerBase>();

            ConcorderControl.FindComboFillerBase fcf = null;

            // Find: main POS:
            // UsedBy:  MSAs, senses, entries, analyses (x2), wordforms, compound rules
            fcf = new ConcorderControl.FindPossibilityComboFiller(m_cache.LangProject.PartsOfSpeechOA);
            fcf.Init(m_myOwnPrivateMediator, configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcGrammaticalCategory']"));
            fcfList.Add(fcf);

            // Find: sense
            // UsedBy: Analyses, Sentences
            fcf = new ConcorderControl.FindComboFiller();
            fcf.Init(m_myOwnPrivateMediator, configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcSense']"));
            fcfList.Add(fcf);

/*
 *                      // Find: allomorph (main and alternates)
 *                      // UsedBy: Analyses, Sentences, Ad hoc rules
 *                      fcf = new ConcorderControl.FindComboFiller();
 *                      fcf.Init(m_myOwnPrivateMediator, configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcAllomorph']"));
 *                      fcfList.Add(fcf);
 *
 *                      // Find: entry
 *                      // UsedBy: Analyses, Sentences
 *                      fcf = new ConcorderControl.FindComboFiller();
 *                      fcf.Init(m_myOwnPrivateMediator, configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcEntry']"));
 *                      fcfList.Add(fcf);
 *
 *                      // Find: Wordform
 *                      // UsedBy: Sentences
 *                      fcf = new ConcorderControl.FindComboFiller();
 *                      fcf.Init(m_myOwnPrivateMediator, configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcWordform']"));
 *                      fcfList.Add(fcf);
 *
 *                      //// Find: MSA
 *                      //// UsedBy: Senses, Analyses, Sentences
 *                      //fcf = new ConcorderControl.FindComboFiller();
 *                      //fcf.Init(m_myOwnPrivateMediator, configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcGrammaticalFunction']"));
 *                      //fcfList.Add(fcf);
 *
 *                      //// Find: Analysis
 *                      //// UsedBy: Sentences
 *                      //fcf = new ConcorderControl.FindComboFiller();
 *                      //fcf.Init(m_myOwnPrivateMediator, configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcAnalysis']"));
 *                      //fcfList.Add(fcf);
 *
 *                      //// Find: Environment
 *                      //// UsedBy: Allomorphs
 *                      //fcf = new ConcorderControl.FindComboFiller();
 *                      //fcf.Init(m_myOwnPrivateMediator, configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcEnvironment']"));
 *                      //fcfList.Add(fcf);
 *
 *                      //// Find: Word-level gloss
 *                      //// UsedBy: Sentences
 *                      //fcf = new ConcorderControl.FindComboFiller();
 *                      //fcf.Init(m_myOwnPrivateMediator, configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcWordLevelGloss']"));
 *                      //fcfList.Add(fcf);
 *
 *                      // Find: Phonemes
 *                      // UsedBy:
 *
 *                      // Find: Natural Classes
 *                      // UsedBy:
 *
 *                      // Find: Features
 *                      // UsedBy:
 *
 *                      // Find: Exception Features
 *                      // UsedBy:
 *
 * //			// Find: eng rev POS
 * //			// UsedBy: rev entries
 * //			ubfList = new List<ConcorderControl.UsedByFiller>();
 * //			fcfConfigNode = configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcXX']");
 * //			fcf = new ConcorderControl.FindComboFiller("Grammatical Category: English Reversal", ubfList);
 * //			fcfList.Add(fcf);
 * //			ubfList.Add(new ConcorderControl.UsedByFiller("Reversal Entries" ));
 *
 * //			// Find: spn rev POS
 * //			// UsedBy: rev entries
 * //			ubfList = new List<ConcorderControl.UsedByFiller>();
 * //			fcfConfigNode = configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcXX']");
 * //			fcf = new ConcorderControl.FindComboFiller("Grammatical Category: Spanish Reversal", ubfList);
 * //			fcfList.Add(fcf);
 * //			ubfList.Add(new ConcorderControl.UsedByFiller("Reversal Entries" ));
 *
 *                      //// Find: Academic Domain
 *                      //// UsedBy: Senses
 *                      //ubfList = new List<ConcorderControl.UsedByFiller>();
 *                      //fcf = new ConcorderControl.FindPossibilityComboFiller(
 *                      //    configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcAcademicDomain']"),
 *                      //    ubfList,
 *                      //    m_cache.LangProject.LexDbOA.DomainTypesOA);
 *                      //fcfList.Add(fcf);
 *                      //ubfList.Add(new ConcorderControl.UsedByFiller(
 *                      //    configurationNode.SelectSingleNode("targetcontrols/control[@id='Senses']")));
 *
 *                      //// Find: Anthropology Category
 *                      //// UsedBy: Senses
 *                      //ubfList = new List<ConcorderControl.UsedByFiller>();
 *                      //fcf = new ConcorderControl.FindPossibilityComboFiller(
 *                      //    configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcAnthropologyCategory']"),
 *                      //    ubfList,
 *                      //    m_cache.LangProject.AnthroListOA);
 *                      //fcfList.Add(fcf);
 *                      //ubfList.Add(new ConcorderControl.UsedByFiller(
 *                      //    configurationNode.SelectSingleNode("targetcontrols/control[@id='Senses']")));
 *
 *                      // Find: Confidence Level
 *                      // UsedBy:
 *
 *                      // Find: Education Level
 *                      // UsedBy:
 *
 *                      //// Find: Entry Type
 *                      //// UsedBy: Entries
 *                      //ubfList = new List<ConcorderControl.UsedByFiller>();
 *                      //fcf = new ConcorderControl.FindPossibilityComboFiller(
 *                      //    configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcEntryType']"),
 *                      //    ubfList,
 *                      //    m_cache.LangProject.LexDbOA.EntryTypesOA);
 *                      //fcfList.Add(fcf);
 *                      //ubfList.Add(new ConcorderControl.UsedByFiller(
 *                      //    configurationNode.SelectSingleNode("targetcontrols/control[@id='Entries']")));
 *
 *                      // Find: Feature Type
 *                      // UsedBy:
 *
 *                      // Find: Lexical Reference Type
 *                      // UsedBy:
 *
 *                      // Find: Location
 *                      // UsedBy:
 *
 *                      // Find: Minor Entry Condition
 *                      // UsedBy: Entries
 *                      //ubfList = new List<ConcorderControl.UsedByFiller>();
 *                      //// TODO: Where is its pos list?
 *                      //fcf = new ConcorderControl.FindComboFiller(
 *                      //    configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcMinorEntryCondition']"),
 *                      //    ubfList);
 *                      //fcfList.Add(fcf);
 *                      //ubfList.Add(new ConcorderControl.UsedByFiller("Entries" ));
 *
 *                      //// Find: Morpheme Type
 *                      //// UsedBy: Allomorphs
 *                      //ubfList = new List<ConcorderControl.UsedByFiller>();
 *                      //fcf = new ConcorderControl.FindPossibilityComboFiller(
 *                      //    configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcMorphemeType']"),
 *                      //    ubfList,
 *                      //    m_cache.LangProject.LexDbOA.MorphTypesOA);
 *                      //fcfList.Add(fcf);
 *                      //ubfList.Add(new ConcorderControl.UsedByFiller(
 *                      //    configurationNode.SelectSingleNode("targetcontrols/control[@id='Allomorphs']")));
 *
 *                      // Find: People
 *                      // UsedBy:
 *
 *                      // Find: Positions
 *                      // UsedBy:
 *
 *                      // Find: Restrictions
 *                      // UsedBy:
 *
 *                      //// Find: Semantic Domain
 *                      //// UsedBy: Senses
 *                      //ubfList = new List<ConcorderControl.UsedByFiller>();
 *                      //fcf = new ConcorderControl.FindPossibilityComboFiller(
 *                      //    configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcSemanticDomain']"),
 *                      //    ubfList,
 *                      //    m_cache.LangProject.SemanticDomainListOA);
 *                      //fcfList.Add(fcf);
 *                      //ubfList.Add(new ConcorderControl.UsedByFiller(
 *                      //    configurationNode.SelectSingleNode("targetcontrols/control[@id='Senses']")));
 *
 *                      // Find: Sense Status
 *                      // UsedBy: Senses
 *                      //ubfList = new List<ConcorderControl.UsedByFiller>();
 *                      //// TODO: Where is the pos list?
 *                      //fcf = new ConcorderControl.FindComboFiller(
 *                      //    configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcSenseStatus']"),
 *                      //    ubfList);
 *                      //fcfList.Add(fcf);
 *                      //ubfList.Add(new ConcorderControl.UsedByFiller("Senses" ));
 *
 *                      //// Find: Sense Type
 *                      //// UsedBy: Senses
 *                      //ubfList = new List<ConcorderControl.UsedByFiller>();
 *                      //fcf = new ConcorderControl.FindPossibilityComboFiller(
 *                      //    configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcSenseType']"),
 *                      //    ubfList,
 *                      //    m_cache.LangProject.LexDbOA.SenseTypesOA);
 *                      //fcfList.Add(fcf);
 *                      //ubfList.Add(new ConcorderControl.UsedByFiller(
 *                      //    configurationNode.SelectSingleNode("targetcontrols/control[@id='Senses']")));
 *
 *                      // Find: Status
 *                      // UsedBy: Senses
 *                      //ubfList = new List<ConcorderControl.UsedByFiller>();
 *                      //// TODO: Where is the pos list?
 *                      //fcf = new ConcorderControl.FindComboFiller(
 *                      //    configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcStatus']"),
 *                      //    ubfList);
 *                      //fcfList.Add(fcf);
 *                      //ubfList.Add(new ConcorderControl.UsedByFiller("Senses" ));
 *
 *                      // Find: Translation Type
 *                      // UsedBy:
 *
 *                      //// Find: Usages
 *                      //// UsedBy: Senses
 *                      //ubfList = new List<ConcorderControl.UsedByFiller>();
 *                      //fcf = new ConcorderControl.FindPossibilityComboFiller(
 *                      //    configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcUsages']"),
 *                      //    ubfList,
 *                      //    m_cache.LangProject.LexDbOA.UsageTypesOA);
 *                      //fcfList.Add(fcf);
 *                      //ubfList.Add(new ConcorderControl.UsedByFiller(
 *                      //    configurationNode.SelectSingleNode("targetcontrols/control[@id='Senses']")));
 */

            m_concorderControl.SetupDlg(m_myOwnPrivateMediator, fcfList, fcfList[0]);
        }
Exemplo n.º 41
0
 /// -----------------------------------------------------------------------------------
 /// <summary>
 /// Constructor
 /// </summary>
 /// -----------------------------------------------------------------------------------
 public SpellCheckHelper(FdoCache cache)
 {
     m_cache = cache;
 }
Exemplo n.º 42
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Assuming the selection can be expanded to a word and a corresponding LexEntry can
        /// be found, show the related words dialog with the words related to the selected one.
        /// </summary>
        /// <param name="cache">The cache.</param>
        /// <param name="sel">The sel.</param>
        /// <param name="owner">The owner.</param>
        /// <param name="mediatorIn"></param>
        /// <param name="helpProvider"></param>
        /// <param name="helpFileKey"></param>
        /// ------------------------------------------------------------------------------------
        public static void DisplayRelatedEntries(FdoCache cache, IVwSelection sel, IWin32Window owner,
                                                 Mediator mediatorIn, IHelpTopicProvider helpProvider, string helpFileKey)
        {
            if (sel == null)
            {
                return;
            }
            IVwSelection sel2 = sel.EndPoint(false);

            if (sel2 == null)
            {
                return;
            }
            IVwSelection sel3 = sel2.GrowToWord();

            if (sel3 == null)
            {
                return;
            }
            ITsString tss;
            int       ichMin, ichLim, hvo, tag, ws;
            bool      fAssocPrev;

            sel3.TextSelInfo(false, out tss, out ichMin, out fAssocPrev, out hvo, out tag, out ws);
            sel3.TextSelInfo(true, out tss, out ichLim, out fAssocPrev, out hvo, out tag, out ws);
            if (tss.Text == null)
            {
                return;
            }
            ITsString  tssWf = tss.GetSubstring(ichMin, ichLim);
            LexEntryUi leui  = FindEntryForWordform(cache, tssWf);

            // This doesn't work as well (unless we do a commit) because it may not see current typing.
            //LexEntryUi leui = LexEntryUi.FindEntryForWordform(cache, hvo, tag, ichMin, ichLim);
            if (leui == null)
            {
                if (tssWf != null && tssWf.Length > 0)
                {
                    RelatedWords.ShowNotInDictMessage(owner);
                }
                return;
            }
            int hvoEntry = leui.Object.Hvo;

            int[]      domains;
            int[]      lexrels;
            IVwCacheDa cdaTemp;

            if (!RelatedWords.LoadDomainAndRelationInfo(cache, hvoEntry, out domains, out lexrels, out cdaTemp, owner))
            {
                return;
            }
            StringTable   stOrig;
            Mediator      mediator;
            IVwStylesheet styleSheet;
            bool          fRestore = EnsureFlexTypeSetup(cache, mediatorIn, out stOrig, out mediator, out styleSheet);

            using (RelatedWords rw = new RelatedWords(cache, sel3, hvoEntry, domains, lexrels, cdaTemp, styleSheet))
            {
                rw.ShowDialog(owner);
            }
            if (fRestore)
            {
                mediator.StringTbl = stOrig;
            }
        }
Exemplo n.º 43
0
 public AtomicRefTypeAheadVc(int flid, FdoCache cache)
 {
     m_flid  = flid;
     m_tasvc = new TypeAheadSupportVc(flid, cache);
 }
Exemplo n.º 44
0
        internal static void DisplayEntry(FdoCache cache, IWin32Window owner, Mediator mediatorIn,
                                          IHelpTopicProvider helpProvider, string helpFileKey, ITsString tssWfIn)
        {
            ITsString  tssWf = tssWfIn;
            LexEntryUi leui  = LexEntryUi.FindEntryForWordform(cache, tssWf);

            // if we do not find a match for the word then try converting it to lowercase and see if there
            // is an entry in the lexicon for the Wordform in lowercase. This is needed for occurences of
            // words which are capitalized at the beginning of sentences.  LT-7444 RickM
            if (leui == null)
            {
                //We need to be careful when converting to lowercase therefore use Icu.ToLower()
                //get the WS of the tsString
                int wsWf = StringUtils.GetWsAtOffset(tssWf, 0);
                //use that to get the locale for the WS, which is used for
                string        wsLocale = cache.LanguageWritingSystemFactoryAccessor.get_EngineOrNull(wsWf).IcuLocale;
                string        sLower   = Icu.ToLower(tssWf.Text, wsLocale);
                ITsTextProps  ttp      = tssWf.get_PropertiesAt(0);
                ITsStrFactory tsf      = TsStrFactoryClass.Create();
                tssWf = tsf.MakeStringWithPropsRgch(sLower, sLower.Length, ttp);
                leui  = LexEntryUi.FindEntryForWordform(cache, tssWf);
            }

            // Ensure that we have a valid mediator with the proper string table.
            bool        fRestore = false;
            StringTable stOrig   = null;
            Mediator    mediator = EnsureValidMediator(mediatorIn, out fRestore, out stOrig);
            FdoCache    cache2   = (FdoCache)mediator.PropertyTable.GetValue("cache");

            if (cache2 != cache)
            {
                mediator.PropertyTable.SetProperty("cache", cache);
            }
            EnsureWindowConfiguration(mediator);
            EnsureFlexVirtuals(cache, mediator);
            IVwStylesheet styleSheet = GetStyleSheet(cache, mediator);

            if (leui == null)
            {
                int hvoLe = ShowFindEntryDialog(cache, mediator, tssWf, owner);
                if (hvoLe == 0)
                {
                    // Restore the original string table in the mediator if needed.
                    if (fRestore)
                    {
                        mediator.StringTbl = stOrig;
                    }
                    return;
                }
                leui = new LexEntryUi(new LexEntry(cache, hvoLe));
            }
            if (mediator != null)
            {
                leui.Mediator = mediator;
            }
            leui.ShowSummaryDialog(owner, tssWf, helpProvider, helpFileKey, styleSheet);
            // Restore the original string table in the mediator if needed.
            if (fRestore)
            {
                mediator.StringTbl = stOrig;
            }
        }
Exemplo n.º 45
0
        private bool m_isRtL;                     // set true to test RTL context menus, etc.

        internal TestCCLogic(FdoCache cache, IDsConstChart chart, IStText stText)
            : base(cache, chart, stText.Hvo)
        {
        }
Exemplo n.º 46
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Find wordform given a cache and the string.
        /// </summary>
        /// <param name="cache"></param>
        /// <param name="wf"></param>
        /// <returns></returns>
        /// ------------------------------------------------------------------------------------
        public static LexEntryUi FindEntryForWordform(FdoCache cache, ITsString tssWf)
        {
            if (tssWf == null)
            {
                return(null);
            }

            string wf = tssWf.Text;

            if (wf == null || wf == string.Empty)
            {
                return(null);
            }

            int        wsVern = StringUtils.GetWsAtOffset(tssWf, 0);
            string     sql;
            List <int> entries;

            // Check for Lexeme form.
            sql = string.Format("SELECT le.Id, le.HomographNumber FROM LexEntry le" +
                                " JOIN LexEntry_LexemeForm llf ON llf.Src=le.Id" +
                                " JOIN MoForm_Form mf ON mf.Obj=llf.Dst AND" +
                                " mf.Ws={0} AND mf.Txt=?" +
                                " ORDER BY le.HomographNumber", wsVern);
            entries = DbOps.ReadIntsFromCommand(cache, sql, wf);
            if (entries.Count == 0)
            {
                // Check for Citation form.
                sql = string.Format("SELECT le.Id, le.HomographNumber FROM LexEntry le" +
                                    " JOIN LexEntry_CitationForm lcf ON lcf.Obj=le.Id AND" +
                                    " lcf.Ws={0} AND lcf.Txt=?" +
                                    " ORDER BY le.HomographNumber", wsVern);
                entries = DbOps.ReadIntsFromCommand(cache, sql, wf);
            }
            if (entries.Count == 0)
            {
                // Check for Alternate forms.
                sql = string.Format("SELECT le.Id, le.HomographNumber FROM LexEntry le" +
                                    " JOIN LexEntry_AlternateForms laf on laf.Src=le.Id" +
                                    " JOIN MoForm_Form mf ON mf.Obj=laf.Dst AND " +
                                    " mf.Ws={0} AND mf.Txt=?" +
                                    " ORDER BY le.HomographNumber, laf.Ord", wsVern);
                entries = DbOps.ReadIntsFromCommand(cache, sql, wf);
            }
            int hvoLe = 0;

            if (entries.Count == 0)
            {
                // Look for the most commonly used analysis of the wordform.
                // Enhance JohnT: first look to see whether the paragraph is analyzed
                // and we know exactly which analysis to use.
                string sql2 = "declare @wfid int"
                              + " select @wfid = obj from WfiWordform_Form where Txt=?"
                              + " select AnalysisId from dbo.fnGetDefaultAnalysisGloss(@wfid)";
                int hvoAnn;
                DbOps.ReadOneIntFromCommand(cache, sql2, wf, out hvoAnn);
                if (hvoAnn == 0)
                {
                    return(null);
                }
                // Pick an arbitrary stem morpheme lex entry from the most common analysis.
                string sql3 = string.Format("select le.id from WfiMorphBundle wmb"
                                            + " join CmObject co on co.owner$ = {0} and co.id = wmb.id"
                                            + " join MoStemMsa msm on msm.id = wmb.msa"
                                            + " join CmObject comsm on comsm.id = msm.id"
                                            + " join LexEntry le on le.id = comsm.owner$", hvoAnn);
                DbOps.ReadOneIntFromCommand(cache, sql3, null, out hvoLe);
                if (hvoLe == 0)
                {
                    return(null);
                }
            }
            else
            {
                // Enhance JohnT: should we do something about multiple homographs?
                hvoLe = entries[0];
            }
            return(new LexEntryUi(new LexEntry(cache, hvoLe)));
        }
Exemplo n.º 47
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Sets the FDO cache for testing
        /// </summary>
        /// <param name="serverName"></param>
        /// <param name="dbName"></param>
        /// <param name="cache"></param>
        /// ------------------------------------------------------------------------------------
        public void SetFdoCache(string serverName, string dbName, FdoCache cache)
        {
            CheckDisposed();

            m_caches[MakeKey(serverName, dbName)] = cache;
        }
Exemplo n.º 48
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 ///
 /// </summary>
 /// ------------------------------------------------------------------------------------
 public DummyHeaderFooterSetupDlg(FdoCache cache, IPublication pub, ICmMajorObject hfOwner)
     : base(cache, pub, null, null, hfOwner)
 {
 }
Exemplo n.º 49
0
 /// <summary>
 /// The real deal
 /// </summary>
 /// <param name="mediator"></param>
 protected ParserTraceBase(Mediator mediator)
 {
     m_mediator      = mediator;
     m_cache         = (FdoCache)m_mediator.PropertyTable.GetValue("cache");
     m_sDataBaseName = m_cache.ProjectId.Name;
 }
Exemplo n.º 50
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// </summary>
 /// <param name="pageInfo"></param>
 /// <param name="wsDefault">ID of default writing system</param>
 /// <param name="printDateTime">printing date/time</param>
 /// ------------------------------------------------------------------------------------
 public DummyHFSetupDlgVC(IPageInfo pageInfo, int wsDefault, DateTime printDateTime, FdoCache cache)
     : base(pageInfo, wsDefault, printDateTime, cache)
 {
 }
Exemplo n.º 51
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="FilteredScrBooks"/> class.
 /// </summary>
 /// <param name="cache"></param>
 /// ------------------------------------------------------------------------------------
 internal FilteredScrBooks(FdoCache cache)
 {
     m_cache         = cache;
     m_scr           = m_cache.LangProject.TranslatedScriptureOA;
     m_filteredBooks = new List <IScrBook>(m_scr.ScriptureBooksOS);
 }
Exemplo n.º 52
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="NewStPara"/> class.
 /// </summary>
 /// <param name="fcCache">The FDO cache object</param>
 /// <param name="hvo">HVO of the new object</param>
 /// ------------------------------------------------------------------------------------
 public NewStPara(FdoCache fcCache, int hvo)
     : base(fcCache, hvo)
 {
 }
Exemplo n.º 53
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="DerivedStTxtPara2"/> class.
 /// </summary>
 /// <param name="fcCache">The FDO cache object</param>
 /// <param name="hvo">HVO of the new object</param>
 /// ------------------------------------------------------------------------------------
 public DerivedStTxtPara2(FdoCache fcCache, int hvo)
     : base(fcCache, hvo)
 {
 }
Exemplo n.º 54
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Constructor
 /// </summary>
 /// ------------------------------------------------------------------------------------
 internal AddToDictMenuItem(ISpellEngine dict, string word, IVwRootBox rootb,
                            int hvoObj, int tag, int wsAlt, int wsText, string text, FdoCache cache)
     : base(text)
 {
     m_rootb  = rootb;
     m_dict   = dict;
     m_word   = word;
     m_hvoObj = hvoObj;
     m_tag    = tag;
     m_wsAlt  = wsAlt;
     m_wsText = wsText;
     m_cache  = cache;
 }
Exemplo n.º 55
0
 public Fwr3660ValidCharactersDlg(FdoCache cache, IWritingSystemContainer container,
                                  IWritingSystem ws)
     : base(cache, container, null, null, ws, "dymmy")
 {
 }
Exemplo n.º 56
0
 /// <summary>
 /// Sets the DLG info.
 /// </summary>
 /// <param name="cache">The cache.</param>
 /// <param name="mediator">The mediator.</param>
 /// <param name="tssVariantLexemeForm">The variant lexeme form.</param>
 public void SetDlgInfo(FdoCache cache, Mediator mediator, ITsString tssVariantLexemeForm)
 {
     m_tssVariantLexemeForm = tssVariantLexemeForm;
     base.SetDlgInfo(cache, mediator, null);
 }
Exemplo n.º 57
0
		/// <summary>
		/// Load the list (given by owner and sFieldName) from the given TextReader.
		/// </summary>
		public void ImportList(ICmObject owner, string sFieldName, TextReader reader, IProgress progress)
		{
			m_cache = owner.Cache;
			m_mdc = m_cache.MetaDataCache;
			m_wsf = m_cache.WritingSystemFactory;
			m_progress = progress;

			NonUndoableUnitOfWorkHelper.DoUsingNewOrCurrentUOW(m_cache.ActionHandlerAccessor, () =>
				{
					int flidList = m_mdc.GetFieldId(owner.ClassName, sFieldName, true);
					if (flidList == 0)
						throw new Exception(String.Format("Invalid list fieldname (programming error): {0}", sFieldName));
					using (var xrdr = XmlReader.Create(reader))
					{
						xrdr.MoveToContent();
						if (xrdr.Name != owner.ClassName)
							throw new Exception(String.Format("Unexpected outer element: {0}", xrdr.Name));

						if (!xrdr.ReadToDescendant(sFieldName))
							throw new Exception(String.Format("Unexpected second element: {0}", xrdr.Name));

						if (!xrdr.ReadToDescendant("CmPossibilityList"))
							throw new Exception(String.Format("Unexpected third element: {0}", xrdr.Name));

						ICmPossibilityList list;
						int hvo = m_cache.MainCacheAccessor.get_ObjectProp(owner.Hvo, flidList);
						if (hvo == 0)
							hvo = m_cache.MainCacheAccessor.MakeNewObject(CmPossibilityListTags.kClassId, owner.Hvo, flidList, -2);
						ICmPossibilityListRepository repo = m_cache.ServiceLocator.GetInstance<ICmPossibilityListRepository>();
						list = repo.GetObject(hvo);
						string sItemClassName = "CmPossibility";
						xrdr.Read();
						while (xrdr.Depth == 3)
						{
							xrdr.MoveToContent();
							if (xrdr.Depth < 3)
								break;
							switch (xrdr.Name)
							{
								case "Description":
									SetMultiStringFromXml(xrdr, list.Description);
									break;
								case "Name":
									SetMultiUnicodeFromXml(xrdr, list.Name);
									break;
								case "Abbreviation":
									SetMultiUnicodeFromXml(xrdr, list.Abbreviation);
									break;
								case "Depth":
									list.Depth = ReadIntFromXml(xrdr);
									break;
								case "DisplayOption":
									list.DisplayOption = ReadIntFromXml(xrdr);
									break;
								case "HelpFile":
									list.HelpFile = ReadUnicodeFromXml(xrdr);
									break;
								case "IsClosed":
									list.IsClosed = ReadBoolFromXml(xrdr);
									break;
								case "IsSorted":
									list.IsSorted = ReadBoolFromXml(xrdr);
									break;
								case "IsVernacular":
									list.IsVernacular = ReadBoolFromXml(xrdr);
									break;
								case "ItemClsid":
									list.ItemClsid = ReadIntFromXml(xrdr);
									sItemClassName = m_mdc.GetClassName(list.ItemClsid);
									break;
								case "ListVersion":
									list.ListVersion = ReadGuidFromXml(xrdr);
									break;
								case "PreventChoiceAboveLevel":
									list.PreventChoiceAboveLevel = ReadIntFromXml(xrdr);
									break;
								case "PreventDuplicates":
									list.PreventDuplicates = ReadBoolFromXml(xrdr);
									break;
								case "PreventNodeChoices":
									list.PreventNodeChoices = ReadBoolFromXml(xrdr);
									break;
								case "UseExtendedFields":
									list.UseExtendedFields = ReadBoolFromXml(xrdr);
									break;
								case "WsSelector":
									list.WsSelector = ReadIntFromXml(xrdr);
									break;
								case "Possibilities":
									LoadPossibilitiesFromXml(xrdr, list, sItemClassName);
									break;
								case "HeaderFooterSets":
									throw new Exception("We don't (yet?) handle HeaderFooterSets for CmPossibilityList (programming issue)");
								case "Publications":
									throw new Exception("We don't (yet?) handle Publications for CmPossibilityList (programming issue)");
								default:
									throw new Exception(String.Format("Unknown field element in CmPossibilityList: {0}", xrdr.Name));
							}
						}
						xrdr.Close();
						if (m_mapRelatedDomains.Count > 0)
							SetRelatedDomainsLinks();
					}
				});
		}
Exemplo n.º 58
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="LocationTrackerImpl"/> class.
 /// </summary>
 /// <param name="cache">The cache.</param>
 /// <param name="filterInstance">The filter instance. If 0, then the normal DB book list
 /// is used</param>
 /// ------------------------------------------------------------------------------------
 public LocationTrackerImpl(FdoCache cache, int filterInstance)
     : this(cache, filterInstance, StVc.ContentTypes.kctNormal)
 {
 }
Exemplo n.º 59
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="FilteredScrBooks"/> class.
		/// </summary>
		/// <param name="cache"></param>
		/// ------------------------------------------------------------------------------------
		internal FilteredScrBooks(FdoCache cache)
		{
			m_cache = cache;
			m_scr = m_cache.LangProject.TranslatedScriptureOA;
			m_filteredBooks = new List<IScrBook>(m_scr.ScriptureBooksOS);
		}
Exemplo n.º 60
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="cache">The cache.</param>
 /// <param name="fAddSubordinateStreams">set to <c>true</c> to add subordinate streams.</param>
 /// ------------------------------------------------------------------------------------
 public DummyLazyPrintConfigurer(FdoCache cache, bool fAddSubordinateStreams)
     : this(cache, fAddSubordinateStreams, fAddSubordinateStreams)
 {
 }