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=
"Common" script:
language=
"StarBasic">REM ***** BASIC *****
7 Function LoadNewStyles(oDocument as Object, oDialogModel as Object, CurIndex as Integer, SourceFile as String, Styles() as String, TextureDir as String) as Boolean
8 Dim BackGroundURL as String
9 Dim oBackGraph as Object
10 Dim i, BackColor as Long
11 Dim bLocWithBackGraphic as Boolean
12 Dim oFamilies as Object, oFamily as Object
', oStyle as Object
13 Dim StylesOptions(
0) as New com.sun.star.beans.PropertyValue
15 If SourceFile
<> "" Then
16 StylesOptions(
0).Name =
"OverwriteStyles
"
17 StylesOptions(
0).Value = True
18 oDocument.StyleFamilies.LoadStylesFromURL(SourceFile, StylesOptions())
21 ' Read array fields for background, bullet
& graphics
22 BackgroundURL = Styles(CurIndex,
7)
23 If Left(BackgroundURL,
1)
<> "#
" Then
24 BackgroundURL = TextureDir + BackgroundURL
25 bLocWithBackGraphic = True
27 BackColor = clng(
"&H
" & Right(BackgroundURL, Len(BackgroundURL)-
1))
28 bLocWithBackGraphic = False
30 oFamilies = oDocument.StyleFamilies
31 oFamily = oFamilies.GetbyName(
"PageStyles
")
32 For i =
0 To oFamily.Count -
1
33 If oFamily.GetByIndex(i).IsInUse Then
34 oStyle = oFamily.GetbyIndex(i)
35 If oStyle.PropertySetInfo.HasPropertybyName(
"BackGraphicURL
") Then
36 If Left(BackgroundURL,
1) =
"#
" Then
37 oStyle.BackGraphicURL =
""
38 oStyle.BackColor = BackColor
39 oStyle.BackTransparent = False
41 oStyle.BackGraphicUrl = BackGroundURL
42 SetTileBackgroundorNot(oDialogModel, oStyle)
48 LoadNewStyles() = bLocWithBackGraphic
50 If Err
<> 0 Then
51 MsgBox (WebWiz_gErrWhileLoadStyles$,
16, WebWiz_gWizardName$)
59 Sub ChangeBackGraphicUrl(SavePath as String)
60 Dim oPageFamily as Object
62 oPageFamily = oBaseDocument.StyleFamilies.GetbyName(
"PageStyles
")
63 For i =
0 To oPageFamily.Count -
1
64 If oPageFamily.GetByIndex(i).IsInUse Then
65 oStyle = oPageFamily.GetbyIndex(i)
66 If oStyle.PropertySetInfo.HasPropertybyName(
"BackGraphicURL
") Then
67 If oStyle.BackGraphicUrl
<> "" Then
68 oStyle.BackGraphicUrl = CopyFile(oStyle.BackGraphicUrl, SavePath)
77 Sub SetBackGraphicStyle(oEvent as Object)
78 Dim oFamilies as Object
81 Dim oOptModel as Object
82 Dim iBackgroundValue as Integer
83 Dim oLocDocument as Object
84 ooptModel = oEvent.Source.Model
85 iBackgroundValue = Val(ooptModel.Tag)
86 oLocDocument = StarDesktop.ActiveFrame.Controller.Model
87 oLocDocument.LockControllers
88 oFamilies = oLocDocument.StyleFamilies
89 oFamily = oFamilies.GetbyName(
"PageStyles
")
90 For i =
0 To oFamily.Count -
1
91 If oFamily.GetByIndex(i).IsInUse Then
92 oStyle = oFamily.GetbyIndex(i)
93 If oStyle.PropertySetInfo.HasPropertybyName(
"BackGraphicURL
") Then
94 oStyle.BackGraphicLocation = iBackgroundValue
98 oLocDocument.UnlockControllers
102 Sub SetTileBackgroundorNot(DialogModel as Object, oStyle as Object)
103 If Not IsNull(DialogModel) Then
104 If DialogModel.optTiled.State =
1 Then
105 oStyle.BackGraphicLocation = com.sun.star.style.GraphicLocation.TILED
107 oStyle.BackGraphicLocation = com.sun.star.style.GraphicLocation.AREA
113 Sub ToggleOptionButtons(DialogModel as Object, bDoEnable as Integer)
114 If Not IsNull(DialogModel) Then
115 DialogModel.optTiled.Enabled = bDoEnable
116 DialogModel.optArea.Enabled = bDoEnable
117 DialogModel.hlnBackground.Enabled = bDoEnable
122 Function GetCurIndex(oListbox as Object, sList() as String, FileIndex as Integer)
125 Dim SelValue as String
126 Dim MaxIndex as Integer
127 If IsNull(oListBox) Then
128 ' Startup for WebWizard
129 SelValue = sList(
0,
1)
131 n = oListbox.SelectedItems(
0)
132 SelValue = oListbox.StringItemList(n)
134 ' Find field index for chosen list entry
135 MaxIndex = Ubound(sList)
136 For i =
0 To MaxIndex
137 If sList(i,
1) = SelValue Then
138 FileStr = sList(i, FileIndex)