summaryrefslogtreecommitdiff
path: root/userguides/sanitycheck/SanityCheck/Campos.xba
blob: 252b657e4409c915b9a8f9f2be769a9dcd1b1fc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Campos" script:language="StarBasic" script:moduleType="normal">REM  *****  BASIC  Módulo Campos *****
Option Explicit

 Private oDlgProps

 Rem ############
Sub Dlg_Campos
   
   Call L10n.Trad_Campos 
   If  Thiscomponent.HasLocation = false then : Msgbox (C_Txt(16),0+48+0, Extension) : Exit Sub : End If
   Call Comunes.Carga_Tools
   DialogLibraries.loadLibrary(&quot;SanityCheck&quot;)
   oDlgProps = CreateUnoDialog(DialogLibraries.getByName(&quot;SanityCheck&quot;).getByName(&quot;DlgCampos&quot;))
   Call Campos.Cargar_Parametros
   oDlgProps.execute
   
End sub

 Rem ############
Sub Cargar_Parametros

 Dim oDocprops : oDocProps = ThisComponent.getDocumentProperties
 Dim oUDP : oUDP = oDocProps().UserDefinedProperties   
 Dim archivo : archivo = ConvertFromURL(GetFileNameWithoutExtension(ThisComponent.getURL(), &quot;/&quot;))

 Dim version
   With oDlgProps.getModel
      .TiTle = C_Txt(15)
     .getbyname(&quot;Lbl_Doc&quot;).label = C_Txt(0)
     .getbyname(&quot;Lbl_DocT&quot;).label = C_Txt(1) 
     .getbyname(&quot;Lbl_Conex&quot;).label = C_Txt(2)
     .getbyname(&quot;Lbl_Guía&quot;).label = C_Txt(3)
     .getbyname(&quot;Lbl_Version&quot;).label = C_Txt(4)
  &apos;   .getbyname(&quot;Lbl_Capitulo&quot;).label = C_Txt(5)
     .getbyname(&quot;Fr_Titulo&quot;).label = C_Txt(6)
     .getbyname(&quot;Fr_Publicacion&quot;).label = C_Txt(7)
     .getbyname(&quot;Btn_Corregir&quot;).label = C_Txt(9)
     .getbyname(&quot;Btn_Cambia&quot;).label = C_Txt(10)
     .getbyname(&quot;Lbl_Establecidas&quot;).label = C_Txt(13)
 &apos;    .getbyname(&quot;List_Mes&quot;).StringItemList = Lista
     .getbyname(&quot;Lbl_Archivo&quot;).label = archivo
     .getbyname(&quot;Lbl_DocTitle&quot;).label = oDocProps.Title

     If oDocProps.TemplateName &lt;&gt; &quot;&quot; then 
     .getbyname(&quot;Lbl_Plantilla&quot;).label = oDocProps.TemplateName
     End If

     If NOT oUDP.getPropertySetInfo().hasPropertyByName(&quot;LibreOffice Version&quot;) then
       .getbyname(&quot;Num_Version&quot;).Value = 24
       .getbyname(&quot;Num_Sub&quot;).Value = 2
     Else
       version = Split(Consulta(&quot;LibreOffice Version&quot;),&quot;.&quot;)
       .getbyname(&quot;Num_Version&quot;).Value = Version(0)
       .getbyname(&quot;Num_Sub&quot;).Value = Version(1)
     End If    
     .getbyname(&quot;Tx_Guia&quot;).Text = Consulta(&quot;Guide Name&quot;)
&apos;     .getbyname(&quot;Num_Cap&quot;).Value = Consulta(&quot;Chapter Number&quot;)
     .getbyname(&quot;Tx_Cap_N&quot;).Text = Consulta(&quot;Chapter Number&quot;)
     .getbyname(&quot;Tx_Cap_T&quot;).Text = Consulta(&quot;Chapter Title&quot;)
     .getbyname(&quot;Lbl_Mes&quot;).Label = Consulta(&quot;Month&quot;)
     If Consulta(&quot;Year&quot;) = &quot;&quot; then
       .getbyname(&quot;Num_Ano&quot;).Value = 2024
     else
       .getbyname(&quot;Num_Ano&quot;).Value = CSng(Consulta(&quot;Year&quot;))
     End If
     .getbyname(&quot;Num_Version&quot;).Enabled = True
     .getbyname(&quot;Num_Sub&quot;).Enabled = True
     .getbyname(&quot;Tx_Guia&quot;).Enabled = True
&apos;     .getbyname(&quot;Num_Cap&quot;).Enabled = True
     .getbyname(&quot;Tx_Cap_N&quot;).Enabled = True
     .getbyname(&quot;Tx_Cap_T&quot;).Enabled = True
     .getbyname(&quot;List_Mes&quot;).EnableVisible = True    
     .getbyname(&quot;Num_Ano&quot;).Enabled = True
     .getbyname(&quot;Lbl_Establecidas&quot;).EnableVisible = False
     .getbyname(&quot;Btn_Corregir&quot;).EnableVisible = False
     .getbyname(&quot;Btn_Salir&quot;).Label = C_Txt(12)
     .getbyname(&quot;Btn_Cambia&quot;).EnableVisible = True
   End With
End Sub

 Rem ############
