Example #1
0
		/// <summary>
		/// Return the string which should be used to request a dictionary for the specified writing system,
		/// or null if none will work.
		/// </summary>
		/// <param name="ws"></param>
		/// <param name="wsf"></param>
		/// <returns></returns>
		private static string DictionaryId(int ws, SIL.FieldWorks.Common.COMInterfaces.ILgWritingSystemFactory wsf)
		{
			IWritingSystem wsEngine = wsf.get_EngineOrNull(ws);
			if (wsEngine == null)
				return null;
			string wsId = wsEngine.SpellCheckDictionary;
			if (String.IsNullOrEmpty(wsId) || wsId == "<None>")
				return null;
			if (Enchant.Broker.Default.DictionaryExists(wsId))
			{
				return wsId;
			}

			// If no dictionary exists which matches the language name exactly then
			// search for one.
			//
			// Enchant.Broker.Default.Dictionaries is a list of the dictionaries found in
			// C:\Documents and Settings\USERNAME\Application Data\enchant\myspell
			// followed by the dictionaries found in Open Office.
			// C:\Program Files\OpenOffice.org 2.4\share\dict\ooo
			// The Views code is also programmed to find the first match.
			foreach (Enchant.DictionaryInfo info in Enchant.Broker.Default.Dictionaries)
			{
				if (info.Language.StartsWith(wsId))
					return info.Language;
			}
			return null;
		}
Example #2
0
		public override bool Matches(SIL.FieldWorks.Common.COMInterfaces.ITsString arg)
		{
			string text = arg.Text;
			if (String.IsNullOrEmpty(text))
				return false;
			try
			{
				DateTime time = DateTime.Parse(text);
				switch (m_type)
				{
					case DateMatchType.After:
						return time >= m_start;
					case DateMatchType.Before:
						return time <= m_end;
					case DateMatchType.Range:
					case DateMatchType.On:
						return time >= m_start && time <= m_end;
					case DateMatchType.NotRange:
						return time < m_start || time > m_end;
				}
			}
			catch (FormatException)
			{
				return false; // an invalid date just doesn't match.
			}
			return false; // to make the compiler happy, or in case we somehow don't have a valid type
		}
		internal override void ViewChangedSelectedRecord(SIL.FieldWorks.Common.FwUtils.FwObjectSelectionEventArgs e, SIL.FieldWorks.Common.COMInterfaces.IVwSelection sel)
		{
			base.ViewChangedSelectedRecord(e, sel);
			UsedToSyncRelatedClerk = false;
			if (sel == null)
				return;
			// See if we can make an appropriate Subitem selection.
			var clevels = sel.CLevels(false);
			if (clevels < 2)
				return; // paranoia.
			// The object we get with level = clevels - 1 is the root of the whole view, which is of no interest.
			// The one with clevels - 2 is one of the objects in the top level of the list.
			// We get that initially, along with the tag that determines whether we can drill deeper.
			// Starting with clevels - 3, if there are that many, we keep getting more levels
			// as long as there are some and the previous level had the right tag.
			int hvoObj, tag, ihvo, cpropPrevious;
			IVwPropertyStore vps;
			sel.PropInfo(false, clevels - 2, out hvoObj, out tag, out ihvo,
				out cpropPrevious, out vps);
			int hvoTarget = hvoObj;
			for (int index = clevels - 3; index >= 0 && tag == SubitemFlid; index --)
			{
				sel.PropInfo(false, index, out hvoTarget, out tag, out ihvo,
					out cpropPrevious, out vps);
			}
			if (hvoTarget != hvoObj)
			{
				// we did some useful drilling.
				Subitem = Cache.ServiceLocator.GetObject(hvoTarget);
			}
			else
			{
				Subitem = null; // no relevant subitem.
			}
		}
Example #4
0
			/// <summary>
			/// This property represents the length of the list of paragraphs of the specified
			/// StText.  We implement load by reading the length of the vector from the DA, and
			/// caching it as the value of the virtual property.
			/// </summary>
			/// <param name="hvo"></param>
			/// <param name="tag"></param>
			/// <param name="ws"></param>
			/// <param name="cda"></param>
			public override void Load(int hvo, int tag, int ws,
				SIL.FieldWorks.Common.COMInterfaces.IVwCacheDa cda)
			{
				ISilDataAccess sda = (ISilDataAccess)cda;
				cda.CacheIntProp(hvo, tag, sda.get_VecSize(hvo,
					(int)StText.StTextTags.kflidParagraphs));
			}
