HtmlAutoPilotBasic.xba (3e02b54d) | HtmlAutoPilotBasic.xba (c881e2b3) |
---|---|
1<?xml version="1.0" encoding="UTF-8"?> 2<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> 3<!--*********************************************************** | 1<?xml version="1.0" encoding="UTF-8"?> 2<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> 3<!--*********************************************************** |
4 * | 4 * |
5 * Licensed to the Apache Software Foundation (ASF) under one 6 * or more contributor license agreements. See the NOTICE file 7 * distributed with this work for additional information 8 * regarding copyright ownership. The ASF licenses this file 9 * to you under the Apache License, Version 2.0 (the 10 * "License"); you may not use this file except in compliance 11 * with the License. You may obtain a copy of the License at | 5 * Licensed to the Apache Software Foundation (ASF) under one 6 * or more contributor license agreements. See the NOTICE file 7 * distributed with this work for additional information 8 * regarding copyright ownership. The ASF licenses this file 9 * to you under the Apache License, Version 2.0 (the 10 * "License"); you may not use this file except in compliance 11 * with the License. You may obtain a copy of the License at |
12 * | 12 * |
13 * http://www.apache.org/licenses/LICENSE-2.0 | 13 * http://www.apache.org/licenses/LICENSE-2.0 |
14 * | 14 * |
15 * Unless required by applicable law or agreed to in writing, 16 * software distributed under the License is distributed on an 17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18 * KIND, either express or implied. See the License for the 19 * specific language governing permissions and limitations 20 * under the License. | 15 * Unless required by applicable law or agreed to in writing, 16 * software distributed under the License is distributed on an 17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18 * KIND, either express or implied. See the License for the 19 * specific language governing permissions and limitations 20 * under the License. |
21 * | 21 * |
22 ***********************************************************--> 23<script:module xmlns:script="http://openoffice.org/2000/script" script:name="HtmlAutoPilotBasic" script:language="StarBasic">' Variables must be declared 24Option Explicit 25 26Public CurDocIndex as Integer 27Public CurWebPageIndex as Integer 28 29 --- 139 unchanged lines hidden (view full) --- 169 oBaseDocument.LockControllers 170 bWithBackGraphic = LoadNewStyles(oBaseDocument, DialogModel, CurWebPageIndex, FileStr, Style(), TextureDir) 171 CurrentBullet$ = BulletDir + Style(CurWebPageIndex, 6) 172 CurrentPrev$ = GraphicsDir + Style(CurWebPageIndex, 2) 173 CurrentNext$ = GraphicsDir + Style(CurWebPageIndex, 3) 174 CurrentHome$ = GraphicsDir + Style(CurWebPageIndex, 4) 175 CurrentTop$ = GraphicsDir + Style(CurWebPageIndex, 5) 176 With oBaseDocument.DocumentProperties.UserDefinedProperties | 22 ***********************************************************--> 23<script:module xmlns:script="http://openoffice.org/2000/script" script:name="HtmlAutoPilotBasic" script:language="StarBasic">' Variables must be declared 24Option Explicit 25 26Public CurDocIndex as Integer 27Public CurWebPageIndex as Integer 28 29 --- 139 unchanged lines hidden (view full) --- 169 oBaseDocument.LockControllers 170 bWithBackGraphic = LoadNewStyles(oBaseDocument, DialogModel, CurWebPageIndex, FileStr, Style(), TextureDir) 171 CurrentBullet$ = BulletDir + Style(CurWebPageIndex, 6) 172 CurrentPrev$ = GraphicsDir + Style(CurWebPageIndex, 2) 173 CurrentNext$ = GraphicsDir + Style(CurWebPageIndex, 3) 174 CurrentHome$ = GraphicsDir + Style(CurWebPageIndex, 4) 175 CurrentTop$ = GraphicsDir + Style(CurWebPageIndex, 5) 176 With oBaseDocument.DocumentProperties.UserDefinedProperties |
177 .AutoPilotName1 = ExtractGraphicNames(CurWebPageIndex,2) 178 .AutoPilotName2 = ExtractGraphicNames(CurWebPageIndex, 4) 179 .AutoPilotBullet = Style(CurWebPageIndex, 6) 180 .AutoPilotBackground = Style(CurWebPageIndex, 7) | 177 .AutoPilotName1 = ExtractGraphicNames(CurWebPageIndex,2) 178 .AutoPilotName2 = ExtractGraphicNames(CurWebPageIndex, 4) 179 .AutoPilotBullet = Style(CurWebPageIndex, 6) 180 .AutoPilotBackground = Style(CurWebPageIndex, 7) |
181 End With 182 SetBulletAndGraphics() 183 CheckControls(oBaseDocument.DrawPage) 184 oViewCursor.GotoStart(False) 185 oBaseDocument.UnlockControllers 186 ToggleDialogControls(True, "lbStyles") 187 End If 188End Sub 189 190 191Function ExtractGraphicNames(CurIndex as Integer, i as Integer) as String 192Dim FieldValue as String 193 FieldValue = GetFileNameWithoutExtension(Style(CurIndex, i)) | 181 End With 182 SetBulletAndGraphics() 183 CheckControls(oBaseDocument.DrawPage) 184 oViewCursor.GotoStart(False) 185 oBaseDocument.UnlockControllers 186 ToggleDialogControls(True, "lbStyles") 187 End If 188End Sub 189 190 191Function ExtractGraphicNames(CurIndex as Integer, i as Integer) as String 192Dim FieldValue as String 193 FieldValue = GetFileNameWithoutExtension(Style(CurIndex, i)) |
194 FieldValue = FieldValue & " " & GetFileNameWithoutExtension(Style(CurIndex, i+1)) | 194 FieldValue = FieldValue & " " & GetFileNameWithoutExtension(Style(CurIndex, i+1)) |
195 ExtractGraphicNames = FieldValue 196End Function 197 198 199Sub SetBulletAndGraphics 200 SetGraphic("Prev", CurrentPrev) 201 SetGraphic("Next", CurrentNext) 202 SetGraphic("Home", CurrentHome) --- 49 unchanged lines hidden (view full) --- 252Sub CopyGraphics 253' This sub copies all the graphics used in the document to the same directory the 254' document has been copied into and changes the graphics links in the document. 255Dim oGraphicObjects as Object 256Dim oGraphic as Object 257Dim i as Integer 258Dim udProps as Object 259Dim SavePath as String | 195 ExtractGraphicNames = FieldValue 196End Function 197 198 199Sub SetBulletAndGraphics 200 SetGraphic("Prev", CurrentPrev) 201 SetGraphic("Next", CurrentNext) 202 SetGraphic("Home", CurrentHome) --- 49 unchanged lines hidden (view full) --- 252Sub CopyGraphics 253' This sub copies all the graphics used in the document to the same directory the 254' document has been copied into and changes the graphics links in the document. 255Dim oGraphicObjects as Object 256Dim oGraphic as Object 257Dim i as Integer 258Dim udProps as Object 259Dim SavePath as String |
260 BasicLibraries.LoadLibrary("Tools") | 260 BasicLibraries.LoadLibrary("Tools") |
261 oUcb = createUnoService("com.sun.star.ucb.SimpleFileAccess") 262 GetWebWizardPaths() 263 oBaseDocument = ThisComponent 264' oBaseDocument.LockControllers() 265 266 ' Note: The sub DirectoryNameoutofPath should be change, so that the last character is a slash 267 SavePath = DirectoryNameoutofPath(oBaseDocument.Url, "/") & "/" 268 269 oGraphicObjects = oBaseDocument.GraphicObjects 270 For i = 0 to oGraphicObjects.Count-1 271 oGraphic = oGraphicObjects.GetbyIndex(i) 272 oGraphic.GraphicUrl = CopyFile(oGraphic.GraphicURL, SavePath) 273 Next i 274 275 ChangeBackGraphicUrl(SavePath) 276 277 BulletUrlsToSavePath(SavePath) 278 | 261 oUcb = createUnoService("com.sun.star.ucb.SimpleFileAccess") 262 GetWebWizardPaths() 263 oBaseDocument = ThisComponent 264' oBaseDocument.LockControllers() 265 266 ' Note: The sub DirectoryNameoutofPath should be change, so that the last character is a slash 267 SavePath = DirectoryNameoutofPath(oBaseDocument.Url, "/") & "/" 268 269 oGraphicObjects = oBaseDocument.GraphicObjects 270 For i = 0 to oGraphicObjects.Count-1 271 oGraphic = oGraphicObjects.GetbyIndex(i) 272 oGraphic.GraphicUrl = CopyFile(oGraphic.GraphicURL, SavePath) 273 Next i 274 275 ChangeBackGraphicUrl(SavePath) 276 277 BulletUrlsToSavePath(SavePath) 278 |
279 udProps = oBaseDocument.DocumentProperties.UserDefinedProperties 280 udProps.addProperty("AutoPilotName1", 0, "") 281 udProps.addProperty("AutoPilotName2", 0, "") 282 udProps.addProperty("AutoPilotBullet", 0, "") 283 udProps.addProperty("AutoPilotBackground", 0, "") | 279 udProps = oBaseDocument.DocumentProperties.UserDefinedProperties 280 udProps.addProperty("AutoPilotName1", 0, "") 281 udProps.addProperty("AutoPilotName2", 0, "") 282 udProps.addProperty("AutoPilotBullet", 0, "") 283 udProps.addProperty("AutoPilotBackground", 0, "") |
284 285 AttachBasicMacroToEvent(oBaseDocument,"OnSaveDone", "") 286 AttachBasicMacroToEvent(oBaseDocument,"OnSaveAsDone", "") 287 AttachBasicMacroToEvent(oBaseDocument,"OnNew", "") 288 oBaseDocument.Store 289' oBaseDocument.UnlockControllers() 290End Sub 291 --- 73 unchanged lines hidden (view full) --- 365 List(a,2) = Filename 366 Else 367 m = 2 368 For n = 0 To 3 369 sField = Properties(n).Value 370 sFieldList() = ArrayoutofString(sField, " ", MaxIndex) 371 For s = 0 To MaxIndex 372 If m < 6 Then | 284 285 AttachBasicMacroToEvent(oBaseDocument,"OnSaveDone", "") 286 AttachBasicMacroToEvent(oBaseDocument,"OnSaveAsDone", "") 287 AttachBasicMacroToEvent(oBaseDocument,"OnNew", "") 288 oBaseDocument.Store 289' oBaseDocument.UnlockControllers() 290End Sub 291 --- 73 unchanged lines hidden (view full) --- 365 List(a,2) = Filename 366 Else 367 m = 2 368 For n = 0 To 3 369 sField = Properties(n).Value 370 sFieldList() = ArrayoutofString(sField, " ", MaxIndex) 371 For s = 0 To MaxIndex 372 If m < 6 Then |
373 List(a,m) = sFieldList(s) & ".gif" | 373 List(a,m) = sFieldList(s) & ".gif" |
374 Else | 374 Else |
375 List(a,m) = sFieldList(s) | 375 List(a,m) = sFieldList(s) |
376 End If 377 m = m + 1 378 Next s 379 Next n 380 List(a,8) = FileName 381 End If 382 a = a + 1 383 End If --- 48 unchanged lines hidden (view full) --- 432 Next 433 Next 434End Sub 435 436 437Sub RepaintHeaderPreview() 438Dim Bitmap As Object 439Dim sBitmapPath as String | 376 End If 377 m = m + 1 378 Next s 379 Next n 380 List(a,8) = FileName 381 End If 382 a = a + 1 383 End If --- 48 unchanged lines hidden (view full) --- 432 Next 433 Next 434End Sub 435 436 437Sub RepaintHeaderPreview() 438Dim Bitmap As Object 439Dim sBitmapPath as String |
440 sBitmapPath = SOBitmapPath & "webwizard.bmp" | 440 sBitmapPath = SOBitmapPath & "webwizard.png" |
441 WebWzrd.ImagePreview.ImageURL = sBitmapPath 442End Sub 443 444 445Sub ToggleDialogControls(ByVal bDoEnable as Boolean, Optional FocusControlName as String) 446 If Not IsNull(DialogModel) Then 447 DialogModel.Enabled = bDoEnable 448 If bDoEnable Then 449 ' Enable Controls referring to Background graphic only when this Property is set 450 bDoEnable = bWithBackGraphic 451 ToggleOptionButtons(DialogModel, bDoEnable) 452 MainDialog.GetControl(FocusControlName).SetFocus() 453 End If 454 End If 455End Sub 456</script:module> | 441 WebWzrd.ImagePreview.ImageURL = sBitmapPath 442End Sub 443 444 445Sub ToggleDialogControls(ByVal bDoEnable as Boolean, Optional FocusControlName as String) 446 If Not IsNull(DialogModel) Then 447 DialogModel.Enabled = bDoEnable 448 If bDoEnable Then 449 ' Enable Controls referring to Background graphic only when this Property is set 450 bDoEnable = bWithBackGraphic 451 ToggleOptionButtons(DialogModel, bDoEnable) 452 MainDialog.GetControl(FocusControlName).SetFocus() 453 End If 454 End If 455End Sub 456</script:module> |