1cdf0e10cSrcweir<?xml version="1.0" encoding="UTF-8"?> 2cdf0e10cSrcweir<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> 3*3e02b54dSAndrew Rist<!--*********************************************************** 4*3e02b54dSAndrew Rist * 5*3e02b54dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 6*3e02b54dSAndrew Rist * or more contributor license agreements. See the NOTICE file 7*3e02b54dSAndrew Rist * distributed with this work for additional information 8*3e02b54dSAndrew Rist * regarding copyright ownership. The ASF licenses this file 9*3e02b54dSAndrew Rist * to you under the Apache License, Version 2.0 (the 10*3e02b54dSAndrew Rist * "License"); you may not use this file except in compliance 11*3e02b54dSAndrew Rist * with the License. You may obtain a copy of the License at 12*3e02b54dSAndrew Rist * 13*3e02b54dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 14*3e02b54dSAndrew Rist * 15*3e02b54dSAndrew Rist * Unless required by applicable law or agreed to in writing, 16*3e02b54dSAndrew Rist * software distributed under the License is distributed on an 17*3e02b54dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18*3e02b54dSAndrew Rist * KIND, either express or implied. See the License for the 19*3e02b54dSAndrew Rist * specific language governing permissions and limitations 20*3e02b54dSAndrew Rist * under the License. 21*3e02b54dSAndrew Rist * 22*3e02b54dSAndrew Rist ***********************************************************--> 23cdf0e10cSrcweir<script:module xmlns:script="http://openoffice.org/2000/script" script:name="ShowInfoDialog" script:language="StarBasic">REM ***** BASIC ***** 24cdf0e10cSrcweirDim oWnd As Object 25cdf0e10cSrcweirDim oWnd2 As Object 26cdf0e10cSrcweirDim oWnd3 As Object 27cdf0e10cSrcweirDim oDoc as Object 28cdf0e10cSrcweir 29cdf0e10cSrcweirSub ShowInfoMain 30cdf0e10cSrcweir prop() = GetShowInfoPropeties() 31cdf0e10cSrcweir Init(prop(0).Value, prop(1).Value, prop(2).Value, prop(3).Value, prop(4).Value, prop(5).Value, prop(6).Value, prop(7).Value, prop(8).Value) 32cdf0e10cSrcweirEnd Sub 33cdf0e10cSrcweir 34cdf0e10cSrcweirSub Init(tFieldText As String, windowX, windowY, windowWidth, windowHeight, tFieldX, tFieldY, tFieldWidth, tFieldHeight) 35cdf0e10cSrcweir toolkit = createUnoService("com.sun.star.awt.Toolkit") 36cdf0e10cSrcweir Dim oWndDescr As new com.sun.star.awt.WindowDescriptor 37cdf0e10cSrcweir Dim oBounds As new com.sun.star.awt.Rectangle 38cdf0e10cSrcweir oWndDescr.Type = com.sun.star.awt.WindowClass.TOP 39cdf0e10cSrcweir oWndDescr.WindowServiceName = "" 40cdf0e10cSrcweir oWndDescr.ParentIndex = 0 41cdf0e10cSrcweir 42cdf0e10cSrcweir 'officeX = StarDesktop.ActiveFrame.getContainerWindow().AccessibleContext.LocationOnScreen.X 43cdf0e10cSrcweir 'officeY = StarDesktop.ActiveFrame.getContainerWindow().AccessibleContext.LocationOnScreen.Y 44cdf0e10cSrcweir 'officeWidth = StarDesktop.ActiveFrame.getContainerWindow().getPosSize().Width 45cdf0e10cSrcweir 'officeHeight = StarDesktop.ActiveFrame.getContainerWindow().getPosSize().Height 46cdf0e10cSrcweir officeWidth = thisComponent.CurrentController.Frame.getContainerWindow().getPosSize().Width 47cdf0e10cSrcweir officeHeight = thisComponent.CurrentController.Frame.getContainerWindow().getPosSize().Height 48cdf0e10cSrcweir 49cdf0e10cSrcweir 'dialogWidth = myTutoShowDialog.getPosSize().Width 50cdf0e10cSrcweir 'dialogHeight = myTutoShowDialog.getPosSize().Height 51cdf0e10cSrcweir X = officeWidth - windowWidth - windowX 52cdf0e10cSrcweir Y = officeHeight - windowHeight - windowY 53cdf0e10cSrcweir 54cdf0e10cSrcweir oBounds.X = X : oBounds.Y = Y 55cdf0e10cSrcweir oBounds.Width = windowWidth : oBounds.Height = windowHeight 56cdf0e10cSrcweir oWndDescr.Bounds = oBounds 57cdf0e10cSrcweir oWndDescr.Parent = thisComponent.CurrentController.Frame.ContainerWindow 58cdf0e10cSrcweir with com.sun.star.awt.WindowAttribute 59cdf0e10cSrcweir oWndDescr.WindowAttributes = .CLOSEABLE AND .MOVEABLE AND .SIZEABLE AND .BORDER AND .SHOW 60cdf0e10cSrcweir end with 61cdf0e10cSrcweir 62cdf0e10cSrcweir oWnd = toolkit.createWindow(oWndDescr) 63cdf0e10cSrcweir 64cdf0e10cSrcweir Dim oWndDescr3 As new com.sun.star.awt.WindowDescriptor 65cdf0e10cSrcweir Dim oBounds3 As new com.sun.star.awt.Rectangle 66cdf0e10cSrcweir oWndDescr3.Type = com.sun.star.awt.WindowClass.TOP 67cdf0e10cSrcweir oWndDescr3.WindowServiceName = "fixedimage" '"fixedtext" 68cdf0e10cSrcweir oWndDescr3.ParentIndex = 0 69cdf0e10cSrcweir oBounds3.X = 0 : oBounds3.Y = 0 70cdf0e10cSrcweir oBounds3.Width = tFieldWidth : oBounds3.Height = tFieldHeight 71cdf0e10cSrcweir oWndDescr3.Bounds = oBounds3 72cdf0e10cSrcweir oWndDescr3.Parent = oWnd 73cdf0e10cSrcweir with com.sun.star.awt.WindowAttribute 74cdf0e10cSrcweir oWndDescr3.WindowAttributes = .CLOSEABLE AND .MOVEABLE AND .SIZEABLE AND .BORDER AND .SHOW 75cdf0e10cSrcweir end with 76cdf0e10cSrcweir 77cdf0e10cSrcweir oWnd3= toolkit.createWindow(oWndDescr3) 78cdf0e10cSrcweir 'oWnd2.Text = tFieldText 79cdf0e10cSrcweir 'printdbgInfo(oWnd3) 80cdf0e10cSrcweir setImage(oWnd3) 81cdf0e10cSrcweir 'oWnd3.Background = 16777215 82cdf0e10cSrcweir' oWnd2.SetBackGround(16776960) 83cdf0e10cSrcweir oWnd.SetBackGround(16776960) 84cdf0e10cSrcweir' oWnd.FontDescriptors(0).Name = "Albany" 85cdf0e10cSrcweir' oWnd.FontDescriptors(0).StyleName = "BOLD" 86cdf0e10cSrcweir 87cdf0e10cSrcweir Dim oWndDescr2 As new com.sun.star.awt.WindowDescriptor 88cdf0e10cSrcweir Dim oBounds2 As new com.sun.star.awt.Rectangle 89cdf0e10cSrcweir oWndDescr2.Type = com.sun.star.awt.WindowClass.TOP 90cdf0e10cSrcweir oWndDescr2.WindowServiceName = "fixedtext" 91cdf0e10cSrcweir oWndDescr2.ParentIndex = 0 92cdf0e10cSrcweir oBounds2.X = tFieldX : oBounds2.Y = tFieldY 93cdf0e10cSrcweir oBounds2.Width = tFieldWidth : oBounds2.Height = tFieldHeight 94cdf0e10cSrcweir oWndDescr2.Bounds = oBounds2 95cdf0e10cSrcweir oWndDescr2.Parent = oWnd3 96cdf0e10cSrcweir with com.sun.star.awt.WindowAttribute 97cdf0e10cSrcweir oWndDescr2.WindowAttributes = .CLOSEABLE AND .MOVEABLE AND .SIZEABLE AND .BORDER AND .SHOW 98cdf0e10cSrcweir end with 99cdf0e10cSrcweir 100cdf0e10cSrcweir oWnd2= toolkit.createWindow(oWndDescr2) 101cdf0e10cSrcweir oWnd2.Text = tFieldText 102cdf0e10cSrcweir oWnd2.Background = 268435455 103cdf0e10cSrcweir 'printdbgInfo(oWnd2) 104cdf0e10cSrcweir 105cdf0e10cSrcweir 'printdbgInfo oWnd.getPosSize() 106cdf0e10cSrcweir 107cdf0e10cSrcweirEnd Sub 108cdf0e10cSrcweir 109cdf0e10cSrcweirFunction GetShowInfoPropeties() 110cdf0e10cSrcweir stepText = GetStepTitle() 111cdf0e10cSrcweir Dim Properties(8) As new com.sun.star.beans.NamedValue 112cdf0e10cSrcweir Properties(0).Name = "ShowInfoDialogText" 113cdf0e10cSrcweir Properties(0).Value = stepText & "Press [Esc] to abort." 114cdf0e10cSrcweir Properties(1).Name = "WindowX" 115cdf0e10cSrcweir Properties(1).Value = 20 116cdf0e10cSrcweir Properties(2).Name = "WindowY" 117cdf0e10cSrcweir Properties(2).Value = 40 118cdf0e10cSrcweir Properties(3).Name = "WindowWidth" 119cdf0e10cSrcweir Properties(3).Value = 190 120cdf0e10cSrcweir Properties(4).Name = "WindowHeight" 121cdf0e10cSrcweir Properties(4).Value = 50 122cdf0e10cSrcweir Properties(5).Name = "TFieldX" 123cdf0e10cSrcweir Properties(5).Value = 7 124cdf0e10cSrcweir Properties(6).Name = "TFieldY" 125cdf0e10cSrcweir Properties(6).Value = 8 126cdf0e10cSrcweir Properties(7).Name = "TFieldWidth" 127cdf0e10cSrcweir Properties(7).Value = 190 128cdf0e10cSrcweir Properties(8).Name = "TFieldHeight" 129cdf0e10cSrcweir Properties(8).Value = 50 130cdf0e10cSrcweir GetShowInfoPropeties = Properties() 131cdf0e10cSrcweirEnd Function 132cdf0e10cSrcweir 133cdf0e10cSrcweirSub setShowInfoText() 134cdf0e10cSrcweir stepText = GetStepTitle() 135cdf0e10cSrcweir oWnd2.Text = stepText & "Press [Esc] to abort." 136cdf0e10cSrcweirEnd Sub 137cdf0e10cSrcweir 138cdf0e10cSrcweirSub ShowON() 139cdf0e10cSrcweir setShowInfoText() 140cdf0e10cSrcweir oWnd.setVisible(True) 141cdf0e10cSrcweir oWnd3.setVisible(True) 142cdf0e10cSrcweir oWnd2.setVisible(True) 143cdf0e10cSrcweirEnd Sub 144cdf0e10cSrcweir 145cdf0e10cSrcweirSub ShowOFF() 146cdf0e10cSrcweir 'On Local Error Goto NOPROPERTYSETINFO: 147cdf0e10cSrcweir oWnd.setVisible(False) 148cdf0e10cSrcweir oWnd2.setVisible(False) 149cdf0e10cSrcweir oWnd3.setVisible(False) 150cdf0e10cSrcweir 'oDoc.dispose() 151cdf0e10cSrcweir Exit Sub 152cdf0e10cSrcweir 'NOPROPERTYSETINFO: 153cdf0e10cSrcweirEnd Sub 154cdf0e10cSrcweir 155cdf0e10cSrcweirSub DisposeIDialog() 156cdf0e10cSrcweir 'On Local Error Goto NOPROPERTYSETINFO: 157cdf0e10cSrcweir oWnd3.dispose 158cdf0e10cSrcweir oWnd2.dispose 159cdf0e10cSrcweir oWnd.dispose 160cdf0e10cSrcweir oDoc.dispose() 161cdf0e10cSrcweir Exit Sub 162cdf0e10cSrcweir 'NOPROPERTYSETINFO: 163cdf0e10cSrcweirEnd Sub 164cdf0e10cSrcweir 165cdf0e10cSrcweirsub setImage(whatever as Object) 166cdf0e10cSrcweir 167cdf0e10cSrcweir templatePath = GetPathSettings("Template",false, 0) 168cdf0e10cSrcweir Dim bitmapPath As String 169cdf0e10cSrcweir iPos = InStr(templatePath,"/") 170cdf0e10cSrcweir if(iPos > 0) Then 171cdf0e10cSrcweir bitmapPath = templatePath & "../wizard/bitmap/tutorial_background.gif" 172cdf0e10cSrcweir Else 173cdf0e10cSrcweir bitmapPath = templatePath & "..\wizard\bitmap\tutorial_background.gif" 174cdf0e10cSrcweir End If 175cdf0e10cSrcweir 176cdf0e10cSrcweir dim props(0) as new com.sun.star.beans.PropertyValue 177cdf0e10cSrcweir props(0).Name = "Hidden" 178cdf0e10cSrcweir props(0).Value = true 179cdf0e10cSrcweir oDoc = StarDesktop.loadComponentFromUrl("private:factory/swriter","_blank",0,props()) 180cdf0e10cSrcweir oShape = addControlToDefaultForm("ImageButton", 1000, 1000, 2000, 1000) 181cdf0e10cSrcweir imgControl = oShape.getControl() 182cdf0e10cSrcweir 'imgControl.ImageUrl="file:///D:/Program%20Files/src680_m11_qwizards1_49_TEST/share/gallery/tutoItem.gif" 183cdf0e10cSrcweir imgControl.ImageUrl = bitmapPath 184cdf0e10cSrcweir imgControl.addConsumer(whatever) 185cdf0e10cSrcweir imgControl.startProduction() 186cdf0e10cSrcweirend sub 187cdf0e10cSrcweir 188cdf0e10cSrcweirFunction createControlShape(cKind As String) As Object 189cdf0e10cSrcweir 190cdf0e10cSrcweir Dim oControlShape As Object 191cdf0e10cSrcweir Dim oControl As Object 192cdf0e10cSrcweir 193cdf0e10cSrcweir 194cdf0e10cSrcweir oControlShape = oDoc.createInstance("com.sun.star.drawing.ControlShape") 195cdf0e10cSrcweir oControl = oDoc.createInstance("com.sun.star.form.component." & cKind) 196cdf0e10cSrcweir oControl.setPropertyValue("DefaultControl", "com.sun.star.form.control." & cKind) 197cdf0e10cSrcweir oControlShape.setControl(oControl) 198cdf0e10cSrcweir 199cdf0e10cSrcweir 200cdf0e10cSrcweir createControlShape() = oControlShape 201cdf0e10cSrcweir 202cdf0e10cSrcweirEnd Function 203cdf0e10cSrcweir 204cdf0e10cSrcweirFunction createControlShapeWithDefaultControl(cKind As String) As Object 205cdf0e10cSrcweir 206cdf0e10cSrcweir Dim oControlShape As Object 207cdf0e10cSrcweir Dim oControl As Object 208cdf0e10cSrcweir 209cdf0e10cSrcweir 210cdf0e10cSrcweir oControlShape = oDoc.createInstance("com.sun.star.drawing.ControlShape") 211cdf0e10cSrcweir oControl = oDoc.createInstance("com.sun.star.form.component." & cKind) 212cdf0e10cSrcweir oControlShape.setControl(oControl) 213cdf0e10cSrcweir 214cdf0e10cSrcweir 215cdf0e10cSrcweir createControlShapeWithDefaultControl() = oControlShape 216cdf0e10cSrcweir 217cdf0e10cSrcweirEnd Function 218cdf0e10cSrcweir 219cdf0e10cSrcweirFunction createUNOControlShape(cKind As String, defControl As String) As Object 220cdf0e10cSrcweir 221cdf0e10cSrcweir Dim oControlShape As Object 222cdf0e10cSrcweir Dim oControl As Object 223cdf0e10cSrcweir 224cdf0e10cSrcweir 225cdf0e10cSrcweir oControlShape = oDoc.createInstance("com.sun.star.drawing.ControlShape") 226cdf0e10cSrcweir oControl = oDoc.createInstance("com.sun.star.form.component." & cKind) 227cdf0e10cSrcweir oControl.setPropertyValue("DefaultControl", "com.sun.star.awt." & defControl) 228cdf0e10cSrcweir oControlShape.setControl(oControl) 229cdf0e10cSrcweir 230cdf0e10cSrcweir 231cdf0e10cSrcweir createUNOControlShape() = oControlShape 232cdf0e10cSrcweir 233cdf0e10cSrcweirEnd Function 234cdf0e10cSrcweir 235cdf0e10cSrcweirFunction addShape(oShape As Object) As Boolean 236cdf0e10cSrcweir 237cdf0e10cSrcweir Dim vSize As New com.sun.star.awt.Size 238cdf0e10cSrcweir Dim oDrawPage As Object 239cdf0e10cSrcweir Dim oForms As Object 240cdf0e10cSrcweir Dim oForm As Object 241cdf0e10cSrcweir 242cdf0e10cSrcweir oDrawPage = oDoc.getDrawPage() 243cdf0e10cSrcweir oForms = oDrawPage.getForms() 244cdf0e10cSrcweir 245cdf0e10cSrcweir if oForms.Count = 0 then 246cdf0e10cSrcweir oForm = oDoc.createInstance("com.sun.star.form.component.Form") 247cdf0e10cSrcweir oForms.insertByIndex(0, oForm) 248cdf0e10cSrcweir end if 249cdf0e10cSrcweir 250cdf0e10cSrcweir vSize.Height = 2000 : vSize.Width = 2000 251cdf0e10cSrcweir oShape.Size = vSize 252cdf0e10cSrcweir oDrawPage.add(oShape) 253cdf0e10cSrcweir 254cdf0e10cSrcweir addShape() = true 255cdf0e10cSrcweir 256cdf0e10cSrcweirEnd Function 257cdf0e10cSrcweir 258cdf0e10cSrcweirsub addControl(cKind as String) 259cdf0e10cSrcweir 260cdf0e10cSrcweir Dim oDrawPage As Object 261cdf0e10cSrcweir Dim oForm As Object, oForms As Object 262cdf0e10cSrcweir Dim oControl As Object, oControlShape As Object 263cdf0e10cSrcweir Dim aSz As Variant 264cdf0e10cSrcweir Dim oText As Object 265cdf0e10cSrcweir 266cdf0e10cSrcweir oDrawPage = oDoc.DrawPage 267cdf0e10cSrcweir oControlShape = oDoc.createInstance("com.sun.star.drawing.ControlShape") 268cdf0e10cSrcweir oControl = oDoc.createInstance("com.sun.star.form.component." + cKind) 269cdf0e10cSrcweir oForm = oDoc.createInstance("com.sun.star.form.component.Form") 270cdf0e10cSrcweir oforms = oDrawPage.Forms 271cdf0e10cSrcweir if oforms.count = 0 then 272cdf0e10cSrcweir oforms.insertbyindex(0,oForm) 273cdf0e10cSrcweir end if 274cdf0e10cSrcweir oControlShape.Control = oControl 275cdf0e10cSrcweir oDrawPage.add(oControlShape) 276cdf0e10cSrcweir 277cdf0e10cSrcweirEnd sub 278cdf0e10cSrcweir 279cdf0e10cSrcweirFunction addControlToDefaultForm(cKind as String, x As Integer, y As Integer, width As Integer, height As Integer) As Object 280cdf0e10cSrcweir 281cdf0e10cSrcweir Dim oDrawPage As Object 282cdf0e10cSrcweir Dim oControl As Object, oControlShape As Object 283cdf0e10cSrcweir Dim pos As New com.sun.star.awt.Point 284cdf0e10cSrcweir Dim size As New com.sun.star.awt.Size 285cdf0e10cSrcweir 286cdf0e10cSrcweir pos.X = x 287cdf0e10cSrcweir pos.Y = y 288cdf0e10cSrcweir size.Width = width 289cdf0e10cSrcweir size.Height = height 290cdf0e10cSrcweir 291cdf0e10cSrcweir oDrawPage = oDoc.DrawPage 292cdf0e10cSrcweir oControlShape = oDoc.createInstance("com.sun.star.drawing.ControlShape") 293cdf0e10cSrcweir oControl = oDoc.createInstance("com.sun.star.form.component." + cKind) 294cdf0e10cSrcweir oControlShape.Control = oControl 295cdf0e10cSrcweir oControlShape.Position = pos 296cdf0e10cSrcweir oControlShape.Size = size 297cdf0e10cSrcweir oDrawPage.add(oControlShape) 298cdf0e10cSrcweir 299cdf0e10cSrcweir addControlToDefaultForm() = oControlShape 300cdf0e10cSrcweir 301cdf0e10cSrcweirEnd Function 302cdf0e10cSrcweir 303cdf0e10cSrcweirFunction addShapeToDrawDoc(oPage as Object, nPosX, nPosY as Integer, oType As String) As Object 304cdf0e10cSrcweir Dim aPoint As New com.sun.star.awt.Point 305cdf0e10cSrcweir Dim aSize As New com.sun.star.awt.Size 306cdf0e10cSrcweir Dim oShape As Object 307cdf0e10cSrcweir Dim servNames As Variant 308cdf0e10cSrcweir 309cdf0e10cSrcweir aPoint.x = nPosX 310cdf0e10cSrcweir aPoint.y = nPosY 311cdf0e10cSrcweir aSize.Width = 2000 312cdf0e10cSrcweir aSize.Height = 1000 313cdf0e10cSrcweir oShape = oDoc.createInstance("com.sun.star.drawing."+oType+"Shape") 314cdf0e10cSrcweir oShape.Size = aSize 315cdf0e10cSrcweir oShape.Position = aPoint 316cdf0e10cSrcweir 317cdf0e10cSrcweir if oShape.getPropertySetInfo().hasPropertyByName("FillColor") then 318cdf0e10cSrcweir oShape.FillColor = RGB(128, 255, 0) 319cdf0e10cSrcweir End If 320cdf0e10cSrcweir 321cdf0e10cSrcweir oPage.add(oShape) 322cdf0e10cSrcweir 323cdf0e10cSrcweir addShapeToDrawDoc() = oShape 324cdf0e10cSrcweirEnd Function 325*3e02b54dSAndrew Rist</script:module> 326