Example #5
0
		/// <summary>
		/// The core of the Draw() method, where the rectangle actually gets painted.
		/// Vertical views use a rotated drawing routine.
		/// </summary>
		/// <param name="vdrb"></param>
		/// <param name="rootb"></param>
		/// <param name="hdc"></param>
		/// <param name="drawRect"></param>
		/// <param name="backColor"></param>
		/// <param name="drawSel"></param>
		/// <param name="clipRect"></param>
		public virtual void DrawTheRoot(IVwDrawRootBuffered vdrb, IVwRootBox rootb, IntPtr hdc,
			SIL.FieldWorks.Common.Utils.Rect drawRect, uint backColor, bool drawSel,
			Rectangle clipRect)
		{
			vdrb.DrawTheRoot(rootb, hdc, clipRect, backColor,
				drawSel, m_site);
		}
        public void ProcesarFondo(SIL c, string periodo)
        {
            var excelAppOut = new ExcelX.Application();
            var fecha       = DateTime.Now.ToString().Replace("/", "").Replace(":", "").Replace(" ", "");
            //var periodo = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString().PadLeft(2, '0');
            var rutaEntrada = @"C:\Fondos Nacionales\out\" + periodo + @"\Sil\Preliminar\IFSIL";
            var rutaSalida  = @"C:\Fondos Nacionales\out\" + periodo + @"\Sil\";

            Utilidades.AbrirLibro(excelAppOut, rutaEntrada);



            //"Feb-17"
            ExcelX._Worksheet Salida = (ExcelX.Worksheet)excelAppOut.Sheets["Template"];
            Salida.Cells["12", "I"] = c.Cotizaciones.Replace(".", "").Replace(",", "");
            Salida.Cells["13", "I"] = c.CotizacionesPeriodosAnteriores.Replace(".", "").Replace(",", "");
            Salida.Cells["14", "I"] = c.ReajusteLey17332.Replace(".", "").Replace(",", "");
            Salida.Cells["15", "I"] = c.CotizacionesEntidadesPagadorasdeSubsidios.Replace(".", "").Replace(",", "");
            Salida.Cells["16", "I"] = c.ReintegroporCobroIndebidodeSubsidio.Replace(".", "").Replace(",", "");


            Salida.Cells["23", "I"] = c.SILEnfermedadOrigenComun.Replace(".", "").Replace(",", "");
            Salida.Cells["24", "I"] = c.SILSubsidioMaternalSuplementario.Replace(".", "").Replace(",", "");

            Salida.Cells["26", "K"] = c.DescuentoBeneficiosNoCobrados.Replace(".", "").Replace(",", "");

            Salida.Cells["29", "I"] = c.SREnfermedadOrigenComun.Replace(".", "").Replace(",", "");
            Salida.Cells["30", "I"] = c.SRSubsidioMaternalSuplementario.Replace(".", "").Replace(",", "");

            Salida.Cells["33", "I"] = c.CFPEnfermedadOrigenComun.Replace(".", "").Replace(",", "");
            Salida.Cells["34", "I"] = c.CFPSubsidioMaternalSuplementario.Replace(".", "").Replace(",", "");

            Salida.Cells["37", "I"] = c.CFSEnfermedadOrigenComun.Replace(".", "").Replace(",", "");
            Salida.Cells["38", "I"] = c.CFSSubsidioMaternalSuplementario.Replace(".", "").Replace(",", "");

            Salida.Cells["41", "I"] = c.OCEnfermedadOrigenComun.Replace(".", "").Replace(",", "");
            Salida.Cells["42", "I"] = c.OCSubsidioMaternalSuplementario.Replace(".", "").Replace(",", "");

            Salida.Cells["46", "I"] = c.OtrosEgresos.Replace(".", "").Replace(",", "");


            System.IO.FileAttributes attr;
            try
            {
                attr = System.IO.File.GetAttributes(rutaSalida);
            }
            catch (Exception ex)
            {
                System.IO.Directory.CreateDirectory(rutaSalida);
            }

            Salida.Name = periodo;
            Salida.SaveAs(rutaSalida + "IFSIL_" + fecha + Utilidades.ExtensionLibro(Salida.Application.ActiveWorkbook));

            excelAppOut.Quit();
            System.Runtime.InteropServices.Marshal.FinalReleaseComObject(excelAppOut);
        }
        public void Procesar(SIL s, string periodo)
        {
            var excelAppOut  = new ExcelX.Application();
            var excelAppOut2 = new ExcelX.Application();

            var rutaEntrada = @"C:\Fondos Nacionales\Templates\IF_SIL";

            var rutaESTEMP = @"C:\Fondos Nacionales\in\" + periodo + @"\ESTEMP";

            Utilidades.AbrirLibro(excelAppOut, rutaEntrada);

            Utilidades.AbrirLibro(excelAppOut2, rutaESTEMP);



            ExcelX._Worksheet Salida        = (ExcelX.Worksheet)excelAppOut.Sheets["Template"];
            ExcelX._Worksheet EntradaESTEMP = (ExcelX.Worksheet)excelAppOut2.Sheets["Total Afil . y Emp. COTIZANTES"];
            Salida.Cells["12", "U"] = s.NumSubsidiosIniciados.Replace(".", "").Replace(",", "");
            Salida.Cells["13", "U"] = s.NumAfiliadosCotizantes.Replace(".", "").Replace(",", "");

            //TO DO: Agregar nuevo documento que tendrá este valor
            var from = EntradaESTEMP.Range["D62"];
            var to   = Salida.Range["U14"];

            from.Copy();
            to.PasteSpecial(ExcelX.XlPasteType.xlPasteValues, ExcelX.XlPasteSpecialOperation.xlPasteSpecialOperationNone, System.Type.Missing, System.Type.Missing);



            //Salida.Cells["14", "U"] = s.NumEmpresasCotizantes.Replace(".", "").Replace(",", "");
            Salida.Cells["15", "U"] = s.NumTrabajadoresAfiliados.Replace(".", "").Replace(",", "");
            Salida.Cells["16", "U"] = s.NumEmpresasAfiliadas.Replace(".", "").Replace(",", "");

            Salida.Cells["52", "Q"] = s.ValorNotaInterna.Replace(".", "").Replace(",", "");



            //var fecha = DateTime.Now.ToString().Replace("/", "").Replace(":", "").Replace(" ", "");
            //var periodo = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString().PadLeft(2, '0');
            var rutaSalida = @"C:\Fondos Nacionales\out\" + periodo + @"\Sil\Preliminar\";

            System.IO.FileAttributes attr;
            try
            {
                attr = System.IO.File.GetAttributes(rutaSalida);
            }
            catch (Exception ex)
            {
                System.IO.Directory.CreateDirectory(rutaSalida);
            }
            //_" + fecha + "
            Salida.SaveAs(rutaSalida + "IFSIL" + Utilidades.ExtensionLibro(Salida.Application.ActiveWorkbook));

            excelAppOut.Quit();
            System.Runtime.InteropServices.Marshal.FinalReleaseComObject(excelAppOut);
        }
