update dev300-m58
[ooovba.git] / framework / test / test_filterregistration.bas
blob47a19acfc36d3d48b8a1d87fb87efa84adac45c8
1 rem _______________________________________________________________________________________________________________________________________
2 rem Test script for registering or changing filter of our configuration.
3 rem _______________________________________________________________________________________________________________________________________
5 Sub Main
6 Dim xFiterFactory as object
7 Dim sFilterName as string
9 xFilterFactory = createUNOService("com.sun.star.document.FilterFactory")
11 sFilterName = "MeinFilter_5"
13 rem AddFilter ( xFilterFactory, sFilterName )
14 ReadFilter ( xFilterFactory, sFilterName )
15 rem QueryFilters ( xFilterFactory )
17 xFilterFactory.flush()
19 End Sub
21 rem *************************************************************************************************************
22 Sub AddFilter( xFilterFactory, sFilterName )
23 Dim lProperties(8) as new com.sun.star.beans.PropertyValue
24 Dim lUserData (1) as string
26 lUserData(1) = "Userdata von TestFilter"
28 lProperties(0).Name = "Type"
29 lProperties(0).Value = "bmp_MS_Windows"
31 lProperties(1).Name = "UIName"
32 lProperties(1).Value = sFilterName
34 lProperties(2).Name = "DocumentService"
35 lProperties(2).Value = "com.sun.star.text.TextDocument"
37 lProperties(3).Name = "FilterService"
38 lProperties(3).Value = "com.sun.star.comp.framework.TestFilter"
40 lProperties(4).Name = "Flags"
41 lProperties(4).Value = 256
43 lProperties(5).Name = "UserData"
44 lProperties(5).Value = lUserData()
46 lProperties(6).Name = "FileFormatVersion"
47 lProperties(6).Value = 0
49 lProperties(7).Name = "TemplateName"
50 lProperties(7).Value = ""
52 xFilterFactory.insertByName( sFilterName, lProperties() )
53 End Sub
55 rem *************************************************************************************************************
56 Sub ReadFilter( xFilterFactory, sFilterName )
57 rem Dim lFilters() as com.sun.star.beans.PropertyValue
58 Dim sOut as string
59 Dim nCount as integer
61 lProperties = xFilterFactory.getByName( sFilterName )
63 sOut = ""
64 for nCount=0 to ubound(lProperties()) step 1
65 sOut = sOut + lProperties(nCount).Name
66 sOut = sOut + " = "
67 rem #85829# Disable follow if statement to produce bug!
68 rem if( lProperties(nCount).Name <> "UserData" ) then
69 sOut = sOut + lProperties(nCount).Value
70 rem endif
71 sOut = sOut + chr(13)
72 next nCount
74 msgbox sOut
75 End Sub
77 rem *************************************************************************************************************
78 Sub QueryFilters( xFilterFactory )
79 Dim lFilters() as string
80 Dim sQuery as string
81 Dim sOut as string
82 Dim nCount as integer
84 sQuery = "_filterquery_defaultfilter"
85 rem sQuery = "_filterquery_textdocument_withdefault"
87 lFilters() = xFilterFactory.getByName( sQuery )
89 sOut = ""
90 for nCount=0 to ubound( lFilters() )
91 sOut = sOut + lFilters(nCount) + chr(13)
92 next nCount
94 msgbox sOut
95 End Sub