private void EditorForm_Load(object sender, EventArgs e) { SetLanguage(); Text = LangCtrl.GetString("dlg_MemoEditor", "Memo Editor"); LoadVoices(); if (DocList.Equals(null)) { DocList = new List <DOCData>(); } if (DocList.Count > 0) { int num = 0; mnu_LoadFile.Visible = false; mnu_Save.Visible = false; try { using (RPM_DataFile rpmDataFile = new RPM_DataFile()) { foreach (DOCData doc in DocList) { FileMemo memo = rpmDataFile.GetMemo(doc.RecId); if (PageBreak) { textControl1.Append(memo.Memo, StringStreamType.RichTextFormat, AppendSettings.StartWithNewSection); } else { textControl1.Append(memo.Memo, StringStreamType.RichTextFormat, AppendSettings.None); } IsReadOnly = true; ++num; } textControl1.EditMode = EditMode.ReadOnly; } } catch (Exception ex) { string message = ex.Message; } } else { try { if (!RTF.Equals(string.Empty)) { textControl1.Load(RTF, StringStreamType.RichTextFormat); } } catch { } } string stringData; textControl1.Save(out stringData, StringStreamType.RichTextFormat); Hash = stringData.GetHashCode(); textControl1.BackgroundStyle = BackgroundStyle.ColorScheme; textControl1.BorderStyle = TXTextControl.BorderStyle.None; }
/*------------------------------------------------------------------------------------------------------- ** CreateFootnotes method * * This method loops through all pages in order to check whether there are * footnote TextFields on that page. If yes, the footnote text is collected in * a temporary TextControl instance. * If there are footnotes on that page, a TextFrame is created which contains * the collected footnote texts. **-----------------------------------------------------------------------------------------------------*/ public void CreateFootnotes() { RemoveFootnoteFrames(); // loop through all pages foreach (TXTextControl.Page page in textControl1.GetPages()) { TXTextControl.TextControl tempTX = new TextControl(); tempTX.CreateControl(); tempTX.Font = new Font("Arial", 7F); tempTX.ViewMode = ViewMode.Normal; TXTextControl.TextFieldCollection.TextFieldEnumerator fieldEnum = textControl1.TextFields.GetEnumerator(); int fieldCounter = textControl1.TextFields.Count; // loop through all TextFields for (int i = 0; i <= fieldCounter; i++) { fieldEnum.MoveNext(); TXTextControl.TextField curField = (TXTextControl.TextField)fieldEnum.Current; // use field only, if it is a footnote field (starts with "FN:") // and if the field contains formatted text if (curField.Name.StartsWith("FN:") == false || curField.Name.Length <= 3) { continue; } // check whether the field is on the current page if (GetPageOfField(curField) == page.Number) { // add the formatted text to the temporary TextControl int startPos = tempTX.Selection.Start; tempTX.Selection.Load(curField.Name.Substring(3, curField.Name.Length - 3), StringStreamType.RichTextFormat); tempTX.Selection.Start = startPos; tempTX.Selection.Text = curField.Text + ") "; tempTX.Selection.Start = -1; } } if (tempTX.Text == "") { continue; } // insert a top frame border tempTX.Selection.Start = 0; tempTX.Selection.Text = "\r\n"; tempTX.Selection.Start = 0; tempTX.Selection.ParagraphFormat.RightIndent = 5000; tempTX.Selection.ParagraphFormat.Frame = Frame.TopLine; // measure the used text height int textHeight = tempTX.Lines[tempTX.Lines.Count].Baseline + 200; // create a new TextFrame based on the used text height TXTextControl.TextFrame frame = new TextFrame(new Size(page.TextBounds.Width, textHeight)); frame.Sizeable = false; frame.Moveable = false; frame.BorderWidth = 0; frame.Name = "FN"; frame.InternalMargins = new int[] { 0, 0, 0, 0 }; // add the TextFrame at the bottom border of the page textControl1.TextFrames.Add( frame, page.Number, new Point((int)(textControl1.Sections[page.Section].Format.PageMargins.Left * iDpi - 55), (int)textControl1.Sections[page.Section].Format.PageSize.Height * iDpi - (int)textControl1.Sections[page.Section].Format.PageMargins.Top * iDpi - 576 - frame.Size.Height), TextFrameInsertionMode.DisplaceCompleteLines); byte[] data = null; // save the formatted text from the temporary TextControl tempTX.Save(out data, BinaryStreamType.InternalUnicodeFormat); // and load it into the TextFrame frame.Selection.Load(data, BinaryStreamType.InternalUnicodeFormat); } }
public void PopularAbaPrincipal( TextBoxBase codigo, TextBoxBase cabeca, TextBoxBase processo, TextBoxBase nroordem, TextBoxBase reu, TextBoxBase forumVaraComarca, ComboBox tipoAcao, MaskedTextBox dataAjuizamento, TextBoxBase alerta, TextControl objetivo) { //Bindings ProcessoAtivo.IdAlterado += (antigo, novo) => codigo.Text = novo.ToString(); //Ao trocar o cabeça do processo, altera a referencia. ProcessoAtivo.CabecaAlterado += (antigo, novo) => { cabeca.Text = novo.Nome; }; //Ao Buscar, só altera os dados do cabeça. ProcessoAtivo.Cabeca.NomeAlterado += (antigo, novo) => { cabeca.Text = novo; }; processo.TextChanged += (sender, args) => { ProcessoAtivo.NumeroProcesso = processo.Text; }; ProcessoAtivo.NumeroProcessoAlterado += (antigo, novo) => processo.Text = novo; nroordem.TextChanged += (sender, args) => { ProcessoAtivo.NumeroOrdem = nroordem.Text; }; ProcessoAtivo.NumeroOrdemAlterado += (antigo, novo) => nroordem.Text = novo; reu.TextChanged += (sender, args) => { ProcessoAtivo.Reu = reu.Text; }; ProcessoAtivo.ReuAlterado += (antigo, novo) => reu.Text = novo; forumVaraComarca.TextChanged += (sender, args) => { ProcessoAtivo.Vara = forumVaraComarca.Text; }; ProcessoAtivo.VaraAlterado += (antigo, novo) => forumVaraComarca.Text = novo; tipoAcao.Items.AddRange(TiposAcao.Listar().ToArray()); tipoAcao.SelectedIndexChanged += (sender, args) => { ProcessoAtivo.TipoAcao = tipoAcao.SelectedItem == null ? null : (TipoAcao)tipoAcao.SelectedItem; }; ProcessoAtivo.TipoAcao.IdAlterado += (antigo, novo) => { foreach (TipoAcao tpAcao in tipoAcao.Items) { if (tpAcao.Id == novo) { tipoAcao.SelectedItem = tpAcao; break; } } }; dataAjuizamento.TextChanged += (sender, args) => { DateTime result = default(DateTime); if (DateTime.TryParseExact(dataAjuizamento.Text, "dd/MM/yyyy", CultureInfo.CurrentCulture, DateTimeStyles.AllowWhiteSpaces, out result)) { ProcessoAtivo.DataAjuizamentoAcao = result; } }; ProcessoAtivo.DataAjuizamentoAcaoAlterado += (antigo, novo) => dataAjuizamento.Text = novo.HasValue ? novo.Value.ToString("ddMMyyyy") : null; alerta.TextChanged += (sender, args) => { int valor = 0; if (Int32.TryParse(alerta.Text, out valor)) { ProcessoAtivo.QuantidadeDiasAlerta = valor; } else if (String.IsNullOrWhiteSpace(alerta.Text)) { ProcessoAtivo.QuantidadeDiasAlerta = null; } else { alerta.Text = ProcessoAtivo.QuantidadeDiasAlerta.HasValue ? ProcessoAtivo.QuantidadeDiasAlerta.Value.ToString() : String.Empty; } }; ProcessoAtivo.QuantidadeDiasAlertaAlterado += (antigo, novo) => alerta.Text = novo.ToString(); AoAdicionar += () => CarregarObjetivo(objetivo); AoLimpar += () => CarregarObjetivo(objetivo); AoBuscar += () => { CarregarObjetivo(objetivo); }; AoCancelar += () => { CarregarObjetivo(objetivo); }; AntesDeSalvar += () => { if (ProcessoAtivo.Responsaveis.Distinct().Count() != ProcessoAtivo.Responsaveis.Count) { DialogoAlerta.Mostrar("Erro", "Não é possível salvar um processo com 2 advogados iguais como responsáveis.", MessageBoxIcon.Error, MessageBoxButtons.OK); return false; } if (!String.IsNullOrWhiteSpace(objetivo.Text)) { string result = String.Empty; objetivo.Save(out result, StringStreamType.HTMLFormat); ProcessoAtivo.Objetivo = result; CarregarObjetivo(objetivo); } return true; }; }
public void PopularAbaObservacao( TextControl observacao ) { AoBuscar += () => { CarregarObservacoes(observacao); }; AoCancelar += () => { CarregarObservacoes(observacao); }; AntesDeSalvar += () => { if (!String.IsNullOrWhiteSpace(observacao.Text)) { string result = String.Empty; observacao.Save(out result, StringStreamType.HTMLFormat); ProcessoAtivo.Observacao = result; CarregarObservacoes(observacao); } return true; }; }
public void PopularAbaAndamento( TextControl txtAndamento, TextControl txtRegistroAndamento ) { AoBuscar += () => { GetRegistroAndamento(txtRegistroAndamento); }; AoAdicionar += () => { GetRegistroAndamento(txtRegistroAndamento); }; AoLimpar += () => { GetRegistroAndamento(txtRegistroAndamento); }; AoCancelar += () => { GetRegistroAndamento(txtRegistroAndamento); }; AntesDeSalvar += () => { if (!String.IsNullOrWhiteSpace(txtAndamento.Text)) { Recorte recorte = new Recorte(ProcessoAtivo, Sessao.UsuarioAtual); string result; txtAndamento.Save(out result, StringStreamType.HTMLFormat); recorte.TextoRecorte = result; recorte.DataInclusao = DateTime.Now; ProcessoAtivo.Recortes.Add(recorte); txtAndamento.Text = String.Empty; GetRegistroAndamento(txtRegistroAndamento); } return true; }; }
public void PopularAbaAtendimento( TextControl txtAtendimento ) { AoBuscar += () => { CarregarAndamento(txtAtendimento); }; AoCancelar += () => { CarregarAndamento(txtAtendimento); }; AntesDeSalvar += () => { if (!String.IsNullOrWhiteSpace(txtAtendimento.Text)) { string result = String.Empty; txtAtendimento.Save(out result, StringStreamType.HTMLFormat); ClienteAtivo.Atendimento = result; CarregarAndamento(txtAtendimento); } return true; }; }