Skip to content

Commit

Permalink
1.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavo.gvs authored and gustavo.gvs committed Aug 8, 2023
1 parent 1ffa543 commit 18516fb
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 44 deletions.
34 changes: 18 additions & 16 deletions PeriTAB/Class_AnyButtonClick_Event.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Microsoft.Office.Tools.Ribbon;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
Expand Down Expand Up @@ -46,25 +47,26 @@ private void Metodo_AnyButtonClick_TaskPane(object sender, EventArgs e)

//Revisa o destaque dos botoes do TaskPane
Globals.ThisAddIn.iUserControl1.Remove_Destaque_Botoes();
Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); //inicia cronometro
foreach (Microsoft.Office.Interop.Word.Paragraph p in Globals.ThisAddIn.Application.Selection.Paragraphs)
{
if (stopWatch.Elapsed.TotalSeconds > 0.2) break; //limita tempo de processamento
Microsoft.Office.Interop.Word.Style s = p.Range.get_Style();
if (s.NameLocal == "01 - Sem Formatação (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button1(true, true);
if (s.NameLocal == "02 - Corpo do Texto (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button2(true, true);
if (s.NameLocal == "03 - Citações (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button3(true, true);
//if (s.NameLocal == "04 - Seções (PeriTAB)" & p.Range.ListFormat.ListLevelNumber == 1) Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button4(true, true);
//if (s.NameLocal == "04 - Seções (PeriTAB)" & p.Range.ListFormat.ListLevelNumber == 2) Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button5(true, true);
//if (s.NameLocal == "04 - Seções (PeriTAB)" & p.Range.ListFormat.ListLevelNumber == 3) Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button6(true, true);
//if (s.NameLocal == "04 - Seções (PeriTAB)" & p.Range.ListFormat.ListLevelNumber == 4) Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button7(true, true);
if (s.NameLocal == "04a - Seção_1 (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button4(true, true);
if (s.NameLocal == "04b - Seção_2 (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button5(true, true);
if (s.NameLocal == "04c - Seção_3 (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button6(true, true);
if (s.NameLocal == "04d - Seção_4 (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button7(true, true);
if (s.NameLocal == "05 - Enumerações (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button8(true, true);
if (s.NameLocal == "06 - Figuras (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button10(true, true);
if (s.NameLocal == "07 - Legendas de Figuras (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button11(true, true);
if (s.NameLocal == "08 - Legendas de Tabelas (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button12(true, true);
if (s.NameLocal == "09 - Quesitos (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button13(true, true);
if (s != null)
{
if (s.NameLocal == "01 - Sem Formatação (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button1(true, true);
if (s.NameLocal == "02 - Corpo do Texto (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button2(true, true);
if (s.NameLocal == "03 - Citações (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button3(true, true);
if (s.NameLocal == "04a - Seção_1 (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button4(true, true);
if (s.NameLocal == "04b - Seção_2 (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button5(true, true);
if (s.NameLocal == "04c - Seção_3 (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button6(true, true);
if (s.NameLocal == "04d - Seção_4 (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button7(true, true);
if (s.NameLocal == "05 - Enumerações (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button8(true, true);
if (s.NameLocal == "06 - Figuras (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button10(true, true);
if (s.NameLocal == "07 - Legendas de Figuras (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button11(true, true);
if (s.NameLocal == "08 - Legendas de Tabelas (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button12(true, true);
if (s.NameLocal == "09 - Quesitos (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button13(true, true);
}
}
}

Expand Down
47 changes: 22 additions & 25 deletions PeriTAB/Class_SelectionChange_Event.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Microsoft.Office.Interop.Word;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
Expand Down Expand Up @@ -44,31 +45,27 @@ private void Metodo_SelectionChange(Selection Sel)

//Revisa o destaque dos botoes do TaskPane
Globals.ThisAddIn.iUserControl1.Remove_Destaque_Botoes();
//try{
foreach (Microsoft.Office.Interop.Word.Paragraph p in Globals.ThisAddIn.Application.Selection.Paragraphs)
{
Microsoft.Office.Interop.Word.Style s = p.Range.get_Style();
if (s != null)
{
if (s.NameLocal == "01 - Sem Formatação (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button1(true, true);
if (s.NameLocal == "02 - Corpo do Texto (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button2(true, true);
if (s.NameLocal == "03 - Citações (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button3(true, true);
//if (s.NameLocal == "04 - Seções (PeriTAB)" & p.Range.ListFormat.ListLevelNumber == 1) Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button4(true, true);
//if (s.NameLocal == "04 - Seções (PeriTAB)" & p.Range.ListFormat.ListLevelNumber == 2) Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button5(true, true);
//if (s.NameLocal == "04 - Seções (PeriTAB)" & p.Range.ListFormat.ListLevelNumber == 3) Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button6(true, true);
//if (s.NameLocal == "04 - Seções (PeriTAB)" & p.Range.ListFormat.ListLevelNumber == 4) Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button7(true, true);
if (s.NameLocal == "04a - Seção_1 (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button4(true, true);
if (s.NameLocal == "04b - Seção_2 (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button5(true, true);
if (s.NameLocal == "04c - Seção_3 (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button6(true, true);
if (s.NameLocal == "04d - Seção_4 (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button7(true, true);
if (s.NameLocal == "05 - Enumerações (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button8(true, true);
if (s.NameLocal == "06 - Figuras (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button10(true, true);
if (s.NameLocal == "07 - Legendas de Figuras (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button11(true, true);
if (s.NameLocal == "08 - Legendas de Tabelas (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button12(true, true);
if (s.NameLocal == "09 - Quesitos (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button13(true, true);
}
}
//} catch { }
Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); //inicia cronometro
foreach (Microsoft.Office.Interop.Word.Paragraph p in Globals.ThisAddIn.Application.Selection.Paragraphs)
{
if (stopWatch.Elapsed.TotalSeconds > 0.2) break; //limita tempo de processamento
Microsoft.Office.Interop.Word.Style s = p.Range.get_Style();
if (s != null)
{
if (s.NameLocal == "01 - Sem Formatação (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button1(true, true);
if (s.NameLocal == "02 - Corpo do Texto (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button2(true, true);
if (s.NameLocal == "03 - Citações (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button3(true, true);
if (s.NameLocal == "04a - Seção_1 (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button4(true, true);
if (s.NameLocal == "04b - Seção_2 (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button5(true, true);
if (s.NameLocal == "04c - Seção_3 (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button6(true, true);
if (s.NameLocal == "04d - Seção_4 (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button7(true, true);
if (s.NameLocal == "05 - Enumerações (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button8(true, true);
if (s.NameLocal == "06 - Figuras (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button10(true, true);
if (s.NameLocal == "07 - Legendas de Figuras (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button11(true, true);
if (s.NameLocal == "08 - Legendas de Tabelas (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button12(true, true);
if (s.NameLocal == "09 - Quesitos (PeriTAB)") Globals.ThisAddIn.iUserControl1.Habilita_Destaca_button13(true, true);
}
}
}
}
}
2 changes: 1 addition & 1 deletion PeriTAB/PeriTAB.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<PublishUrl>C:\Users\gustavo.gvs.PF\OneDrive - Polícia Federal\PCF Gustavo\Visual Studio\PeriTAB\publicacoes\</PublishUrl>
<InstallUrl />
<TargetCulture>pt-BR</TargetCulture>
<ApplicationVersion>1.1.4.0</ApplicationVersion>
<ApplicationVersion>1.1.5.0</ApplicationVersion>
<AutoIncrementApplicationRevision>false</AutoIncrementApplicationRevision>
<UpdateEnabled>true</UpdateEnabled>
<UpdateInterval>0</UpdateInterval>
Expand Down
2 changes: 1 addition & 1 deletion PeriTAB/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
// É possível especificar todos os valores ou usar como padrão os Números da Versão e da Revisão
// utilizando o "*" como mostrado abaixo:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.4.*")]
[assembly: AssemblyVersion("1.1.5.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]

4 changes: 3 additions & 1 deletion PeriTAB/Ribbon1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ public class Variables

private void Ribbon1_Load(object sender, RibbonUIEventArgs e)
{
//MessageBox.Show("load");
//Escreve o Template na pasta tmp e adiciona ela como suplemento.
try { File.WriteAllBytes(Variables.caminho_template, Properties.Resources.Normal); } catch (IOException ex) { MessageBox.Show("PeriTAB_Template_tmp.dotm em uso"); Globals.ThisAddIn.Application.Quit(); return; }
//try { File.WriteAllBytes(Variables.caminho_template, Properties.Resources.Normal); } catch (IOException ex) { MessageBox.Show("PeriTAB_Template_tmp.dotm em uso"); Globals.ThisAddIn.Application.Quit(); return; }
File.WriteAllBytes(Variables.caminho_template, Properties.Resources.Normal);
Globals.ThisAddIn.Application.AddIns.Add(Variables.caminho_template);

// Escreve o número da versão
Expand Down
7 changes: 7 additions & 0 deletions PeriTAB/ThisAddIn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public partial class ThisAddIn

private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
//MessageBox.Show("Startup");
le_preferencias();

//Configura o Task Pane
Expand Down Expand Up @@ -49,6 +50,12 @@ private void MyCustomTaskPane_VisibleChanged(object sender, EventArgs e)

private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
if (File.Exists(Ribbon1.Variables.caminho_template))
{
Globals.ThisAddIn.Application.AddIns.Unload(true);
File.Delete(Ribbon1.Variables.caminho_template);
}
//Variables.caminho_template
escreve_preferencias();
}

Expand Down

0 comments on commit 18516fb

Please sign in to comment.