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