0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
| | Dim oDialog As Variant
Dim oCont As Variant
Sub CreateDialogTest10
oDoc = ThisComponent
oFrame = oDoc.getCurrentController().getFrame()
oContainerWindow = oFrame.getContainerWindow()
oToolkit = oContainerWindow.getToolkit()
WA = com.sun.star.awt.WindowAttribute
aRect = CreateUnoStruct("com.sun.star.awt.Rectangle")
aRect.Width = 200
aRect.Height = 200
oDesc = CreateUnoStruct("com.sun.star.awt.WindowDescriptor")
With oDesc
.Type = com.sun.star.awt.WindowClass.SIMPLE
.WindowServiceName = "dialog"
.Parent = oContainerWindow
.ParentIndex = -1
.Bounds = aRect
.WindowAttributes = WA.CLOSEABLE OR WA.MOVEABLE OR WA.SIZEABLE OR WA.BORDER
End With
oDialog = oToolkit.createWindow(oDesc)
oDialog.addTopWindowListener(CreateUnoListener(_
"WindowListener_", "com.sun.star.awt.XTopWindowListener"))
oDialog.addWindowListener(CreateUnoListener(_
"WindowListener_", "com.sun.star.awt.XWindowListener"))
oCont = CreateControlContainer(oDialog, 0, 0, 200, 200)
oEdit = CreateTextField(oCont, "edit", 0, 0, 200, 200, _
Array("MultiLine"), Array(True))
oDialog.setVisible(True)
n = oDialog.execute()
If n > 0 Then
End If
oDialog.dispose()
End Sub
Function CreateControlContainer(oParent, nX, nY, nWidth, nHeight)
oCont = CreateUnoService("com.sun.star.awt.UnoControlContainer")
oContModel = CreateUnoService("com.sun.star.awt.UnoControlContainerModel")
oCont.setModel(oContModel)
oCont.createPeer(oParent.getToolkit(), oParent)
oCont.setPosSize(nX, nY, nWidth, nHeight, com.sun.star.awt.PosSize.POSSIZE)
CreateControlContainer = oCont
End Function
Function CreateTextField(_
oContainer, sName, nX, nY, nWidth, nHeight, _
Optional sNames, Optional aValues)
oEdit = CreateUnoService("com.sun.star.awt.UnoControlEdit")
oEditModel = CreateUnoService("com.sun.star.awt.UnoControlEditModel")
oEdit.setModel(oEditModel)
If NOT IsMissing(sNames) Then
oEditModel.setPropertyValues(sNames, aValues)
End If
oContainer.addControl(sName, oEdit)
oEdit.setPosSize(nX, nY, nWidth, nHeight, com.sun.star.awt.PosSize.POSSIZE)
CreateTextField = oEdit
End Function
Sub WindowListener_disposing(ev)
End Sub
Sub WindowListener_windowOpened(ev)
End Sub
Sub WindowListener_windowClosing(ev)
oDialog.endExecute()
End Sub
Sub WindowListener_windowClosed(ev)
End Sub
Sub WindowListener_windowMinimized(ev)
End Sub
Sub WindowListener_windowNormalized(ev)
End Sub
Sub WindowListener_windowActivated(ev)
End Sub
Sub WindowListener_windowDeactivated(ev)
End Sub
Sub WindowListener_windowResized(ev)
aSize = ev.Source.getSize()
oCont.setPosSize(0, 0, aSize.Width, aSize.Height, com.sun.star.awt.PosSize.SIZE)
oEdit = oCont.getControl("edit")
oEdit.setPosSize(0, 0, aSize.Width, aSize.Height, com.sun.star.awt.PosSize.SIZE)
End Sub
Sub WindowListener_windowMoved(ev)
End Sub
Sub WindowListener_windowShown(ev)
End Sub
Sub WindowListener_windowHidden(ev)
End Sub
|