Example #8
0
		/// <summary>
		/// Constructor.
		/// </summary>
		/// <param name="obj">CmObject that is being displayed.</param>
		/// <param name="flid">The field identifier for the attribute we are displaying.</param>
		public EnumComboSlice(FdoCache cache, ICmObject obj, int flid, SIL.Utils.StringTable stringTable, XmlNode parameters)
			: base(new FwOverrideComboBox(), cache, obj, flid)
		{
			m_combo = (ComboBox)this.Control;
			m_combo.DropDownStyle = ComboBoxStyle.DropDownList;
			//note: no exception is thrown if it can't find it.
			m_combo.Font = new System.Drawing.Font("Arial Unicode MS", 10);
			m_combo.SelectedValueChanged += new EventHandler(this.SelectionChanged);
			m_combo.GotFocus += new EventHandler(m_combo_GotFocus);
			StringTbl = stringTable;
			PopulateCombo(parameters);
			// We need to watch the cache for changes to our property.
			cache.MainCacheAccessor.AddNotification(this);
		}
Example #9
0
		/// <summary>
		/// Get a dictionary for the specified writing system, or null if we don't know of one.
		/// We ideally want a dictionary that exactly matches the specified writing system, that is,
		/// dict.Information.Language == the SpellCheckDictionary of the writing system.
		/// If we can't find such a dictionary, for major languages (those that have non-trivial base dictionary files),
		/// we will return a dictionary that shares a prefix, for example, 'en' when looking for 'en_US' or vice versa.
		/// This is not allowed for minority languages (where the dictionary is one we created ourselves that is empty,
		/// and all the spelling information is in the overrides kept by Enchant); we return null if we can't find
		/// an exact match or an approximate match that is a 'major' language dictionary.
		/// Note: a similar algorithm is unfortunately implemented in VwRootBox::GetDictionary
		/// and in WritingSystemPropertiesDialog.PopulateSpellingDictionaryComboBox.
		/// </summary>
		public static Enchant.Dictionary GetDictionary(int ws, SIL.FieldWorks.Common.COMInterfaces.ILgWritingSystemFactory wsf)
		{
			string dictId = DictionaryId(ws, wsf);
			if (dictId == null)
				return null;
			Dictionary dict = Enchant.Broker.Default.RequestDictionary(dictId);
			IWritingSystem engine = wsf.get_EngineOrNull(ws);
			if (engine == null)
				return dict; // should never happen? Can't verify ID so go ahead and return it.
			if (dict.Information.Language == engine.SpellCheckDictionary)
				return dict; // exact match
			if (IsPrivateDictionary(dict.Information.Language))
				return null; // private dictionaries may only be returned when matching exactly.
			return dict;
		}
