1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3<script:module xmlns:script="http://openoffice.org/2000/script" script:name="sm_XMLSettingsImporter" script:language="StarBasic">
4
5
6'*************************************************************************
7'
8'  Licensed to the Apache Software Foundation (ASF) under one
9'  or more contributor license agreements.  See the NOTICE file
10'  distributed with this work for additional information
11'  regarding copyright ownership.  The ASF licenses this file
12'  to you under the Apache License, Version 2.0 (the
13'  "License"); you may not use this file except in compliance
14'  with the License.  You may obtain a copy of the License at
15'
16'    http://www.apache.org/licenses/LICENSE-2.0
17'
18'  Unless required by applicable law or agreed to in writing,
19'  software distributed under the License is distributed on an
20'  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21'  KIND, either express or implied.  See the License for the
22'  specific language governing permissions and limitations
23'  under the License.
24'
25'*************************************************************************
26
27
28
29
30
31' Be sure that all variables are dimensioned:
32option explicit
33
34
35' REQUIRED VARIABLES for interface/service tests:
36
37' Required for com.sun.star.xml.sax.XDocumentHandler
38  Global vXMLData As Variant
39
40' Required for procedure CheckImport
41  Global sMargin As Integer
42
43' Required for  com.sun.star.document.XImporter:
44  Global oSrcDocument As Object
45
46
47
48Sub CreateObj()
49
50'*************************************************************************
51' COMPONENT:
52' sm.XMLSettingsImporter
53'*************************************************************************
54On Error Goto ErrHndl
55    oDoc = utils.createDocument("smath", cObjectName)
56    oObj = createUnoService("com.sun.star.comp.Math.XMLSettingsImporter")
57
58    oSrcDocument = oDoc
59    oObj.setTargetDocument(oDoc)
60
61    sMargin = "67"
62    vXMLData = Array( _
63        Array("start", "office:document-settings", _
64                "xmlns:office", "CDATA", "http://openoffice.org/2000/office", _
65                "xmlns:config", "CDATA", "http://openoffice.org/2001/config", _
66                "xmlns:xlink", "CDATA", "http://www.w3.org/1999/xlink", _
67                "office:version", "CDATA", "1.0"), _
68        Array("start", "office:settings"), _
69        Array("start", "config:config-item-set", _
70                "config:name", "CDATA", "configuration-settings"), _
71        Array("start", "config:config-item", _
72                "config:name", "CDATA", "TopMargin", _
73                "config:type", "CDATA", "short"), _
74        Array("chars", sMargin), _
75        Array("end", "config:config-item"), _
76        Array("end", "config:config-item-set"), _
77        Array("end", "office:settings"), _
78        Array("end", "office:document-settings"))
79Exit Sub
80ErrHndl:
81    Test.Exception()
82End Sub
83
84Function CheckImport() As Boolean
85    out.log("checking of import...")
86    Dim res As Boolean
87    Dim margin As String
88    margin = oDoc.getPropertyValue("TopMargin")
89    res = margin = sMargin
90    out.log("checking result: " + res)
91    CheckImport() = res
92End Function
93</script:module>
94