1*cdf0e10cSrcweir<?xml version="1.0" encoding="UTF-8"?> 2*cdf0e10cSrcweir<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> 3*cdf0e10cSrcweir<script:module xmlns:script="http://openoffice.org/2000/script" script:name="HtmlAutoPilotBasic" script:language="StarBasic">' Variables must be declared 4*cdf0e10cSrcweirOption Explicit 5*cdf0e10cSrcweir 6*cdf0e10cSrcweirPublic CurDocIndex as Integer 7*cdf0e10cSrcweirPublic CurWebPageIndex as Integer 8*cdf0e10cSrcweir 9*cdf0e10cSrcweir 10*cdf0e10cSrcweirPublic bWithBackGraphic as Boolean 11*cdf0e10cSrcweirPublic oStyle as Object 12*cdf0e10cSrcweir' Maximum number of content templates, style templates and bullets 13*cdf0e10cSrcweirConst MaxLayouts = 50 14*cdf0e10cSrcweirConst MaxStyles = 100 15*cdf0e10cSrcweirConst MaxBullets = 10 16*cdf0e10cSrcweir 17*cdf0e10cSrcweir'Public NumberOfLayouts%, NumberOfStyles% 18*cdf0e10cSrcweir 19*cdf0e10cSrcweir' Filled with title, previous, next, home, top, bullet, background, file name 20*cdf0e10cSrcweirPublic Style(MaxStyles, 8) as String 21*cdf0e10cSrcweir 22*cdf0e10cSrcweirPublic Layout$(MaxLayouts, 2) 23*cdf0e10cSrcweir 24*cdf0e10cSrcweirPublic TextureDir$, BulletDir$, GraphicsDir$, GalleryDir$, PhotosDir$ 25*cdf0e10cSrcweirPublic SOBitmapPath as String 26*cdf0e10cSrcweirPublic CurrentBullet$, CurrentPrev$, CurrentNext$, CurrentHome$, CurrentTop$ 27*cdf0e10cSrcweirPublic FileStr as String 28*cdf0e10cSrcweir 29*cdf0e10cSrcweirPublic WebWiz_gWizardName$, WebWiz_gErrContentNotFound$, WebWiz_gErrStyleNotFound$ 30*cdf0e10cSrcweirPublic WebWiz_gErrMainTemplateError$, WebWiz_gErrWhileReloading$ 31*cdf0e10cSrcweirPublic WebWiz_gErrWhileLoadStyles$, WebWiz_gErrMsg$, WebWiz_gErrMainDocumentError$ 32*cdf0e10cSrcweir 33*cdf0e10cSrcweirPublic ProgressBar as Object 34*cdf0e10cSrcweirPublic ProgressValue As Long 35*cdf0e10cSrcweirPublic oBaseDocument as Object 36*cdf0e10cSrcweirPublic oViewCursor as Object 37*cdf0e10cSrcweirPublic oViewSettings as Object 38*cdf0e10cSrcweirPublic NoArgs() as New com.sun.star.beans.PropertyValue 39*cdf0e10cSrcweir 40*cdf0e10cSrcweirPublic oCursor as Object 41*cdf0e10cSrcweirPublic oBookmarks as Object 42*cdf0e10cSrcweirPublic oBookMark as Object 43*cdf0e10cSrcweir 44*cdf0e10cSrcweirPublic oUcb as Object 45*cdf0e10cSrcweirPublic MainDialog as Object 46*cdf0e10cSrcweirPublic DialogModel as Object 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir 49*cdf0e10cSrcweirSub Main 50*cdf0e10cSrcweirDim RetValue 51*cdf0e10cSrcweirOn Local Error Goto GlobalErrorHandler 52*cdf0e10cSrcweir BasicLibraries.LoadLibrary("Tools") 53*cdf0e10cSrcweir oUcb = createUnoService("com.sun.star.ucb.SimpleFileAccess") 54*cdf0e10cSrcweir oBaseDocument = StarDesktop.LoadComponentFromURL("private:factory/swriter/web", "_default", 0, NoArgs()) 55*cdf0e10cSrcweir oViewSettings = oBaseDocument.CurrentController.ViewSettings 56*cdf0e10cSrcweir oViewCursor = oBaseDocument.GetCurrentController.ViewCursor 57*cdf0e10cSrcweir CurWebPageIndex = -1 58*cdf0e10cSrcweir ProgressBar = oBaseDocument.GetCurrentController.GetFrame.CreateStatusIndicator 59*cdf0e10cSrcweir ProgressBar.Start("", 100) 60*cdf0e10cSrcweir SetProgressValue(2) 61*cdf0e10cSrcweir oBaseDocument.LockControllers 62*cdf0e10cSrcweir oViewSettings.ShowTableBoundaries = False 63*cdf0e10cSrcweir If Not GetWebWizardPaths() Then 64*cdf0e10cSrcweir Exit Sub 65*cdf0e10cSrcweir End If 66*cdf0e10cSrcweir LoadLanguage 67*cdf0e10cSrcweir SetProgressValue(10) 68*cdf0e10cSrcweir Layout() = getListBoxArrays(oUcb, "/cnt") 69*cdf0e10cSrcweir GetCurIndex(DialogModel, Layout(),2) 70*cdf0e10cSrcweir SetProgressValue(30) 71*cdf0e10cSrcweir oCursor = oBasedocument.Text.CreateTextCursor 72*cdf0e10cSrcweir oCursor.InsertDocumentfromURL(FileStr, NoArgs()) 73*cdf0e10cSrcweir SetProgressValue(50) 74*cdf0e10cSrcweir Style() = getListBoxArrays(oUcb, "/stl") 75*cdf0e10cSrcweir SetProgressValue(70) 76*cdf0e10cSrcweir LoadWebPageStyles(oBaseDocument) 77*cdf0e10cSrcweir SetProgressValue(90) 78*cdf0e10cSrcweir oBaseDocument.UnlockControllers 79*cdf0e10cSrcweir OpenWebDialog() 80*cdf0e10cSrcweir SetProgressValue(98) 81*cdf0e10cSrcweir SetProgressValue(0) 82*cdf0e10cSrcweir MainDialog.Model.ImagePreview.BackGroundColor = RGB(0, 60,126) 83*cdf0e10cSrcweir RetValue = MainDialog.Execute 84*cdf0e10cSrcweir Select Case RetValue 85*cdf0e10cSrcweir Case 0 86*cdf0e10cSrcweir MainDialog.Dispose() 87*cdf0e10cSrcweir DisposeDocument(oBaseDocument) 88*cdf0e10cSrcweir Case 1 89*cdf0e10cSrcweir EndDialog() 90*cdf0e10cSrcweir MainDialog.Dispose() 91*cdf0e10cSrcweir End Select 92*cdf0e10cSrcweirGLOBALERRORHANDLER: 93*cdf0e10cSrcweir If Err <> 0 Then 94*cdf0e10cSrcweir MsgBox (WebWiz_gErrMsg$, 16, WebWiz_gWizardName$) 95*cdf0e10cSrcweir DisposeDocument(oBaseDocument) 96*cdf0e10cSrcweir RESUME EXITWIZARD 97*cdf0e10cSrcweirEXITWIZARD: 98*cdf0e10cSrcweir End If 99*cdf0e10cSrcweirEnd Sub 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir 102*cdf0e10cSrcweirFunction SetProgressValue(iValue as Integer) 103*cdf0e10cSrcweir If iValue = 0 Then 104*cdf0e10cSrcweir ProgressBar.End 105*cdf0e10cSrcweir End If 106*cdf0e10cSrcweir ProgressValue = iValue 107*cdf0e10cSrcweir ProgressBar.Value = iValue 108*cdf0e10cSrcweirEnd Function 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir 111*cdf0e10cSrcweirSub ReloadCurrentDocument() 112*cdf0e10cSrcweirDim OldDocIndex as Integer 113*cdf0e10cSrcweirOn Local Error Goto ErrorOcurred 114*cdf0e10cSrcweir OldDocIndex = CurDocIndex 115*cdf0e10cSrcweir CurDocIndex = GetCurIndex(DialogModel.lbTemplate, Layout(), 2) 116*cdf0e10cSrcweir If OldDocIndex <> CurDocIndex Then 117*cdf0e10cSrcweir oBaseDocument.LockControllers 118*cdf0e10cSrcweir ToggleDialogControls(False) 119*cdf0e10cSrcweir oCursor = oBaseDocument.Text.CreateTextCursor() 120*cdf0e10cSrcweir oCursor.GotoStart(False) 121*cdf0e10cSrcweir oCursor.GotoEnd(True) 122*cdf0e10cSrcweir oCursor.SetAllPropertiesToDefault() 123*cdf0e10cSrcweir oCursor.InsertDocumentfromURL(FileStr, NoArgs()) 124*cdf0e10cSrcweir SetBulletAndGraphics 125*cdf0e10cSrcweir CheckControls(oBaseDocument.DrawPage) 126*cdf0e10cSrcweir ErrorOcurred: 127*cdf0e10cSrcweir If Err <> 0 Then 128*cdf0e10cSrcweir MsgBox(WebWiz_gErrWhileReloading$, 16, WebWiz_gWizardName$) 129*cdf0e10cSrcweir End If 130*cdf0e10cSrcweir oBaseDocument.UnlockControllers 131*cdf0e10cSrcweir oViewCursor.GotoStart(False) 132*cdf0e10cSrcweir ToggleDialogControls(True, "lbTemplate") 133*cdf0e10cSrcweir End If 134*cdf0e10cSrcweirEnd Sub 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir 139*cdf0e10cSrcweirSub LoadWebPageStyles(aEvent as Object, Optional bStartUp as Boolean) 140*cdf0e10cSrcweirDim OldWebPageIndex as Integer 141*cdf0e10cSrcweir OldWebPageIndex = CurWebPageIndex 142*cdf0e10cSrcweir If IsNull(DialogModel) Then 143*cdf0e10cSrcweir CurWebPageIndex = GetCurIndex(DialogModel, Style(), 8) 144*cdf0e10cSrcweir Else 145*cdf0e10cSrcweir CurWebPageIndex = GetCurIndex(DialogModel.lbStyles, Style(), 8) 146*cdf0e10cSrcweir End If 147*cdf0e10cSrcweir If OldWebPageIndex <> CurWebPageIndex Then 148*cdf0e10cSrcweir ToggleDialogControls(False) 149*cdf0e10cSrcweir oBaseDocument.LockControllers 150*cdf0e10cSrcweir bWithBackGraphic = LoadNewStyles(oBaseDocument, DialogModel, CurWebPageIndex, FileStr, Style(), TextureDir) 151*cdf0e10cSrcweir CurrentBullet$ = BulletDir + Style(CurWebPageIndex, 6) 152*cdf0e10cSrcweir CurrentPrev$ = GraphicsDir + Style(CurWebPageIndex, 2) 153*cdf0e10cSrcweir CurrentNext$ = GraphicsDir + Style(CurWebPageIndex, 3) 154*cdf0e10cSrcweir CurrentHome$ = GraphicsDir + Style(CurWebPageIndex, 4) 155*cdf0e10cSrcweir CurrentTop$ = GraphicsDir + Style(CurWebPageIndex, 5) 156*cdf0e10cSrcweir With oBaseDocument.DocumentProperties.UserDefinedProperties 157*cdf0e10cSrcweir .AutoPilotName1 = ExtractGraphicNames(CurWebPageIndex,2) 158*cdf0e10cSrcweir .AutoPilotName2 = ExtractGraphicNames(CurWebPageIndex, 4) 159*cdf0e10cSrcweir .AutoPilotBullet = Style(CurWebPageIndex, 6) 160*cdf0e10cSrcweir .AutoPilotBackground = Style(CurWebPageIndex, 7) 161*cdf0e10cSrcweir End With 162*cdf0e10cSrcweir SetBulletAndGraphics() 163*cdf0e10cSrcweir CheckControls(oBaseDocument.DrawPage) 164*cdf0e10cSrcweir oViewCursor.GotoStart(False) 165*cdf0e10cSrcweir oBaseDocument.UnlockControllers 166*cdf0e10cSrcweir ToggleDialogControls(True, "lbStyles") 167*cdf0e10cSrcweir End If 168*cdf0e10cSrcweirEnd Sub 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir 171*cdf0e10cSrcweirFunction ExtractGraphicNames(CurIndex as Integer, i as Integer) as String 172*cdf0e10cSrcweirDim FieldValue as String 173*cdf0e10cSrcweir FieldValue = GetFileNameWithoutExtension(Style(CurIndex, i)) 174*cdf0e10cSrcweir FieldValue = FieldValue & " " & GetFileNameWithoutExtension(Style(CurIndex, i+1)) 175*cdf0e10cSrcweir ExtractGraphicNames = FieldValue 176*cdf0e10cSrcweirEnd Function 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir 179*cdf0e10cSrcweirSub SetBulletAndGraphics 180*cdf0e10cSrcweir SetGraphic("Prev", CurrentPrev) 181*cdf0e10cSrcweir SetGraphic("Next", CurrentNext) 182*cdf0e10cSrcweir SetGraphic("Home", CurrentHome) 183*cdf0e10cSrcweir SetGraphic("Top", CurrentTop) 184*cdf0e10cSrcweir SetBulletGraphics(CurrentBullet) 185*cdf0e10cSrcweir SetGraphicsToOriginalSize() 186*cdf0e10cSrcweirEnd Sub 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir 189*cdf0e10cSrcweirSub SetGraphicsToOriginalSize() 190*cdf0e10cSrcweirDim oGraphics as Object 191*cdf0e10cSrcweirDim oGraphic as Object 192*cdf0e10cSrcweirDim i as Integer 193*cdf0e10cSrcweirDim aActSize as New com.sun.star.awt.Size 194*cdf0e10cSrcweir oGraphics = oBaseDocument.GraphicObjects 195*cdf0e10cSrcweir For i = 0 To oGraphics.Count-1 196*cdf0e10cSrcweir oGraphic = oGraphics.GetByIndex(i) 197*cdf0e10cSrcweir aActSize = oGraphic.ActualSize 198*cdf0e10cSrcweir If aActSize.Height > 0 And aActSize.Width > 0 Then 199*cdf0e10cSrcweir oGraphic.SetSize(aActSize) 200*cdf0e10cSrcweir End If 201*cdf0e10cSrcweir Next i 202*cdf0e10cSrcweirEnd Sub 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir 205*cdf0e10cSrcweirSub EndDialog() 206*cdf0e10cSrcweir If DialogModel.chkSaveasTemplate.State = 1 Then 207*cdf0e10cSrcweir ' Generating template? Set events later! 208*cdf0e10cSrcweir AttachBasicMacroToEvent(oBaseDocument,"OnNew", "WebWizard.HtmlAutoPilotBasic.SetEvent()") 209*cdf0e10cSrcweir ' Call the Store template dialog 210*cdf0e10cSrcweir DispatchSlot(5538) 211*cdf0e10cSrcweir AttachBasicMacroToEvent(oBaseDocument,"OnNew", "") 212*cdf0e10cSrcweir End If 213*cdf0e10cSrcweir SetEvent() 214*cdf0e10cSrcweirEnd Sub 215*cdf0e10cSrcweir 216*cdf0e10cSrcweir 217*cdf0e10cSrcweirSub SetEvent() 218*cdf0e10cSrcweirDim oDocument as Object 219*cdf0e10cSrcweir' This sub links the events OnSaveDone and OnSaveAsDone to the procedure 220*cdf0e10cSrcweir' CopyGraphics. It is invoked when a document is created, either directly 221*cdf0e10cSrcweir' from the AutoPilot or from a template. It is not possible to set these 222*cdf0e10cSrcweir' links for the template created by the AutoPilot because then it is not 223*cdf0e10cSrcweir' possible to modify the template. 224*cdf0e10cSrcweir BasicLibraries.LoadLibrary("Tools") 225*cdf0e10cSrcweir oDocument = ThisComponent 226*cdf0e10cSrcweir AttachBasicMacroToEvent(oDocument,"OnSaveDone", "WebWizard.HtmlAutoPilotBasic.CopyGraphics()") 227*cdf0e10cSrcweir AttachBasicMacroToEvent(oDocument,"OnSaveAsDone", "WebWizard.HtmlAutoPilotBasic.CopyGraphics()") 228*cdf0e10cSrcweirEnd Sub 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir 232*cdf0e10cSrcweirSub CopyGraphics 233*cdf0e10cSrcweir' This sub copies all the graphics used in the document to the same directory the 234*cdf0e10cSrcweir' document has been copied into and changes the graphics links in the document. 235*cdf0e10cSrcweirDim oGraphicObjects as Object 236*cdf0e10cSrcweirDim oGraphic as Object 237*cdf0e10cSrcweirDim i as Integer 238*cdf0e10cSrcweirDim udProps as Object 239*cdf0e10cSrcweirDim SavePath as String 240*cdf0e10cSrcweir BasicLibraries.LoadLibrary("Tools") 241*cdf0e10cSrcweir oUcb = createUnoService("com.sun.star.ucb.SimpleFileAccess") 242*cdf0e10cSrcweir GetWebWizardPaths() 243*cdf0e10cSrcweir oBaseDocument = ThisComponent 244*cdf0e10cSrcweir' oBaseDocument.LockControllers() 245*cdf0e10cSrcweir 246*cdf0e10cSrcweir ' Note: The sub DirectoryNameoutofPath should be change, so that the last character is a slash 247*cdf0e10cSrcweir SavePath = DirectoryNameoutofPath(oBaseDocument.Url, "/") & "/" 248*cdf0e10cSrcweir 249*cdf0e10cSrcweir oGraphicObjects = oBaseDocument.GraphicObjects 250*cdf0e10cSrcweir For i = 0 to oGraphicObjects.Count-1 251*cdf0e10cSrcweir oGraphic = oGraphicObjects.GetbyIndex(i) 252*cdf0e10cSrcweir oGraphic.GraphicUrl = CopyFile(oGraphic.GraphicURL, SavePath) 253*cdf0e10cSrcweir Next i 254*cdf0e10cSrcweir 255*cdf0e10cSrcweir ChangeBackGraphicUrl(SavePath) 256*cdf0e10cSrcweir 257*cdf0e10cSrcweir BulletUrlsToSavePath(SavePath) 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir udProps = oBaseDocument.DocumentProperties.UserDefinedProperties 260*cdf0e10cSrcweir udProps.addProperty("AutoPilotName1", 0, "") 261*cdf0e10cSrcweir udProps.addProperty("AutoPilotName2", 0, "") 262*cdf0e10cSrcweir udProps.addProperty("AutoPilotBullet", 0, "") 263*cdf0e10cSrcweir udProps.addProperty("AutoPilotBackground", 0, "") 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir AttachBasicMacroToEvent(oBaseDocument,"OnSaveDone", "") 266*cdf0e10cSrcweir AttachBasicMacroToEvent(oBaseDocument,"OnSaveAsDone", "") 267*cdf0e10cSrcweir AttachBasicMacroToEvent(oBaseDocument,"OnNew", "") 268*cdf0e10cSrcweir oBaseDocument.Store 269*cdf0e10cSrcweir' oBaseDocument.UnlockControllers() 270*cdf0e10cSrcweirEnd Sub 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir 273*cdf0e10cSrcweirFunction CopyFile(ByVal SourceUrl as String, TargetDir as String) 274*cdf0e10cSrcweirDim sFileName as String 275*cdf0e10cSrcweirDim sNewFileUrl as String 276*cdf0e10cSrcweir If oUcb.Exists(TargetDir) Then 277*cdf0e10cSrcweir If Len(TargetDir) > 2 Then 278*cdf0e10cSrcweir sFileName = FileNameoutofPath(SourceUrl) 279*cdf0e10cSrcweir sNewFileUrl = TargetDir & sFileName 280*cdf0e10cSrcweir oUcb.Copy(SourceUrl, sNewFileUrl) 281*cdf0e10cSrcweir CopyFile() = sNewFileUrl 282*cdf0e10cSrcweir End If 283*cdf0e10cSrcweir End If 284*cdf0e10cSrcweirEnd Function 285*cdf0e10cSrcweir 286*cdf0e10cSrcweir 287*cdf0e10cSrcweirFunction getListBoxArrays(oUcb as Object, sFileFilter as String) 288*cdf0e10cSrcweirDim oDocProps as Object 289*cdf0e10cSrcweirDim oListboxControl as Object 290*cdf0e10cSrcweirDim Description as String 291*cdf0e10cSrcweirDim sField as String 292*cdf0e10cSrcweirDim sFieldList() as String 293*cdf0e10cSrcweirDim bItemFound as Boolean 294*cdf0e10cSrcweirDim MaxIndex as Integer 295*cdf0e10cSrcweirDim DirContent() as String 296*cdf0e10cSrcweirDim FileName as String 297*cdf0e10cSrcweirDim TemplatePath as String 298*cdf0e10cSrcweirDim FilterLen as Integer 299*cdf0e10cSrcweirDim i as Integer 300*cdf0e10cSrcweirDim m as Integer 301*cdf0e10cSrcweirDim n as Integer 302*cdf0e10cSrcweirDim s as Integer 303*cdf0e10cSrcweirDim a as Integer 304*cdf0e10cSrcweirDim LocMaxIndex as Integer 305*cdf0e10cSrcweirDim Properties() 306*cdf0e10cSrcweirDim DimCount as Integer 307*cdf0e10cSrcweirDim sExtension as String 308*cdf0e10cSrcweir oDocProps = CreateUnoService("com.sun.star.document.DocumentProperties") 309*cdf0e10cSrcweir FilterLen = Len(sFileFilter) 310*cdf0e10cSrcweir bItemFound = False 311*cdf0e10cSrcweir ' It has to be made sure that the TemplatePath <> "" 312*cdf0e10cSrcweir TemplatePath = GetOfficeSubPath("Template", "wizard/web/") 313*cdf0e10cSrcweir If TemplatePath = "" Then 314*cdf0e10cSrcweir Dim NullList() 315*cdf0e10cSrcweir getListBoxArrays() = NullList() 316*cdf0e10cSrcweir Exit Function 317*cdf0e10cSrcweir End If 318*cdf0e10cSrcweir DirContent() = oUcb.GetFolderContents(TemplatePath,True) 319*cdf0e10cSrcweir If sFileFilter = "/cnt" Then 320*cdf0e10cSrcweir DimCount = 2 321*cdf0e10cSrcweir Else 322*cdf0e10cSrcweir DimCount = 8 323*cdf0e10cSrcweir End If 324*cdf0e10cSrcweir LocMaxIndex = Ubound(DirContent()) 325*cdf0e10cSrcweir Dim List(LocMaxIndex, DimCount) as String 326*cdf0e10cSrcweir Dim SortList(LocMaxIndex,1) 327*cdf0e10cSrcweir For i = 0 to LocMaxIndex 328*cdf0e10cSrcweir SortList(i,0) = DirContent(i) 329*cdf0e10cSrcweir SortList(i,1) = RetrieveDocTitle(oDocProps, DirContent(i)) 330*cdf0e10cSrcweir Next i 331*cdf0e10cSrcweir SortList() = BubbleSortList(SortList(),True) 332*cdf0e10cSrcweir For i = 0 to LocMaxIndex 333*cdf0e10cSrcweir DirContent(i) = SortList(i,0) 334*cdf0e10cSrcweir Next i 335*cdf0e10cSrcweir a = 0 336*cdf0e10cSrcweir For i = 0 To LocMaxIndex 337*cdf0e10cSrcweir FileName = DirContent(i) 338*cdf0e10cSrcweir sExtension = Ucase(GetFileNameExtension(FileName)) 339*cdf0e10cSrcweir If Instr(1,Filename, sFileFilter) And sExtension = "STW" Then 340*cdf0e10cSrcweir bItemFound = True 341*cdf0e10cSrcweir Description = RetrieveDocTitle(oDocProps, FileName) 342*cdf0e10cSrcweir Properties = oDocProps.UserDefinedProperties.PropertyValues 343*cdf0e10cSrcweir List(a,1) = Description 344*cdf0e10cSrcweir If sFileFilter = "/cnt" Then 345*cdf0e10cSrcweir List(a,2) = Filename 346*cdf0e10cSrcweir Else 347*cdf0e10cSrcweir m = 2 348*cdf0e10cSrcweir For n = 0 To 3 349*cdf0e10cSrcweir sField = Properties(n).Value 350*cdf0e10cSrcweir sFieldList() = ArrayoutofString(sField, " ", MaxIndex) 351*cdf0e10cSrcweir For s = 0 To MaxIndex 352*cdf0e10cSrcweir If m < 6 Then 353*cdf0e10cSrcweir List(a,m) = sFieldList(s) & ".gif" 354*cdf0e10cSrcweir Else 355*cdf0e10cSrcweir List(a,m) = sFieldList(s) 356*cdf0e10cSrcweir End If 357*cdf0e10cSrcweir m = m + 1 358*cdf0e10cSrcweir Next s 359*cdf0e10cSrcweir Next n 360*cdf0e10cSrcweir List(a,8) = FileName 361*cdf0e10cSrcweir End If 362*cdf0e10cSrcweir a = a + 1 363*cdf0e10cSrcweir End If 364*cdf0e10cSrcweir Next i 365*cdf0e10cSrcweir If sFileFilter = "/cnt" Then 366*cdf0e10cSrcweir ReDim Preserve List(a-1,2) as String 367*cdf0e10cSrcweir Else 368*cdf0e10cSrcweir ReDim Preserve List(a-1,8) as String 369*cdf0e10cSrcweir End If 370*cdf0e10cSrcweir If Not bItemfound Then 371*cdf0e10cSrcweir MsgBox(WebWiz_gErrContentNotFound$, 16, WebWiz_gWizardName$) 372*cdf0e10cSrcweir DisposeDocument(oBaseDocument) 373*cdf0e10cSrcweir Stop 374*cdf0e10cSrcweir End If 375*cdf0e10cSrcweir getListBoxArrays = List() 376*cdf0e10cSrcweirEnd Function 377*cdf0e10cSrcweir 378*cdf0e10cSrcweir 379*cdf0e10cSrcweirSub SetGraphic(sWhich, sGraphicText as String) 380*cdf0e10cSrcweirDim oLocCursor as Object 381*cdf0e10cSrcweirDim oGraphic as Object 382*cdf0e10cSrcweirDim bGetGraphic as Boolean 383*cdf0e10cSrcweir oBookmarks = oBaseDocument.BookMarks 384*cdf0e10cSrcweir If oBookmarks.HasbyName(sWhich)Then 385*cdf0e10cSrcweir oBookMark = oBookmarks.GetbyName(sWhich) 386*cdf0e10cSrcweir oLocCursor = oBookMark.Anchor.Text.CreateTextCursorByRange(oBookMark.Anchor) 387*cdf0e10cSrcweir oGraphic = oBaseDocument.CreateInstance("com.sun.star.text.GraphicObject") 388*cdf0e10cSrcweir oLocCursor.GoRight(3,True) 389*cdf0e10cSrcweir oGraphic.AnchorType = 1 390*cdf0e10cSrcweir oGraphic.GraphicURL = ConverttoURL(sGraphicText) 391*cdf0e10cSrcweir oLocCursor.Text.InsertTextContent(oLocCursor, oGraphic, True) 392*cdf0e10cSrcweir oGraphic.Name = sWhich 393*cdf0e10cSrcweir ElseIf oBaseDocument.GraphicObjects.HasbyName(sWhich) Then 394*cdf0e10cSrcweir oGraphic = oBaseDocument.GraphicObjects.GetByName(sWhich) 395*cdf0e10cSrcweir oGraphic.GraphicUrl = sGraphicText 396*cdf0e10cSrcweir End If 397*cdf0e10cSrcweirEnd Sub 398*cdf0e10cSrcweir 399*cdf0e10cSrcweir 400*cdf0e10cSrcweirSub CheckControls(oDrawPage as Object) 401*cdf0e10cSrcweirDim aForm as Object 402*cdf0e10cSrcweirDim m,n as integer 403*cdf0e10cSrcweirDim lColor as Long 404*cdf0e10cSrcweirDim oControl as Object 405*cdf0e10cSrcweir lColor = oBaseDocument.StyleFamilies.GetbyName("ParagraphStyles").GetByName("Standard").CharColor 406*cdf0e10cSrcweir 'SearchFor all possible Controls 407*cdf0e10cSrcweir For n = 0 to oDrawPage.Forms.Count - 1 408*cdf0e10cSrcweir aForm = oDrawPage.Forms(n) 409*cdf0e10cSrcweir For m = 0 to aForm.Count-1 410*cdf0e10cSrcweir oControl = aForm.GetbyIndex(m) 411*cdf0e10cSrcweir oControl.TextColor = lColor 412*cdf0e10cSrcweir Next 413*cdf0e10cSrcweir Next 414*cdf0e10cSrcweirEnd Sub 415*cdf0e10cSrcweir 416*cdf0e10cSrcweir 417*cdf0e10cSrcweirSub RepaintHeaderPreview() 418*cdf0e10cSrcweirDim Bitmap As Object 419*cdf0e10cSrcweirDim sBitmapPath as String 420*cdf0e10cSrcweir sBitmapPath = SOBitmapPath & "webwizard.bmp" 421*cdf0e10cSrcweir WebWzrd.ImagePreview.ImageURL = sBitmapPath 422*cdf0e10cSrcweirEnd Sub 423*cdf0e10cSrcweir 424*cdf0e10cSrcweir 425*cdf0e10cSrcweirSub ToggleDialogControls(ByVal bDoEnable as Boolean, Optional FocusControlName as String) 426*cdf0e10cSrcweir If Not IsNull(DialogModel) Then 427*cdf0e10cSrcweir DialogModel.Enabled = bDoEnable 428*cdf0e10cSrcweir If bDoEnable Then 429*cdf0e10cSrcweir ' Enable Controls referring to Background graphic only when this Property is set 430*cdf0e10cSrcweir bDoEnable = bWithBackGraphic 431*cdf0e10cSrcweir ToggleOptionButtons(DialogModel, bDoEnable) 432*cdf0e10cSrcweir MainDialog.GetControl(FocusControlName).SetFocus() 433*cdf0e10cSrcweir End If 434*cdf0e10cSrcweir End If 435*cdf0e10cSrcweirEnd Sub 436*cdf0e10cSrcweir</script:module> 437