Example #10
0
		int m_comboWidth;		// computed width of m_combo

		/// <summary>
		/// Constructor.
		/// </summary>
		/// <param name="cache"></param>
		/// <param name="obj">CmObject that is being displayed.</param>
		/// <param name="flid">The field identifier for the attribute we are displaying.</param>
		/// <param name="stringTable"></param>
		/// <param name="parameters"></param>
		public EnumComboSlice(FdoCache cache, ICmObject obj, int flid, SIL.Utils.StringTable stringTable, XmlNode parameters)
			: base(new FwOverrideComboBox(), cache, obj, flid)
		{
			m_combo = (ComboBox)this.Control;
			m_combo.DropDownStyle = ComboBoxStyle.DropDownList;
			//note: no exception is thrown if it can't find it.
			m_combo.Font = new System.Drawing.Font(MiscUtils.StandardSansSerif, 10);
			SetForeColor(parameters);
			m_combo.SelectedValueChanged += new EventHandler(this.SelectionChanged);
			m_combo.GotFocus += new EventHandler(m_combo_GotFocus);
			m_combo.DropDownClosed += new EventHandler(m_combo_DropDownClosed);
#if __MonoCS__	// FWNX-545
			m_combo.Parent.SizeChanged += new EventHandler(OnComboParentSizeChanged);
#endif
			StringTbl = stringTable;
			PopulateCombo(parameters);
			// We need to watch the cache for changes to our property.
			cache.DomainDataByFlid.AddNotification(this);
		}
Example #11
0
		/// <summary>
		/// Required method to load the data.
		/// </summary>
		/// <param name="hvo"></param>
		/// <param name="tag"></param>
		/// <param name="ws"></param>
		/// <param name="_cda"></param>
		public override void Load(int hvo, int tag, int ws, SIL.FieldWorks.Common.COMInterfaces.IVwCacheDa _cda)
		{
			// Need to get stem.PartOfSpeech instead of cn.Obj because cn.Obj and cn.Txt may be null!  See LT-6828.
			string sql = "select ls.id, ls.MorphoSyntaxAnalysis, msao.Owner$, msao.class$, ms.txt, ms.fmt, stem.PartOfSpeech, cn.txt from LexSense ls"
				+ " left outer join MultiStr$ ms on ms.obj = ls.id and ms.flid = 5016005 and ms.ws = " + m_cache.DefaultAnalWs
				+ " left outer join MoStemMsa stem on stem.id = ls.MorphoSyntaxAnalysis"
				+ " left outer join CmPossibility_Name cn on stem.PartOfSpeech = cn.obj and cn.ws = " + m_cache.DefaultAnalWs
				+ " left outer join CmObject msao on msao.id = ls.MorphoSyntaxAnalysis";
			IVwOleDbDa dba = m_cache.VwOleDbDaAccessor;
			IDbColSpec dcs = DbColSpecClass.Create();
			dcs.Push((int)DbColType.koctObjVec, 0, this.Tag, 0);
			dcs.Push((int)DbColType.koctObj, 1, (int)LexSense.LexSenseTags.kflidMorphoSyntaxAnalysis, 0);
			dcs.Push((int)DbColType.koctObj, 2, (int)CmObjectFields.kflidCmObject_Owner, 0);
			dcs.Push((int)DbColType.koctInt, 2, (int)CmObjectFields.kflidCmObject_Class, 0);
			dcs.Push((int)DbColType.koctMlsAlt, 1, (int)LexSense.LexSenseTags.kflidDefinition, m_cache.DefaultAnalWs);
			dcs.Push((int)DbColType.koctFmt, 1, (int)LexSense.LexSenseTags.kflidDefinition, m_cache.DefaultAnalWs);
			dcs.Push((int)DbColType.koctObj, 2, (int)MoStemMsa.MoStemMsaTags.kflidPartOfSpeech, 0);
			dcs.Push((int)DbColType.koctMltAlt, 7, (int)CmPossibility.CmPossibilityTags.kflidName, m_cache.DefaultAnalWs);
			dba.Load(sql, dcs, hvo, 0, null, false);
		}
Example #12
0
		static internal bool TryFirstWsInList(SIL.FieldWorks.Common.COMInterfaces.ISilDataAccess sda, int hvo, int flid,
			int[] wssToTry, ref Set<int> wssTried, out int retWs, out ITsString retTss)
		{
			retTss = null;
			retWs = 0;
			foreach (int wsLoop in wssToTry)
			{
				if (wssTried.Contains(wsLoop))
					continue;
				wssTried.Add(wsLoop);
				retTss = sda.get_MultiStringAlt(hvo, flid, wsLoop);
				if (retTss.Length > 0)
				{
					retWs = wsLoop;
					return true;
				}
			}
			return false;
		}
Example #13
0
		protected void matchingEntries_SelectionChanged(object sender,
			SIL.FieldWorks.Common.Utils.FwObjectSelectionEventArgs e)
		{
			if (m_skipCheck)
				return;

			m_selEntryID = e.Hvo;

			HandleMatchingSelectionChanged(e);
		}
