summaryrefslogtreecommitdiff
path: root/wizards/source/webwizard/HtmlAutoPilotBasic.xba
blob: 576667416fc7a6f39b265e5ffb02dbea572a4c42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
<?xml version="1.0" encoding="UTF-8"?>

<script:module xmlns:script="http://openoffice.org/2000/script" script:name="HtmlAutoPilotBasic" script:language="StarBasic">&apos; Variables must be declared
Option Explicit

&apos; Maximum number of content templates, style templates and bullets
Const MaxLayouts = 50
Const MaxStyles = 100
Const MaxBullets = 10

Public NumberOfLayouts%, NumberOfStyles%

&apos; Filled with title, previous, next, home, top, bullet, background, file name
Public Style(8, MaxStyles) as String

&apos; Filled with title, file name
Public Layout$(2, MaxLayouts%)

Public TextureDir$, BulletDir$, GraphicsDir$, GalleryDir$, PhotosDir$
Public CurrentBullet$, CurrentPrev$, CurrentNext$, CurrentHome$, CurrentTop$
Public FileStr as String

Public WebWiz_gWizardName$, WebWiz_gErrContentNotFound$, WebWiz_gErrStyleNotFound$
Public WebWiz_gErrMainTemplateError$, WebWiz_gErrWhileReloading$
Public WebWiz_gErrWhileLoadStyles$, WebWiz_gErrMsg$, WebWiz_gErrMainDocumentError$

Public ProgressBar as Object
Public ProgressValue As Long
Public oBaseDocument as Object
Public oViewCursor as Object
Public oViewSettings as Object
Public NoArgs as New com.sun.star.beans.PropertyValue

Public oCursor as Object
Public oBookmarks as Object
Public oBookMark as Object

Public oUcb as Object
Public MainDialog as Object
Public DialogModel as Object


Sub Main
&apos;On Local Error Goto GlobalErrorHandler
        BasicLibraries.LoadLibrary(&quot;Tools&quot;)
	oUcb = createUnoService(&quot;com.sun.star.ucb.SimpleFileAccess&quot;)
	oBaseDocument = StarDesktop.LoadComponentFromURL(&quot;private:factory/swriter/web&quot;, &quot;_blank&quot;, 0, NoArgs())
	oViewSettings = oBaseDocument.CurrentController.ViewSettings

	oViewCursor = oBaseDocument.GetCurrentController.ViewCursor
	ProgressBar = oBaseDocument.GetCurrentController.GetFrame.CreateStatusIndicator
	ProgressBar.Start(&quot;&quot;, 100)
	SetProgressValue(2)
	oBaseDocument.LockControllers
	oViewSettings.ShowTableBoundaries = False
	oViewSettings.ShowTextBoundaries = False
	MainDialog = LoadDialog(&quot;WebWizard&quot;,&quot;WebWzrd&quot;)
	DialogModel = MainDialog.Model
	LoadLanguage
	SetProgressValue(10)
	GetPaths()
	NumberofLayouts = FillupWebListbox(oUcb, &quot;/cnt&quot;, MainDialog, &quot;lbTemplate&quot;, Layout$())
	SetProgressValue(30)
	GetCurIndex(DialogModel.lbTemplate, Layout(),NumberofLayouts,2)
	oCursor = oBasedocument.Text.CreateTextCursor
	oCursor.InsertDocumentfromURL(FileStr, NoArgs())
	SetProgressValue(40)
	DialogModel.optTiled.State = 1
	NumberofStyles = FillupWebListbox(oUcb, &quot;/stl&quot;, MainDialog, &quot;lbStyles&quot;, Style())
	SetProgressValue(50)
	LoadWebPageStyles(oBaseDocument)
	SetProgressValue(98)
	SetProgressValue(0)
	oBaseDocument.UnlockControllers
	MainDialog.Execute

