1 rem _______________________________________________________________________________________________________________________________________
2 rem Test script for registering or changing filter of our configuration.
3 rem _______________________________________________________________________________________________________________________________________
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()
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() )
55 rem *************************************************************************************************************
56 Sub ReadFilter( xFilterFactory
, sFilterName
)
57 rem Dim lFilters() as com.sun.star.beans.PropertyValue
61 lProperties
= xFilterFactory
.getByName( sFilterName
)
64 for nCount
=0 to ubound(lProperties()) step
1
65 sOut
= sOut
+ lProperties(nCount
).Name
67 rem #85829# Disable follow if statement to produce bug!
68 rem if( lProperties(nCount).Name <> "UserData" ) then
69 sOut
= sOut
+ lProperties(nCount
).Value
77 rem *************************************************************************************************************
78 Sub QueryFilters( xFilterFactory
)
79 Dim lFilters() as string
84 sQuery
= "_filterquery_defaultfilter"
85 rem sQuery = "_filterquery_textdocument_withdefault"
87 lFilters() = xFilterFactory
.getByName( sQuery
)
90 for nCount
=0 to ubound( lFilters() )
91 sOut
= sOut
+ lFilters(nCount
) + chr(13)