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("SanityCheck")
oDlgProps = CreateUnoDialog(DialogLibraries.getByName("SanityCheck").getByName("DlgCampos"))
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(), "/"))
Dim version
With oDlgProps.getModel
.TiTle = C_Txt(15)
.getbyname("Lbl_Doc").label = C_Txt(0)
.getbyname("Lbl_DocT").label = C_Txt(1)
.getbyname("Lbl_Conex").label = C_Txt(2)
.getbyname("Lbl_Guía").label = C_Txt(3)
.getbyname("Lbl_Version").label = C_Txt(4)
' .getbyname("Lbl_Capitulo").label = C_Txt(5)
.getbyname("Fr_Titulo").label = C_Txt(6)
.getbyname("Fr_Publicacion").label = C_Txt(7)
.getbyname("Btn_Corregir").label = C_Txt(9)
.getbyname("Btn_Cambia").label = C_Txt(10)
.getbyname("Lbl_Establecidas").label = C_Txt(13)
' .getbyname("List_Mes").StringItemList = Lista
.getbyname("Lbl_Archivo").label = archivo
.getbyname("Lbl_DocTitle").label = oDocProps.Title
If oDocProps.TemplateName <> "" then
.getbyname("Lbl_Plantilla").label = oDocProps.TemplateName
End If
If NOT oUDP.getPropertySetInfo().hasPropertyByName("LibreOffice Version") then
.getbyname("Num_Version").Value = 24
.getbyname("Num_Sub").Value = 2
Else
version = Split(Consulta("LibreOffice Version"),".")
.getbyname("Num_Version").Value = Version(0)
.getbyname("Num_Sub").Value = Version(1)
End If
.getbyname("Tx_Guia").Text = Consulta("Guide Name")
' .getbyname("Num_Cap").Value = Consulta("Chapter Number")
.getbyname("Tx_Cap_N").Text = Consulta("Chapter Number")
.getbyname("Tx_Cap_T").Text = Consulta("Chapter Title")
.getbyname("Lbl_Mes").Label = Consulta("Month")
If Consulta("Year") = "" then
.getbyname("Num_Ano").Value = 2024
else
.getbyname("Num_Ano").Value = CSng(Consulta("Year"))
End If
.getbyname("Num_Version").Enabled = True
.getbyname("Num_Sub").Enabled = True
.getbyname("Tx_Guia").Enabled = True
' .getbyname("Num_Cap").Enabled = True
.getbyname("Tx_Cap_N").Enabled = True
.getbyname("Tx_Cap_T").Enabled = True
.getbyname("List_Mes").EnableVisible = True
.getbyname("Num_Ano").Enabled = True
.getbyname("Lbl_Establecidas").EnableVisible = False
.getbyname("Btn_Corregir").EnableVisible = False
.getbyname("Btn_Salir").Label = C_Txt(12)
.getbyname("Btn_Cambia").EnableVisible = True
End With
End Sub
Rem ############
Sub Cargar_Parametros2
With oDlgProps.getModel
.getbyname("Num_Version").Enabled = False
.getbyname("Num_Sub").Enabled = False
.getbyname("Tx_Guia").Enabled = False
' .getbyname("Num_Cap").Enabled = False
.getbyname("Tx_Cap_N").Enabled = False
.getbyname("Tx_Cap_T").Enabled = False
.getbyname("Lbl_Mes").Label = Consulta("Month")
.getbyname("List_Mes").EnableVisible = False
.getbyname("Num_Ano").Enabled = False
.getbyname("Lbl_Establecidas").EnableVisible = True
.getbyname("Btn_Corregir").EnableVisible = True
.getbyname("Btn_Salir").Label = C_Txt(11)
.getbyname("Btn_Cambia").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("List_Mes").SelectedItem() = "" Then
Msgbox (C_Txt(17),,Extension)
exit sub
End If
With oDlgProps.getModel
Dato = .getbyname("Tx_Guia").Text
Establece_UDP("Guide Name", Dato)
Dato = .getbyname("Num_Version").Value & "." & .getbyname("Num_Sub").Value
Establece_UDP("LibreOffice Version", Dato)
' Dato = .getbyname("Num_Cap").Value 'en lugar de Tx_Cap_N
' Establece_UDP("Chapter Number",Dato)
Dato = .getbyname("Tx_Cap_N").Text
Establece_UDP("Chapter Number", Dato)
Dato = .getbyname("Tx_Cap_T").Text
Establece_UDP("Chapter Title", Dato)
Dato = oDlgProps.getControl("List_Mes").SelectedItem() 'No model, sino control
Establece_UDP("Month", Dato)
Dato = CStr(.getbyname("Num_Ano").Value)
Establece_UDP("Year", Dato)
' Dato = C_Txt(5) & .getbyname("Num_Cap").Value & ", " & .getbyname("Tx_Cap_T").Text
' oDocProps.Title = Dato
' Dato = .getbyname("Tx_Cap_N").Text & ", " & .getbyname("Tx_Cap_T").Text
' oDocProps.Title = Dato
Dato = .getbyname("Tx_Guia").Text & Chr(13)
If oDocProps.TemplateName <> "" then
Dato = Dato & C_Txt(14) & oDocProps.TemplateName
else
Dato = Dato & ""
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 = ""
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
'removeProperty(name)
End Sub
REM ================= Fin Propiedades ===========================================
</script:module>
|