GLOBALERRORHANDLER:
	If Err &lt;&gt; 0 Then
		MsgBox (WebWiz_gErrMsg$, 16, WebWiz_gWizardName$)
		CancelHTMLWizard()
	End If
End Sub


Function SetProgressValue(iValue as Integer)
	If iValue = 0 Then
		ProgressBar.End
	End If
	ProgressValue = iValue
	ProgressBar.Value = iValue
End Function


Sub ReloadCurrentDocument()
Dim CurInd as Integer
&apos;On Local Error Goto ErrorOcurred
&apos; Todo:Check if the pointer is really disabled, when set to Hourglass
	ToggleWindow(False)
	oBaseDocument.LockControllers
	&apos; Get selected list entry and corresponding file name
	CurInd = GetCurIndex(DialogModel.lbTemplate, Layout$(), NumberofLayouts%, 2)
	oCursor = oBaseDocument.Text.CreateTextCursor
	oCursor.GotoStart(False)
	oCursor.GotoEnd(True)
	oCursor.InsertDocumentfromURL(FileStr, NoArgs())
	SetBulletAndGraphics
	CheckControls(oBaseDocument.DrawPage)
ErrorOcurred:
	If Err &lt;&gt; 0 Then
		MsgBox(WebWiz_gErrWhileReloading$, 16, WebWiz_gWizardName$)
	End If
	oBaseDocument.UnlockControllers
	oViewCursor.GotoStart(False)
	ToggleWindow(True)
End Sub



Sub LoadWebPageStyles()
Dim CurIndex as Integer
	ToggleWindow(False)
	oBaseDocument.LockControllers
	CurIndex = GetCurIndex(DialogModel.lbStyles, Style(), NumberofStyles%,8)
	LoadNewStyles(oBaseDocument, DialogModel, CurIndex, FileStr, Style(), TextureDir)
	CurrentBullet$ = BulletDir + Style(6, CurIndex)
	CurrentPrev$ = GraphicsDir + Style(2, CurIndex)
	CurrentNext$ = GraphicsDir + Style(3, CurIndex)
	CurrentHome$ = GraphicsDir + Style(4, CurIndex)
	CurrentTop$ = GraphicsDir + Style(5, CurIndex)
	With oBaseDocument.DocumentInfo
		.GetUserFieldValue(0) = ExtractGraphicNames(CurIndex,2)
		.GetUserFieldValue(1) = ExtractGraphicNames(CurIndex, 4)
		.GetUserFieldValue(2) = Style(6, CurIndex)       &apos; Bullet
		.GetUserFieldValue(3) = Style(7, CurIndex)       &apos; Background
	End With
	SetBulletAndGraphics()
	CheckControls(oBaseDocument.DrawPage)
	oViewCursor.GotoStart(False)
	oBaseDocument.UnlockControllers
	ToggleWindow(True)
End Sub


Function ExtractGraphicNames(CurIndex as Integer, i as Integer) as String
Dim FieldValue as String
	FieldValue = GetFileNameWithoutExtension(Style(i,CurIndex))
	FieldValue = FieldValue &amp; &quot; &quot; &amp;	GetFileNameWithoutExtension(Style(i+1,CurIndex))
	ExtractGraphicNames = FieldValue
End Function


Function GetCurIndex(oListbox as Object, sList() as String, MaxIndex as Integer, FileIndex as Integer)
Dim i, n as Integer
Dim SelValue as String
	&apos; Get selected list entry
	n = oListbox.SelectedItems(0)
	SelValue = oListbox.StringItemList(n)
	&apos; Find field index for chosen list entry
	For i = 0 To MaxIndex
		If sList(1, i) = SelValue Then
			FileStr = sList(FileIndex, i)
			Exit For
		End If
	Next
	GetCurIndex = i
End Function