Example #14
0
        public void ProcesarFondoSIL(System.ComponentModel.BackgroundWorker worker, string periodo)
        {
            worker.ReportProgress(0);

            List <long> CotizacionesPeriodosAnteriores = new List <long>();

            CotizacionesPeriodosAnteriores.Add(DatosCuentasFBL3N("7004000002", periodo));
            CotizacionesPeriodosAnteriores.Add(DatosCuentasFBL3N("7004000010", periodo));

            List <long> ReintegroporCobroIndebidodeSubsidio = new List <long>();

            ReintegroporCobroIndebidodeSubsidio.Add(DatosCuentasFBL3N("7004000003", periodo));
            ReintegroporCobroIndebidodeSubsidio.Add(DatosCuentasFBL3N("7004000007", periodo));

            List <long> SILEnfermedadOrigenComun = new List <long>();

            SILEnfermedadOrigenComun.Add(DatosCuentasFBL3N("8008000001", periodo));
            SILEnfermedadOrigenComun.Add(DatosCuentasFBL3N("8008000002", periodo));
            SILEnfermedadOrigenComun.Add(DatosCuentasFBL3N("8008000010", periodo));


            List <long> SILSubsidioMaternalSuplementario = new List <long>();

            SILSubsidioMaternalSuplementario.Add(DatosCuentasFBL3N("8008000011", periodo));
            SILSubsidioMaternalSuplementario.Add(DatosCuentasFBL3N("8008000012", periodo));
            SILSubsidioMaternalSuplementario.Add(DatosCuentasFBL3N("8008000013", periodo));

            List <long> DescuentoBeneficiosNoCobrados = new List <long>();

            DescuentoBeneficiosNoCobrados.Add(DatosCuentasFBL3N("8008000003", periodo));
            DescuentoBeneficiosNoCobrados.Add(DatosCuentasFBL3N("8008000020", periodo));

            List <long> SREnfermedadOrigenComun = new List <long>();

            SREnfermedadOrigenComun.Add(DatosCuentasFBL3N("8008000004", periodo));
            SREnfermedadOrigenComun.Add(DatosCuentasFBL3N("8008000019", periodo));


            SIL s = new SIL
            {
                Cotizaciones = Convert.ToString(DatosCuentasFBL3N("7004000009", periodo) * -1),
                CotizacionesPeriodosAnteriores = (CotizacionesPeriodosAnteriores.Sum(i => i) * -1).ToString(),
                ReajusteLey17332 = Convert.ToString(DatosCuentasFBL3N("7004000005", periodo) * -1),
                CotizacionesEntidadesPagadorasdeSubsidios = Convert.ToString(DatosCuentasFBL3N("7004000011", periodo) * -1),
                ReintegroporCobroIndebidodeSubsidio       = (ReintegroporCobroIndebidodeSubsidio.Sum(i => i) * -1).ToString(),


                SILEnfermedadOrigenComun         = SILEnfermedadOrigenComun.Sum(i => i).ToString(),
                SILSubsidioMaternalSuplementario = SILSubsidioMaternalSuplementario.Sum(i => i).ToString(),
                DescuentoBeneficiosNoCobrados    = DescuentoBeneficiosNoCobrados.Sum(i => i).ToString(),

                SREnfermedadOrigenComun         = SREnfermedadOrigenComun.Sum(i => i).ToString(),
                SRSubsidioMaternalSuplementario = Convert.ToString(DatosCuentasFBL3N("8008000008", periodo)),

                CFPEnfermedadOrigenComun         = Convert.ToString(DatosCuentasFBL3N("8008000007", periodo)),
                CFPSubsidioMaternalSuplementario = Convert.ToString(DatosCuentasFBL3N("8008000014", periodo)),

                CFSEnfermedadOrigenComun         = Convert.ToString(DatosCuentasFBL3N("8008000015", periodo)),
                CFSSubsidioMaternalSuplementario = Convert.ToString(DatosCuentasFBL3N("8008000016", periodo)),

                OCEnfermedadOrigenComun         = Convert.ToString(DatosCuentasFBL3N("8008000017", periodo)),
                OCSubsidioMaternalSuplementario = Convert.ToString(DatosCuentasFBL3N("8008000018", periodo)),

                ComisionAdministracion = Convert.ToString(DatosCuentasFBL3N("8008000005", periodo)),
                OtrosEgresos           = Convert.ToString(DatosCuentasFBL3N("8008000009", periodo)),
            };

            worker.ReportProgress(70);
            sc.ProcesarFondo(s, periodo);

            worker.ReportProgress(100);
        }
			// Activate the combo-handler's control.
			// If the control is a combo make it visible at the indicated location.
			// If it is a ComboListBox pop it up at the relevant place for the indicated
			// location.
			public virtual void Activate(SIL.Utils.Rect loc)
			{
				CheckDisposed();

				AdjustListBoxSize();
				ComboListBox c = (m_comboList as ComboListBox);
				c.AdjustSize(500, 400); // these are maximums!
				c.Launch(m_sandbox.RectangleToScreen(loc),
					Screen.GetWorkingArea(m_sandbox));
			}
			public override void Activate(SIL.Utils.Rect loc)
			{
				CheckDisposed();

				if (m_tree == null)
				{
					base.Activate(loc);
				}
				else
				{
					m_tree.Launch(m_sandbox.RectangleToScreen(loc),
						Screen.GetWorkingArea(m_sandbox));
				}
			}
		public bool Matches(SIL.FieldWorks.Common.COMInterfaces.ITsString arg)
		{
			return Accept(arg);
		}
