1 rem _______________________________________________________________________________________________________________________________________
2 rem Test script for helper class "framework/helper/OComponentAccess and OComponentEnumeration.
3 rem These two classes are used for "framework/baeh_services/Desktop::getComponents()" only.
4 rem _______________________________________________________________________________________________________________________________________
9 rem ___________________________________________________________________________________________________________________________________
10 rem Get all current components of the frame tree as an enumeration access object.
11 rem The return value must be a valid reference!
12 xComponentAccess
= StarDesktop
.Components
13 if( isNull(xComponentAccess
) = TRUE ) then
14 msgbox
"Error: Desktop return null reference as enumeration access to all tree components!"
18 rem ___________________________________________________________________________________________________________________________________
19 rem Control service specification of helper class "framework/helper/OComponentAccess".
20 rem The follow output must occure: com.sun.star.lang.XTypeProvider
21 rem com.sun.star.container.XEnumerationAccess -> com.sun.star.container.XElementAccess
22 msgbox xComponentAccess
.dbg_supportedInterfaces
24 rem ___________________________________________________________________________________________________________________________________
25 rem Test interface XElementAccess of helper OComponentAcces.
27 rem Method hasElements() must return TRUE, because if you call this from the basic IDE at least one task must exist ...
28 rem the IDE by himself. Normaly two tasks exist - an empty writer document and a basic frame.
29 rem Attention: Not all tasks or frames must support a full implemented component!
30 if( xComponentAccess
.hasElements
<> TRUE ) then
31 msgbox
"Error: xComponentAccess has no elements - but I can't believe it!"
35 rem Method getElementType() must return the cppu type of XComponent.
36 rem Otherwise something is wrong or implementation has changed.
37 if( xComponentAccess
.getElementType
.Name
<> "com.sun.star.lang.XComponent" ) then
38 msgbox
"Error: xComponentAccess return wrong type as element type! - Has implementation changed?"
42 rem ___________________________________________________________________________________________________________________________________
43 rem Test interface XEnumerationAccess of helper OComponentAcces.
44 rem The return value must be a valid reference!
45 xComponentEnumeration
= xComponentAccess
.createEnumeration
46 if( isNull(xComponentEnumeration
) = TRUE ) then
47 msgbox
"Error: Could not create a component enumeration!"
51 rem ___________________________________________________________________________________________________________________________________
52 rem Control service specification of helper class "framework/helper/OComponentEnumeration".
53 rem The follow output must occure: com.sun.star.lang.XTypeProvider
54 rem com.sun.star.lang.XEventListener
55 rem com.sun.star.container.XEnumeration
56 msgbox xComponentEnumeration
.dbg_supportedInterfaces
58 rem ___________________________________________________________________________________________________________________________________
59 rem Test interface XEnumeration of helper OComponentEnumeration.
61 while( xComponentEnumeration
.hasMoreElements
= TRUE )
62 xElement
= xComponentEnumeration
.nextElement
63 if( isNull(xElement
) = TRUE ) then
64 msgbox
"Error: An empty component in enumeration detected! Whats wrong?"
67 nElementCounter
= nElementCounter
+ 1
69 if( nElementCounter
< 1 ) then
70 msgbox
"Warning: The enumeration was empty. I think it's wrong ... please check it again."
72 msgbox
"Info: An enumeration with " + nElementCounter
+ " element(s) was detected."
74 rem ___________________________________________________________________________________________________________________________________
75 rem If this point arrived our test was successful.
76 msgbox
"Test of framework/helper/OComponentAccess & OComponentEnumeration was successful!"