Sub SetBulletAndGraphics
	SetGraphic(&quot;Prev&quot;, CurrentPrev)
	SetGraphic(&quot;Next&quot;, CurrentNext)
	SetGraphic(&quot;Home&quot;, CurrentHome)
	SetGraphic(&quot;Top&quot;, CurrentTop)
	SetBulletGraphics(CurrentBullet)
	SetGraphicsToOriginalSize()
End Sub


Sub SetGraphicsToOriginalSize()
Dim oGraphics as Object
Dim oGraphic as Object
Dim i as Integer
Dim aActSize as New com.sun.star.awt.Size
	oGraphics = oBaseDocument.GraphicObjects
	For i = 0 To oGraphics.Count-1
		oGraphic = oGraphics.GetByIndex(i)
		aActSize = oGraphic.ActualSize
		If aActSize.Height &gt; 0 And aActSize.Width &gt; 0 Then
			oGraphic.SetSize(aActSize)
		End If
	Next i
End Sub


Sub EndDialog()
	If DialogModel.chkSaveasTemplate.State = 1 Then
		&apos; Generating template? Set events later!
		AttachBasicMacroToEvent(oBaseDocument,&quot;OnNew&quot;, &quot;WebWizard.HtmlAutoPilotBasic.SetEvent()&quot;)
		&apos; Call the Store template dialog
		DispatchSlot(5538)
	Else
		SetEvent
	End If
	MainDialog.EndExecute()
	MainDialog.Dispose()
End Sub


Sub CancelHTMLWizard()
	MainDialog.EndExecute()
	MainDialog.Dispose()
	oBaseDocument.Dispose()
End Sub


Sub SetEvent()
Dim oDocument as Object
&apos; This sub links the events OnSaveDone and OnSaveAsDone to the procedure
&apos; CopyGraphics. It is invoked when a document is created, either directly
&apos; from the AutoPilot or from a template. It is not possible to set these
&apos; links for the template created by the AutoPilot because then it is not
&apos; possible to modify the template.
        BasicLibraries.LoadLibrary(&quot;Tools&quot;)
	oDocument = StarDesktop.ActiveFrame.Controller.Model
	AttachBasicMacroToEvent(oDocument,&quot;OnSaveDone&quot;, &quot;WebWizard.HtmlAutoPilotBasic.CopyGraphics()&quot;)
	AttachBasicMacroToEvent(oDocument,&quot;OnSaveAsDone&quot;, &quot;WebWizard.HtmlAutoPilotBasic.CopyGraphics()&quot;)
End Sub



Sub CopyGraphics
&apos; This sub copies all the graphics used in the document to the same directory the
&apos; document has been copied into and changes the graphics links in the document.
Dim oGraphicObjects, oGraphic as Object
Dim i as Integer
Dim GraphicFilePath as String
Dim SavePath$
Dim GraphicFileName as String
        BasicLibraries.LoadLibrary(&quot;Tools&quot;)
	GetPaths()
	oBaseDocument = StarDesktop.ActiveFrame.Controller.Model
	Msgbox oBaseDocument.Url
	SavePath = oBaseDocument.Url
	oGraphicObjects = oBaseDocument.GraphicObjects

	For i = 0 to oGraphicObjects.Count-1
		oGraphic = oGraphicObjects.GetbyIndex(i)
		GraphicFilePath = oGraphic.GraphicURL
		GraphicFileName = FileNameoutofPath(GraphicFilePath)
		FileCopy GraphicFilePath, Savepath &amp; GraphicFileName
		oGraphic.GraphicURL = Savepath &amp; GraphicFileName
	Next i

	GraphicFileName = FileNameoutofPath(CurrentBullet)
	FileCopy BulletDir &amp; GraphicFileName, SavePath &amp; GraphicFileName

	SetBulletGraphics(GraphicFileName)