Example #18
0
		private void DeleteCharts(int hvoStText, Set<int> objectsToDeleteAlso,
			SIL.FieldWorks.Common.Controls.ProgressState state)
		{
			// Enhance GordonM: When we add other subclasses of DsChart, we'll need to delete them too.
			if (m_cache.LangProject.DiscourseDataOA == null)
				return;
			if (m_cache.LangProject.DiscourseDataOA.ChartsOC == null)
				return;
			if (m_cache.LangProject.DiscourseDataOA.ChartsOC.Count == 0)
				return;
			state.SetMilestone(Strings.ksDeletingCharts);
			foreach (DsConstChart chart in m_cache.LangProject.DiscourseDataOA.ChartsOC)
			{
				if (chart.BasedOnRAHvo == hvoStText)
				{
					// We've found a chart on the Text that's going away.
					foreach (CmIndirectAnnotation ccr in chart.RowsRS)
					{
						objectsToDeleteAlso.AddRange(ccr.AppliesToRS.HvoArray);
						objectsToDeleteAlso.Add(ccr.Hvo);
					}
					objectsToDeleteAlso.Add(chart.Hvo);
					state.Breath();
				}
			}
		}
Example #19
0
		/// <summary>
		/// we want to delete the owning Text if we delete its StText
		/// </summary>
		/// <param name="objectsToDeleteAlso"></param>
		/// <param name="state"></param>
		public override void DeleteObjectSideEffects(SIL.FieldWorks.Common.Utils.Set<int> objectsToDeleteAlso,
			SIL.FieldWorks.Common.Controls.ProgressState state)
		{
			if (this.OwningFlid == (int)FDO.Ling.Text.TextTags.kflidContents)
			{
					objectsToDeleteAlso.Add(this.OwnerHVO);	// delete the owning Text as well.
					DeleteCharts(this.Hvo, objectsToDeleteAlso, state);
			}
			// Wasn't sure we wanted to delete the owning ScrSection in this case.
			if (this.OwningFlid == kflidScrSectContent)
				DeleteCharts(this.Hvo, objectsToDeleteAlso, state);
			base.DeleteObjectSideEffects(objectsToDeleteAlso, state);
		}
