summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorBehrend Cornelius <bc@openoffice.org>2001-07-13 13:53:52 +0000
committerBehrend Cornelius <bc@openoffice.org>2001-07-13 13:53:52 +0000
commitcef74e942e768c55d6b47d2e651a55f60d63a136 (patch)
tree34533d90479f21066e4d2cf0476eb18b901db8f0 /wizards
parentf33716aecadd5bb84a06071012b5168dfc5749d7 (diff)
#88790# New Module 'Common.xba' added, several little changes in this module
Diffstat (limited to 'wizards')
-rw-r--r--wizards/source/webwizard/Common.xba131
-rw-r--r--wizards/source/webwizard/HtmlAutoPilotBasic.xba129
2 files changed, 134 insertions, 126 deletions
diff --git a/wizards/source/webwizard/Common.xba b/wizards/source/webwizard/Common.xba
new file mode 100644
index 000000000000..906267d5b048
--- /dev/null
+++ b/wizards/source/webwizard/Common.xba
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Common" script:language="StarBasic">REM ***** BASIC *****
+Option Explicit
+
+Function LoadNewStyles(oDocument as Object, oDialogModel as Object, CurIndex as Integer, SourceFile as String, Styles() as String, TextureDir as String) as Boolean
+Dim BackGroundURL as String
+Dim oBackGraph as Object
+Dim i, BackColor as Long
+Dim bLocWithBackGraphic as Boolean
+Dim oFamilies as Object, oFamily as Object&apos;, 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
+ bLocWithBackGraphic = True
+ Else
+ BackColor = clng(&quot;&amp;H&quot; &amp; Right(BackgroundURL, Len(BackgroundURL)-1))
+ bLocWithBackGraphic = False
+ End If
+ oFamilies = oDocument.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
+ 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
+ LoadNewStyles() = bLocWithBackGraphic
+ErrorOcurred:
+ If Err &lt;&gt; 0 Then
+ MsgBox(WebWiz_gErrWhileLoadStyles$, 16, WebWiz_gWizardName$)
+ CancelHTMLWizard()
+ End If
+End Function
+
+
+
+Sub ChangeBackGraphicUrl(SavePath as String)
+Dim oPageFamily as Object
+Dim i as Integer
+ oPageFamily = oBaseDocument.StyleFamilies.GetbyName(&quot;PageStyles&quot;)
+ For i = 0 To oPageFamily.Count - 1
+ If oPageFamily.GetByIndex(i).IsInUse Then
+ oStyle = oPageFamily.GetbyIndex(i)
+ If oStyle.PropertySetInfo.HasPropertybyName(&quot;BackGraphicURL&quot;) Then
+ If oStyle.BackGraphicUrl &lt;&gt; &quot;&quot; Then
+ oStyleBack.GraphicUrl = CopyFile(oStyle.BackGraphicUrl, SavePath)
+ Exit Sub
+ End If
+ End If
+ End If
+ Next i
+End Sub
+
+
+Sub SetBackGraphicStyle(oEvent as Object)
+Dim oFamilies as Object
+Dim oFamily as Object
+Dim i as Integer
+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
+
+
+Sub ToggleOptionButtons(DialogModel as Object, bDoEnable as Integer)
+ DialogModel.optTiled.Enabled = bDoEnable
+ DialogModel.optArea.Enabled = bDoEnable
+ DialogModel.hlnBackground.Enabled = bDoEnable
+End Sub
+
+
+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
+
+</script:module> \ No newline at end of file
diff --git a/wizards/source/webwizard/HtmlAutoPilotBasic.xba b/wizards/source/webwizard/HtmlAutoPilotBasic.xba
index e5b382937686..d74b16939c7a 100644
--- a/wizards/source/webwizard/HtmlAutoPilotBasic.xba
+++ b/wizards/source/webwizard/HtmlAutoPilotBasic.xba
@@ -79,7 +79,7 @@ Sub Main
SOBitmapPath = GetOfficeSubPath(&quot;Template&quot;, &quot;wizard/bitmap&quot;)
sBitmapPath = SOBitmapPath &amp; &quot;webwizard.bmp&quot;
DialogModel.ImagePreview.ImageURL = sBitmapPath
- ToggleOptionButtons(bWithBackGraphic)
+ ToggleOptionButtons(DialogModel, bWithBackGraphic)
MainDialog.Execute
GLOBALERRORHANDLER:
@@ -129,7 +129,7 @@ Dim CurIndex as Integer
ToggleDialogControls(False)
&apos; oBaseDocument.LockControllers
CurIndex = GetCurIndex(DialogModel.lbStyles, Style(), NumberofStyles%,8)
- LoadNewStyles(oBaseDocument, DialogModel, CurIndex, FileStr, Style(), TextureDir)
+ bWithBackGraphic = LoadNewStyles(oBaseDocument, DialogModel, CurIndex, FileStr, Style(), TextureDir)
CurrentBullet$ = BulletDir + Style(6, CurIndex)
CurrentPrev$ = GraphicsDir + Style(2, CurIndex)
CurrentNext$ = GraphicsDir + Style(3, CurIndex)
@@ -157,23 +157,6 @@ Dim FieldValue as String
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)
@@ -406,87 +389,6 @@ Dim oControl as Object
End Sub
-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&apos;, 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
- bWithBackGraphic = True
- Else
- BackColor = clng(&quot;&amp;H&quot; &amp; Right(BackgroundURL, Len(BackgroundURL)-1))
- bWithBackGraphic = False
- End If
- oFamilies = oDocument.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
- 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 SetBackGraphicStyle(oEvent as Object)
-Dim oFamilies as Object
-Dim oFamily as Object
-Dim i as Integer
-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
-
-
Sub RepaintHeaderPreview()
Dim Bitmap As Object
Dim sBitmapPath as String
@@ -495,24 +397,6 @@ Dim sBitmapPath as String
End Sub
-Sub ChangeBackGraphicUrl(SavePath as String)
-Dim oPageFamily as Object
-Dim i as Integer
- oPageFamily = oBaseDocument.StyleFamilies.GetbyName(&quot;PageStyles&quot;)
- For i = 0 To oPageFamily.Count - 1
- If oPageFamily.GetByIndex(i).IsInUse Then
- oStyle = oPageFamily.GetbyIndex(i)
- If oStyle.PropertySetInfo.HasPropertybyName(&quot;BackGraphicURL&quot;) Then
- If oStyle.BackGraphicUrl &lt;&gt; &quot;&quot; Then
- oStyleBack.GraphicUrl = CopyFile(oStyle.BackGraphicUrl, SavePath)
- Exit Sub
- End If
- End If
- End If
- Next i
-End Sub
-
-
Sub ToggleDialogControls(ByVal bDoEnable as Boolean)
With DialogModel
.cbCancel.Enabled = bDoEnable
@@ -527,15 +411,8 @@ Sub ToggleDialogControls(ByVal bDoEnable as Boolean)
&apos; Enable Controls referring to Background graphic only when this Property is set
bDoEnable = bWithBackGraphic
End If
- ToggleOptionButtons(bDoEnable)
+ ToggleOptionButtons(DialogModel, bDoEnable)
End With
End Sub
-
-Sub ToggleOptionButtons(bDoEnable as Integer)
- DialogModel.optTiled.Enabled = bDoEnable
- DialogModel.optArea.Enabled = bDoEnable
- DialogModel.hlnBackground.Enabled = bDoEnable
-End Sub
-
</script:module> \ No newline at end of file