&apos;	&apos; Copy background graphic
&apos;	If ActiveWindow.Page.GrfFilename&lt;&gt;&quot;&quot; Then
&apos;		&apos; Set new background graphic
&apos;		ActiveWindow.Page.GrfFilename = SavePath$+GraphicFileName$
&apos;		ActiveWindow.Page.GrfPosition = 11
&apos;	End If

	With oBaseDocument.DocumentInfo
		.GetUserFieldValue(0) = &quot;&quot;
		.GetUserFieldValue(1) = &quot;&quot;
		.GetUserFieldValue(2) = &quot;&quot;
		.GetUserFieldValue(3) = &quot;&quot;
	End With

&apos;	&apos; Reset events
	AttachBasicMacroToEvent(oBaseDocument,&quot;OnSaveDone&quot;, &quot;&quot;)
	AttachBasicMacroToEvent(oBaseDocument,&quot;OnSaveAsDone&quot;, &quot;&quot;)
	AttachBasicMacroToEvent(oBaseDocument,&quot;OnCreate&quot;, &quot;&quot;)
	oBaseDocument.Store
End Sub


Function FillupWebListbox(oUcb as Object, sFileFilter as String, oDialog as Object, ListboxName as String, List() as String)
Dim oDocInfo as Object
Dim oListboxControl as Object
Dim Description as String
Dim sField as String
Dim sFieldList() as String
Dim bItemFound as Boolean
Dim MaxIndex as Integer
Dim DirContent() as String
Dim FileName as String
Dim TemplatePath as String
Dim FilterLen as Integer
Dim i as Integer
Dim m as Integer
Dim n as Integer
Dim s as Integer
Dim a as Integer
Dim SelList(0) as Integer
Dim LocMaxIndex as Integer
	oListboxControl = oDialog.GetControl(ListboxName)

	oDocInfo = createUnoService(&quot;com.sun.star.document.StandaloneDocumentInfo&quot;)
	FilterLen = Len(sFileFilter)
	bItemFound = False
	TemplatePath = GetOfficeSubPath(&quot;Template&quot;, &quot;wizard/web/&quot;)
	DirContent() = oUcb.GetFolderContents(TemplatePath,True)
	LocMaxIndex = Ubound(DirContent())
	a = 0
	For i = 0 To LocMaxIndex
		FileName = DirContent(i)
		If Instr(1,Filename, sFileFilter) Then
			bItemFound = True
			Description = RetrieveDocTitle(oDocInfo, FileName)
			oListboxControl.AddItem(Description,a)
			a = a + 1
			List(1,i) = Description
			If sFileFilter = &quot;/cnt&quot; Then
				List(2,i) = Filename
			Else
				m = 2
				For n = 0 To 3
					sField = oDocInfo.GetUserFieldValue(n)
					sFieldList() = ArrayoutofString(sField, &quot; &quot;, MaxIndex)
					For s = 0 To MaxIndex
						If m &lt; 6 Then
							List(m,i) = sFieldList(s) &amp; &quot;.gif&quot;
						Else
							List(m,i) = sFieldList(s)
						End If
						m = m + 1
					Next s
				Next n
				List(8,i) = FileName
			End If
		End If
	Next i

	&apos; No content template? Error message, close new empty document, stop execution
	If Not bItemfound Then
		MsgBox(WebWiz_gErrContentNotFound$ , 16, WebWiz_gWizardName$)
		oBaseDocument.Dispose()
		Stop
	End If
	SelList(0) = 0
	oListboxControl.Model.SelectedItems() = SelList()
	FillupWebListbox = i
End Function