Sub Cargar_Parametros2
   With oDlgProps.getModel
     .getbyname(&quot;Num_Version&quot;).Enabled = False
     .getbyname(&quot;Num_Sub&quot;).Enabled = False
     .getbyname(&quot;Tx_Guia&quot;).Enabled = False
&apos;     .getbyname(&quot;Num_Cap&quot;).Enabled = False
     .getbyname(&quot;Tx_Cap_N&quot;).Enabled = False
     .getbyname(&quot;Tx_Cap_T&quot;).Enabled = False
     .getbyname(&quot;Lbl_Mes&quot;).Label = Consulta(&quot;Month&quot;)
     .getbyname(&quot;List_Mes&quot;).EnableVisible = False
     .getbyname(&quot;Num_Ano&quot;).Enabled = False
     .getbyname(&quot;Lbl_Establecidas&quot;).EnableVisible = True
     .getbyname(&quot;Btn_Corregir&quot;).EnableVisible = True
     .getbyname(&quot;Btn_Salir&quot;).Label = C_Txt(11)
     .getbyname(&quot;Btn_Cambia&quot;).EnableVisible = False
   End With
End Sub

 Rem ############
Sub Onbtn_Establecer(oEv)

 Dim Dato as String
 Dim oDocprops : oDocProps = ThisComponent.getDocumentProperties
  oDlgProps = oEv.Source.Context

   If oDlgProps.getControl(&quot;List_Mes&quot;).SelectedItem() = &quot;&quot; Then
     Msgbox (C_Txt(17),,Extension)
     exit sub
   End If

   With oDlgProps.getModel  
     Dato = .getbyname(&quot;Tx_Guia&quot;).Text
     Establece_UDP(&quot;Guide Name&quot;, Dato)
     Dato = .getbyname(&quot;Num_Version&quot;).Value &amp; &quot;.&quot; &amp; .getbyname(&quot;Num_Sub&quot;).Value
     Establece_UDP(&quot;LibreOffice Version&quot;, Dato)
&apos;     Dato = .getbyname(&quot;Num_Cap&quot;).Value &apos;en lugar de Tx_Cap_N
&apos;     Establece_UDP(&quot;Chapter Number&quot;,Dato)
     Dato = .getbyname(&quot;Tx_Cap_N&quot;).Text
     Establece_UDP(&quot;Chapter Number&quot;, Dato)
     Dato = .getbyname(&quot;Tx_Cap_T&quot;).Text
     Establece_UDP(&quot;Chapter Title&quot;, Dato)
     Dato =  oDlgProps.getControl(&quot;List_Mes&quot;).SelectedItem() &apos;No model, sino control
     Establece_UDP(&quot;Month&quot;, Dato)
     Dato = CStr(.getbyname(&quot;Num_Ano&quot;).Value)
     Establece_UDP(&quot;Year&quot;, Dato)
&apos;     Dato = C_Txt(5) &amp; .getbyname(&quot;Num_Cap&quot;).Value &amp; &quot;, &quot; &amp; .getbyname(&quot;Tx_Cap_T&quot;).Text
&apos;     oDocProps.Title = Dato
&apos;     Dato = .getbyname(&quot;Tx_Cap_N&quot;).Text &amp; &quot;, &quot; &amp; .getbyname(&quot;Tx_Cap_T&quot;).Text
&apos;     oDocProps.Title = Dato
     Dato =  .getbyname(&quot;Tx_Guia&quot;).Text &amp; Chr(13) 
     If oDocProps.TemplateName &lt;&gt; &quot;&quot; then
       Dato = Dato &amp; C_Txt(14) &amp; oDocProps.TemplateName
     else
       Dato = Dato &amp; &quot;&quot;
     End If
     oDocProps.Description = Dato
     
   End With
  Call Campos.Cargar_Parametros2
End Sub

 Rem ############
Sub onBtn_Revisar(oEv)

   oDlgProps = oEv.Source.Context
   Call Campos.Cargar_Parametros
End Sub

 Rem ############
Sub onBtn_Salir(oEv)

   oDlgProps = oEv.Source.Context
   oDlgProps.EndExecute
End Sub

 Rem ############
Function Consulta(ByVal Propiedad)
 Dim oUDP : oUDP = ThisComponent.getDocumentProperties().UserDefinedProperties
 If NOT oUDP.getPropertySetInfo().hasPropertyByName(Propiedad) then
 Consulta = &quot;&quot;
 Else
 Consulta = oUDP.getPropertyValue(Propiedad)
 end if 
End Function  

 Rem ############
Sub Establece_UDP(sProp, sVal)

 Dim oDocprops : oDocProps = ThisComponent.getDocumentProperties()
 Dim oUDP : oUDP = oDocProps().UserDefinedProperties

   If NOT oUDP.getPropertySetInfo().hasPropertyByName(sProp) Then
     oUDP.addProperty(sProp, _
     com.sun.star.beans.PropertyAttribute.MAYBEVOID + _
     com.sun.star.beans.PropertyAttribute.REMOVEABLE + _
     com.sun.star.beans.PropertyAttribute.MAYBEDEFAULT, sVal)
    Else
     oUDP.setPropertyValue(Sprop, sVal)
    End If
&apos;removeProperty(name)
End Sub

 REM ================= Fin Propiedades ===========================================
</script:module>