Example #20
0
		/// <summary>
		/// Get rid of referring FsFeatureSpecification objects as well, plus any of their owners which would then be empty.
		/// </summary>
		/// <param name="objectsToDeleteAlso"></param>
		/// <param name="state"></param>
		public override void DeleteObjectSideEffects(Set<int> objectsToDeleteAlso, SIL.FieldWorks.Common.Controls.ProgressState state)
		{
			List<LinkedObjectInfo> backRefs = BackReferences;
			for (int i = 0; i < backRefs.Count; i++)
			{
				LinkedObjectInfo loi = backRefs[i];

				if (loi.RelObjClass == (int)FsFeatureSpecification.kclsidFsFeatureSpecification &&
					loi.RelObjField == (int)FsFeatureSpecification.FsFeatureSpecificationTags.kflidFeature)
				{
					objectsToDeleteAlso.Add(loi.RelObjId);

					int ownerId = m_cache.GetOwnerOfObject(loi.RelObjId);
					int ownerClass = m_cache.GetClassOfObject(ownerId);

					RemoveUnwantedFeatureStuff(objectsToDeleteAlso, ownerId, ownerClass);
				}
			}
			base.DeleteObjectSideEffects(objectsToDeleteAlso, state);
		}
		/// <summary>
		/// Handle interaction between to and from POS for a derivational affix MSA.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		/// <remarks>
		/// If the new value is zero, then set the other one's value to zero, as well.
		/// If the other one's value is zero, then set it to the new value.
		/// In all cases, set this one's value to the new value.
		/// </remarks>
		protected void OnReferenceChanged(object sender, SIL.FieldWorks.Common.Utils.FwObjectSelectionEventArgs e)
		{
			Debug.Assert(sender is AtomicReferenceLauncher);
			AtomicReferenceLauncher source = (AtomicReferenceLauncher)sender;
			Debug.Assert(Control == source);
			Debug.Assert(Object is MoDerivAffMsa);

			AtomicReferenceLauncher otherControl = null;
			int idxSender = Parent.Controls.IndexOf(this);
			int otherFlid;
			bool myIsFromPOS = true;
			if (m_flid == (int)MoDerivAffMsa.MoDerivAffMsaTags.kflidFromPartOfSpeech)
				otherFlid = (int)MoDerivAffMsa.MoDerivAffMsaTags.kflidToPartOfSpeech;
			else
			{
				otherFlid = (int)MoDerivAffMsa.MoDerivAffMsaTags.kflidFromPartOfSpeech;
				myIsFromPOS = false;
			}
			int otherHvo = 0;
			Slice otherSlice = null;
			int idxOther;
			if (idxSender > 0)
			{
				idxOther = idxSender - 1;
				while (otherSlice == null || (otherSlice.Indent == Indent && idxOther > 0 && otherSlice.Object == Object))
				{
					otherSlice = (Slice)Parent.Controls[idxOther--];
					if (otherSlice is AtomicReferenceSlice && (otherSlice as AtomicReferenceSlice).Flid == otherFlid)
						break;
				}
				if (otherSlice != null && otherSlice is AtomicReferenceSlice)
					otherHvo = GetOtherHvo(otherSlice as AtomicReferenceSlice, otherFlid, myIsFromPOS, out otherControl);
				else
					otherSlice = null;
			}
			if (otherControl == null && idxSender < Parent.Controls.Count)
			{
				idxOther = idxSender + 1;
				while (otherSlice == null
					|| (otherSlice.Indent == Indent && idxOther > 0 && otherSlice.Object == Object))
				{
					otherSlice = (Slice)Parent.Controls[idxOther++];
					if (otherSlice is AtomicReferenceSlice && (otherSlice as AtomicReferenceSlice).Flid == otherFlid)
						break;
				}
				if (otherSlice != null && otherSlice is AtomicReferenceSlice)
					otherHvo = GetOtherHvo(otherSlice as AtomicReferenceSlice, otherFlid, myIsFromPOS, out otherControl);
				else
					otherSlice = null;
			}

			MoDerivAffMsa msa = Object as MoDerivAffMsa;
			if (e.Hvo == 0 && otherHvo != 0)
			{
				if (otherControl == null)
				{
					otherControl.AddItem(0); // Clear the other one, as well.
				}
				else
				{
					if (m_flid == (int)MoDerivAffMsa.MoDerivAffMsaTags.kflidFromPartOfSpeech)
						msa.ToPartOfSpeechRAHvo = 0;
					else
						msa.FromPartOfSpeechRAHvo = 0;
				}
			}
			else if (otherHvo == 0 && e.Hvo > 0)
			{
				if (otherControl == null)
				{
					// The other one is not available (filtered out?),
					// so set it directly using the msa.
					if (m_flid == (int)MoDerivAffMsa.MoDerivAffMsaTags.kflidFromPartOfSpeech)
						msa.ToPartOfSpeechRAHvo = e.Hvo;
					else
						msa.FromPartOfSpeechRAHvo = e.Hvo;
				}
				else
				{
					otherControl.AddItem(e.Hvo); // Set the other guy to this value.
				}
			}
		}
Example #22
0
		void m_currentBrowseView_CheckBoxChanged(object sender, SIL.FieldWorks.Common.Controls.CheckBoxChangedEventArgs e)
		{
			CheckAssignBtnEnabling();
		}
Example #23
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Override to make sure any CmFiles that are only there only for this picture are
		/// deleted as well
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public override void DeleteObjectSideEffects(Set<int> objectsToDeleteAlso, SIL.FieldWorks.Common.Controls.ProgressState state)
		{
			ICmFile cmFile = PictureFileRA;

			// Check to make sure there is a picture file associated with this picture and that the only thing that CmFile is
			// around for is to provide a file for this picture.  Checking that the backreference of the file that this picture
			// uses is 1 is a valid way to make sure of this.
			// If this CmFile serves no other purpose, we should get rid of it.
			if (cmFile != null && cmFile.BackReferences.Count == 1)
			{
				objectsToDeleteAlso.Add(cmFile.Hvo);
			}

			base.DeleteObjectSideEffects(objectsToDeleteAlso, state);
		}
Example #24
0
		/// <summary>
		/// Add the CmFile referenced by MediaFile to the list of objects to delete if we're
		/// the only reference to it.
		/// </summary>
		/// <param name="objectsToDeleteAlso"></param>
		/// <param name="state"></param>
		public override void DeleteObjectSideEffects(Set<int> objectsToDeleteAlso,
			SIL.FieldWorks.Common.Controls.ProgressState state)
		{
			if (MediaFileRAHvo != 0)
			{
				List<LinkedObjectInfo> backRefs = MediaFileRA.BackReferences;
				if (backRefs != null && backRefs.Count == 1)
				{
					LinkedObjectInfo loi = backRefs[0];
					if (loi != null && loi.RelObjId == this.Hvo)
						objectsToDeleteAlso.Add(MediaFileRAHvo);
				}
			}
			base.DeleteObjectSideEffects(objectsToDeleteAlso, state);
		}