Sub SetGraphic(sWhich, sGraphicText as String)
Dim oLocCursor as Object
Dim oGraphic as Object
Dim bGetGraphic as Boolean
	oBookmarks = oBaseDocument.BookMarks
	If oBookmarks.HasbyName(sWhich)Then
		oBookMark = oBookmarks.GetbyName(sWhich)
		oLocCursor = oBookMark.Anchor.Text.CreateTextCursorByRange(oBookMark.Anchor)
		oGraphic = oBaseDocument.CreateInstance(&quot;com.sun.star.text.GraphicObject&quot;)
		oLocCursor.GoRight(3,True)
		oGraphic.AnchorType = 1
		oGraphic.GraphicURL = ConverttoURL(sGraphicText)
		oLocCursor.Text.InsertTextContent(oLocCursor, oGraphic, True)
		oGraphic.Name = sWhich
	ElseIf oBaseDocument.GraphicObjects.HasbyName(sWhich) Then
		oGraphic = oBaseDocument.GraphicObjects.GetByName(sWhich)
		oGraphic.GraphicUrl = sGraphicText
	End If
End Sub



Sub	ChangeBulletURL(sBulletUrl as String, oBookMarkCursor as Object)
Dim n, m as Integer
Dim oLevel()
Dim oRules
Dim bDoReplace as Boolean
Dim oSize as New com.sun.star.awt.Size
Dim oNumberingBuffer(0) as New com.sun.star.beans.PropertyValue
Dim oNewBuffer(1) as New com.sun.star.beans.PropertyValue
	oRules = oBookMarkCursor.NumberingRules
	If Vartype(oRules()) = 9 Then
		oNumberingBuffer(0).Name = &quot;NumberingType&quot;
		oNumberingBuffer(0).Value = com.sun.star.style.NumberingType.BITMAP
		For n = 0 To oRules.Count - 1
			oLevel() = oRules.GetByIndex(n)
			bDoReplace = ModifyPropertyValue(oLevel(), oNumberingBuffer())
			If bDoReplace Then
				oRules.ReplaceByIndex(n, oNumberingBuffer())
			End If
		Next n
		oBookmarkCursor.NumberingRules = oRules
		oNewBuffer(0).Name = &quot;GraphicURL&quot;
		oNewBuffer(0).Value = sBulletUrl
		oNewBuffer(1).Name = &quot;GraphicSize&quot;
		oSize.Height = 300
		oSize.Width = 300
		oNewBuffer(1).Value = oSize
		For n = 0 To oRules.Count - 1
			oLevel() = oRules.GetByIndex(0)
			bDoReplace = ModifyPropertyValue(oLevel(), oNewBuffer())
			If bDoReplace Then
				oRules.ReplaceByIndex(n, oNewBuffer())
			End If
		Next n
		oBookmarkCursor.NumberingRules = oRules
	End If
End Sub


Sub	SetBulletGraphics(sBulletUrl as String)
Dim i as Integer
Dim oBookMarkCursor as Object
	oBookmarks = oBaseDocument.BookMarks
	For i = 0 To oBookmarks.Count - 1
		oBookMark = oBookmarks.GetbyIndex(i)
		oBookMarkCursor = oBookMark.Anchor.Text.CreateTextCursorByRange(oBookMark.Anchor)
		If oBookMarkCursor.PropertySetInfo.HasPropertybyName(&quot;NumberingRules&quot;) Then
			ChangeBulletURL(sBulletUrl, oBookMarkCursor)
		End If
	Next i
End Sub


Sub CheckControls(oDrawPage as Object)
Dim aForm as Object
Dim m,n as integer
Dim lColor as Long
Dim oControl as Object
	lColor = oBaseDocument.StyleFamilies.GetbyName(&quot;ParagraphStyles&quot;).GetByName(&quot;Standard&quot;).CharColor
	&apos;SearchFor all possible Controls
	For n = 0 to oDrawPage.Forms.Count - 1
		aForm = oDrawPage.Forms(n)
		For m = 0 to aForm.Count-1
			oControl = aForm.GetbyIndex(m)
			oControl.TextColor = lColor
		Next
	Next
End Sub

REM  *****  BASIC  *****

