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="xmloff_Impress_XMLContentImporter" 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 sPageName As String
42
43' Required for  com.sun.star.document.XImporter:
44  Global oSrcDocument As Object
45
46
47Sub CreateObj()
48
49'*************************************************************************
50' COMPONENT:
51' xmloff.Impress.XMLContentImporter
52'*************************************************************************
53On Error Goto ErrHndl
54    oDoc = utils.createImpressDocument(cObjectName)
55    oObj = createUnoService("com.sun.star.comp.Draw.XMLContentImporter")
56
57    oSrcDocument = oDoc
58    oObj.setTargetDocument(oDoc)
59
60    sPageName = "XMLImporterPage"
61    vXMLData = Array( _
62            Array("start", "office:document", _
63                "xmlns:office", "CDATA", "http://openoffice.org/2000/office", _
64                "xmlns:presentation", "CDATA", "http://openoffice.org/2000/presentation", _
65                "xmlns:svg", "CDATA", "http://openoffice.org/2000/svg", _
66                "xmlns:draw", "CDATA", "http://openoffice.org/2000/drawing", _
67                "office:class", "CDATA", "presentation", _
68                "office:version", "CDATA", "1.0"), _
69            Array("start", "office:body"), _
70            Array("start", "draw:page", _
71                "draw:name", "CDATA", sPageName, _
72                "draw:master-page-name", "CDATA", "Default"), _
73            Array("start", "presentation:notes"), _
74            Array("start", "draw:page-thumbnail", _
75                "draw:style-name", "CDATA", "gr1", _
76                "draw:layer", "CDATA", "layout", _
77                "svg:width", "CDATA", "12.768cm", _
78                "svg:height", "CDATA", "9.576cm", _
79                "svg:x", "CDATA", "4.411cm", _
80                "svg:y", "CDATA", "2.794cm", _
81                "presentation:class", "CDATA", "page", _
82                "draw:page-number", "CDATA", "1"), _
83            Array("end", "draw:page-thumbnail"), _
84            Array("start", "draw:text-box", _
85                "presentation:style-name", "CDATA", "Default-notes", _
86                "draw:layer", "CDATA", "layout", _
87                "svg:width", "CDATA", "15.021cm", _
88                "svg:height", "CDATA", "10.63cm", _
89                "svg:x", "CDATA", "3.292cm", _
90                "svg:y", "CDATA", "13.299cm", _
91                "presentation:class", "CDATA", "notes", _
92                "presentation:placeholder", "CDATA", "true"), _
93            Array("end", "draw:text-box"), _
94            Array("end", "presentation:notes"), _
95            Array("end", "draw:page"), _
96            Array("end", "office:body"), _
97            Array("end", "office:document"))
98Exit Sub
99ErrHndl:
100    Test.Exception()
101End Sub
102
103Function CheckImport() As Boolean
104    Dim i As Integer
105    Dim res As Boolean
106    Dim oPages, oPage As Object
107    Dim pageName As String
108    res = False
109    out.log("checking of import...")
110    oPages = oDoc.getDrawPages()
111    out.log("Draw pages:")
112    For i = 0 to oPages.getCount() - 1
113        oPage = oPages.getByIndex(i)
114        pageName = oPage.getName()
115        out.log(pageName)
116        If pageName = sPageName then
117            res = True
118        EndIf
119    Next i
120    out.log("checking result: " + res)
121    CheckImport() = res
122End Function
123</script:module>
124