blob: d15d1174773ffb24f02c18ba6635faecb0219282 (
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
|
<?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="document_DocumentInfo" script:language="StarBasic">
'*************************************************************************
'
' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
'
' Copyright 2008 by Sun Microsystems, Inc.
'
' OpenOffice.org - a multi-platform office productivity suite
'
' $RCSfile: document_DocumentInfo.xba,v $
'
' $Revision: 1.4 $
'
' This file is part of OpenOffice.org.
'
' OpenOffice.org is free software: you can redistribute it and/or modify
' it under the terms of the GNU Lesser General Public License version 3
' only, as published by the Free Software Foundation.
'
' OpenOffice.org is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' GNU Lesser General Public License version 3 for more details
' (a copy is included in the LICENSE file that accompanied this code).
'
' You should have received a copy of the GNU Lesser General Public License
' version 3 along with OpenOffice.org. If not, see
' <http://www.openoffice.org/license.html>
' for a copy of the LGPLv3 License.
'
'*************************************************************************
'*************************************************************************
' Be sure that all variables are dimensioned:
option explicit
Sub RunTest()
'*************************************************************************
' SERVICE:
' com.sun.star.document.DocumentInfo
'*************************************************************************
On Error Goto ErrHndl
Dim bOK As Boolean
Dim pval As Variant, resVal As Variant
PropertyTester.TestProperty("Author")
PropertyTester.TestProperty("BlindCopiesTo")
PropertyTester.TestProperty("CopyTo")
testDateTime("CreationDate")
PropertyTester.TestProperty("Description")
PropertyTester.TestProperty("InReplyTo")
PropertyTester.TestProperty("Keywords")
PropertyTester.TestProperty("MIMEType")
testDateTime("ModifyDate")
PropertyTester.TestProperty("ModifiedBy")
PropertyTester.TestProperty("Newsgroups")
PropertyTester.TestProperty("Original")
Test.StartMethod("Priority")
bOK =true
pval = oObj.Priority
Out.Log("Was:" + pval)
oObj.Priority = pval + 1
resVal = oObj.Priority
Out.Log("Res:" + resVal)
bOK = bOK AND (pval + 1 = resVal)
Test.MethodTested("Priority", bOK)
PropertyTester.TestProperty("Recipient")
PropertyTester.TestProperty("References")
PropertyTester.TestProperty("ReplyTo")
PropertyTester.TestProperty("Theme")
PropertyTester.TestProperty("Title")
PropertyTester.TestProperty("Template")
testDateTime("TemplateDate")
PropertyTester.TestProperty("IsEncrypted")
testDateTime("PrintDate")
PropertyTester.TestProperty("PrintedBy")
PropertyTester.TestProperty("AutoloadEnabled")
PropertyTester.TestProperty("AutoloadURL")
Test.StartMethod("AutoloadSecs")
bOK =true
pval = oObj.AutoloadSecs
Out.Log("Was:" + pval)
oObj.AutoloadSecs = pval + 10
resVal = oObj.AutoloadSecs
Out.Log("Res:" + resval)
bOK = bOK AND (pval + 10 = resVal)
Test.MethodTested("AutoloadSecs", bOK)
PropertyTester.TestProperty("DefaultTarget")
PropertyTester.TestProperty("Generator")
PropertyTester.TestProperty("CreationDate")
PropertyTester.TestProperty("Subject")
PropertyTester.TestProperty("Language")
PropertyTester.TestProperty("ModifyDate")
PropertyTester.TestProperty("PrintDate")
PropertyTester.TestProperty("TemplateDate")
Exit Sub
ErrHndl:
Test.Exception()
resume next
End Sub
Sub testDateTime(propName As String)
Dim oldVal As Variant, resVal As Variant
Dim newVal As New com.sun.star.util.DateTime
Dim bOK As Boolean
bOK = true
Test.StartMethod(propName)
oldVal = oObj.getPropertyValue(propName)
Out.Log("OldVal :" + dateTime2String(oldVal))
if isNull(oldVal) then
newVal.Year = 2001
newVal.Month = 11
newVal.Day = 12
newVal.Hours = 16
newVal.Minutes = 14
newVal.Seconds = 48
newVal.HundredthSeconds = 0
else
newVal.Year = oldVal.Year
newVal.Month = oldVal.Month
newVal.Day = oldVal.Day
newVal.Hours = oldVal.Hours
newVal.Minutes = oldVal.Minutes
newVal.HundredthSeconds = oldVal.HundredthSeconds
newVal.Seconds = oldVal.Seconds + 1
if (newVal.Seconds > 59) then newVal.Seconds = 0
end if
Out.Log("NewVal :" + dateTime2String(newVal))
oObj.setPropertyValue(propName, newVal)
resVal = oObj.getPropertyValue(propName)
Out.Log("ResVal :" + dateTime2String(resVal))
bOK = bOK AND (newVal.Year = resVal.Year)
bOK = bOK AND (newVal.Month = resVal.Month)
bOK = bOK AND (newVal.Day = resVal.Day)
bOK = bOK AND (newVal.Hours = resVal.Hours)
bOK = bOK AND (newVal.Minutes = resVal.Minutes)
bOK = bOK AND (newVal.Seconds = resVal.Seconds)
bOK = bOK AND (newVal.HundredthSeconds = resVal.HundredthSeconds)
' ### The following property was not found in correspond IDL file! ###
Test.MethodTested(propName, bOK)
Exit Sub
ErrHndl:
Test.Exception()
bOK = false
resume next
End Sub
Function dateTime2String (dT As Variant) As String
dateTime2String = "" + dT.Day + "." + dT.Month + "." + dT.Year + _
" " + dT.Hours + ":" + dT.Minutes + ":" + dT.Seconds + "." + _
dT.HundredthSeconds
End Function
</script:module>
|