Example #25
0
		/// <summary>
		/// This method is the one to override if you need side effects when DeleteUnderlyingObject
		/// is called. If other objects should be deleted also, do NOT delete them directly; this
		/// tends to produce abysmal performance. Rather, add them to objectsToDeleteAlso, and the
		/// whole lot (including this) will be deleted in one relatively efficient operation.
		/// You should not modify objectsToDeleteAlso except to add HVOs to it.
		/// You must not use the FDO object after calling this, it has been put into the deleted state.
		/// </summary>
		/// <param name="objectsToDeleteAlso">hashtable of HVOs (value typically just true, it's really a set).</param>
		/// <param name="state"></param>
		public override void DeleteObjectSideEffects(Set<int> objectsToDeleteAlso, SIL.FieldWorks.Common.Controls.ProgressState state)
		{
			List<LinkedObjectInfo> linkedObjects = LinkedObjects;
			foreach (LinkedObjectInfo loi in linkedObjects)
			{
				if (loi.RelObjClass == FsClosedValue.kclsidFsClosedValue)
					objectsToDeleteAlso.Add(loi.RelObjId);
			}

			base.DeleteObjectSideEffects(objectsToDeleteAlso, state);
		}
Example #26
0
		void BrowseViewer_FilterChanged(object sender, SIL.FieldWorks.Filters.FilterChangeEventArgs e)
		{
			SetFilterStatus(e.Added != null);
			SetRecordStatus();
		}
		/// <summary></summary>
		public void GetWritingSystems(SIL.FieldWorks.Common.COMInterfaces.ArrayPtr rgws, int cws)
		{
			throw new NotImplementedException();
		}
Example #28
0
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// The core of the Draw() method, where the rectangle actually gets painted.
		/// Vertical views use a rotated drawing routine.
		/// </summary>
		/// <param name="vdrb"></param>
		/// <param name="rootb"></param>
		/// <param name="hdc"></param>
		/// <param name="drawRect"></param>
		/// <param name="backColor"></param>
		/// <param name="drawSel"></param>
		/// <param name="clipRect"></param>
		/// -----------------------------------------------------------------------------------
		public override void DrawTheRoot(IVwDrawRootBuffered vdrb, IVwRootBox rootb, IntPtr hdc,
			SIL.Utils.Rect drawRect, uint backColor, bool drawSel,
			Rectangle clipRect)
		{
			vdrb.DrawTheRootRotated(rootb, hdc, drawRect, backColor,
				drawSel, m_site, 1);
		}
		/// <summary></summary>
		public SIL.FieldWorks.Common.COMInterfaces.IRenderEngine get_Renderer(int ws, SIL.FieldWorks.Common.COMInterfaces.IVwGraphics _vg)
		{
			throw new NotImplementedException();
		}
Example #30
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="smallImages"></param>
 /// <param name="mediator"></param>
 /// <returns></returns>
 public void Init(SIL.Utils.ImageCollection smallImages,  IUIMenuAdapter menuBarAdapter, Mediator mediator)
 {
 }
		/// <summary></summary>
		public SIL.FieldWorks.Common.COMInterfaces.IRenderEngine get_RendererFromChrp(IVwGraphics vg, ref SIL.FieldWorks.Common.COMInterfaces.LgCharRenderProps _chrp)
		{
			throw new NotImplementedException();
		}
		/// <summary>
		/// Display the combo box at the specified location, or the list box pulled down from the specified location.
		/// </summary>
		/// <param name="loc"></param>
		public void Activate(SIL.Utils.Rect loc)
		{
			CheckDisposed();

			FwComboBox combo = m_combo as FwComboBox;
			if (combo != null)
			{

				combo.Location = new System.Drawing.Point(loc.left, loc.top);
				// 21 is the default height of a combo, the smallest reasonable size.
				combo.Size = new System.Drawing.Size(Math.Max(loc.right - loc.left + 30, 200), Math.Max( loc.bottom - loc.top, 50));
				if (!m_owner.Controls.Contains(combo))
					m_owner.Controls.Add(combo);
			}
			else
			{
				ComboListBox c = (m_combo as ComboListBox);
				c.AdjustSize(500, 400); // these are maximums!
				c.Launch(m_owner.RectangleToScreen(loc), Screen.GetWorkingArea(m_owner));
			}
		}
		/// <summary></summary>
		public void InterpretChrp(ref SIL.FieldWorks.Common.COMInterfaces.LgCharRenderProps _chrp)
		{
			throw new NotImplementedException();
		}