Sub LoadNewStyles(oDocument as Object, oDialogModel as Object, CurIndex as Integer, SourceFile as String, Styles() as String, TextureDir as String)
Dim BackGroundURL as String
Dim oBackGraph as Object
Dim i, BackColor as Long
Dim oFamilies as Object, oFamily as Object, oStyle as Object
Dim StylesOptions(0) as New com.sun.star.beans.PropertyValue

	If SourceFile &lt;&gt; &quot;&quot; Then
		StylesOptions(0).Name = &quot;OverwriteStyles&quot;
		StylesOptions(0).Value = true
		oDocument.StyleFamilies.LoadStylesFromURL(SourceFile, StylesOptions())
	End If

	&apos; Read array fields for background, bullet &amp; graphics
	BackgroundURL = Styles(7, CurIndex)
	If Left(BackgroundURL, 1) &lt;&gt; &quot;#&quot; Then
		BackgroundURL = TextureDir + BackgroundURL
		ToggleOptionButtons(oDialogModel, 1)
	Else
		BackColor = clng(&quot;&amp;H&quot; &amp; Right(BackgroundURL, Len(BackgroundURL)-1))
		ToggleOptionButtons(oDialogModel, 0)
	End If
	oFamilies = oDocument.StyleFamilies
	oFamily = oFamilies.GetbyName(&quot;PageStyles&quot;)
&apos;	oStyle = oDocument.StyleFamilies.GetByName(&quot;PageStyles&quot;).GetByName(&quot;Standard&quot;)
	For i = 0 To oFamily.Count - 1
		If oFamily.GetByIndex(i).IsInUse Then
			oStyle = oFamily.GetbyIndex(i)
			If oStyle.PropertySetInfo.HasPropertybyName(&quot;BackGraphicURL&quot;) Then
				If Left(BackgroundURL, 1) = &quot;#&quot; Then
					oStyle.BackGraphicURL = &quot;&quot;
					oStyle.BackColor = BackColor
					oStyle.BackTransparent = False
				Else
					oStyle.BackGraphicUrl = BackGroundURL
					SetTileBackgroundorNot(oDialogModel, oStyle)
				End If
			End If
		End If
	Next i
ErrorOcurred:
	If Err &lt;&gt; 0 Then
		MsgBox(WebWiz_gErrWhileLoadStyles$, 16, WebWiz_gWizardName$)
		CancelHTMLWizard()
	End If
End Sub



Sub	ToggleOptionButtons(DialogModel as Object, bDoEnable as Integer)
	DialogModel.optTiled.Enabled = bDoEnable
	DialogModel.optArea.Enabled = bDoEnable
	DialogModel.frmBackground.Enabled = bDoEnable
End Sub


Sub SetBackGraphicStyle(oEvent as Object)
Dim oFamilies as Object
Dim oFamily as Object
Dim i as Integer
Dim oStyle as Object
Dim oOptModel as Object
Dim iBackgroundValue as Integer
Dim oLocDocument as Object
	ooptModel = oEvent.Source.Model
	iBackgroundValue = Val(ooptModel.Tag)
	oLocDocument = StarDesktop.ActiveFrame.Controller.Model
	oLocDocument.LockControllers
	oFamilies = oLocDocument.StyleFamilies
	oFamily = oFamilies.GetbyName(&quot;PageStyles&quot;)
	For i = 0 To oFamily.Count - 1
		If oFamily.GetByIndex(i).IsInUse Then
			oStyle = oFamily.GetbyIndex(i)
			If oStyle.PropertySetInfo.HasPropertybyName(&quot;BackGraphicURL&quot;) Then
				oStyle.BackGraphicLocation = iBackgroundValue
			End If
		End If
	Next i
	oLocDocument.UnlockControllers
End Sub


Sub SetTileBackgroundorNot(DialogModel as Object, oStyle as Object)
  	If DialogModel.optTiled.State = 1 Then
    	oStyle.BackGraphicLocation = com.sun.star.style.GraphicLocation.TILED
  	Else
    	oStyle.BackGraphicLocation = com.sun.star.style.GraphicLocation.AREA
  	End If
End Sub

</script:module>