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="sc_ScHeaderFieldsObj" script:language="StarBasic">
4
5'*************************************************************************
6'
7'  Licensed to the Apache Software Foundation (ASF) under one
8'  or more contributor license agreements.  See the NOTICE file
9'  distributed with this work for additional information
10'  regarding copyright ownership.  The ASF licenses this file
11'  to you under the Apache License, Version 2.0 (the
12'  "License"); you may not use this file except in compliance
13'  with the License.  You may obtain a copy of the License at
14'
15'    http://www.apache.org/licenses/LICENSE-2.0
16'
17'  Unless required by applicable law or agreed to in writing,
18'  software distributed under the License is distributed on an
19'  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
20'  KIND, either express or implied.  See the License for the
21'  specific language governing permissions and limitations
22'  under the License.
23'
24'*************************************************************************
25
26
27
28
29
30' Be sure that all variables are dimensioned:
31option explicit
32
33
34' REQUIRED VARIABLES for interface/service tests:
35
36Sub CreateObj()
37
38'*************************************************************************
39' COMPONENT:
40' sc.ScHeaderFieldsObj
41'*************************************************************************
42On Error Goto ErrHndl
43
44	Dim StyleFamilies as Object, PageStyles as Object, DefaultStyle As Object
45	Dim RPHC as Object, tLeft as Object, TimeField as Object, oCur As Object
46
47    oDoc = utils.createDocument("scalc", cObjectName)
48
49    StyleFamilies = oDoc.getStyleFamilies()
50    PageStyles = StyleFamilies.getByName("PageStyles")
51    DefaultStyle = PageStyles.getByName("Default")
52
53    RPHC = DefaultStyle.getPropertyValue("RightPageHeaderContent")
54    tLeft = RPHC.getLeftText
55    TimeField = oDoc.createInstance("com.sun.star.text.TextField.Time")
56    oCur = tLeft.createTextCursor()
57    tLeft.insertTextContent(oCur, TimeField, false)
58
59    oObj=tLeft.getTextFields()
60
61Exit Sub
62ErrHndl:
63    Test.Exception()
64End Sub
65</script:module>
66