1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3<script:module xmlns:script="http://openoffice.org/2000/script" script:name="awt_XDataTransferProviderAccess" script:language="StarBasic">
4
5
6'*************************************************************************
7'
8'  Licensed to the Apache Software Foundation (ASF) under one
9'  or more contributor license agreements.  See the NOTICE file
10'  distributed with this work for additional information
11'  regarding copyright ownership.  The ASF licenses this file
12'  to you under the Apache License, Version 2.0 (the
13'  "License"); you may not use this file except in compliance
14'  with the License.  You may obtain a copy of the License at
15'
16'    http://www.apache.org/licenses/LICENSE-2.0
17'
18'  Unless required by applicable law or agreed to in writing,
19'  software distributed under the License is distributed on an
20'  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21'  KIND, either express or implied.  See the License for the
22'  specific language governing permissions and limitations
23'  under the License.
24'
25'*************************************************************************
26
27
28
29
30
31
32
33Sub RunTest()
34
35'*************************************************************************
36' INTERFACE:
37' com.sun.star.awt.XDataTransferProviderAccess
38'*************************************************************************
39On Error Goto ErrHndl
40    Dim bOK As Boolean
41
42    ' Here create a window for testing getDragGestureRecognizer(), getDragSource(), getDropTarget() methods
43    Dim oWndDescr As new com.sun.star.awt.WindowDescriptor
44    Dim oBounds As new com.sun.star.awt.Rectangle
45    oWndDescr.Type = com.sun.star.awt.WindowClass.TOP
46    oWndDescr.WindowServiceName = ""
47    oWndDescr.ParentIndex = -1
48    oBounds.X = 10 : oBounds.Y = 20
49    oBounds.Width = 110 : oBounds.Height = 120
50    oWndDescr.Bounds = oBounds
51    with com.sun.star.awt.WindowAttribute
52        oWndDescr.WindowAttributes = .CLOSEABLE AND .MOVEABLE AND .SIZEABLE AND .BORDER AND .SHOW
53    end with
54
55    Dim oWnd As Object
56    oWnd = oObj.createWindow(oWndDescr)
57
58    Test.StartMethod("getDragGestureRecognizer()")
59    bOK = true
60    Dim oRecognizer As Object
61    oRecognizer = oObj.getDragGestureRecognizer(oWnd)
62    Out.Log("Recognizer is NULL : " &amp; isNULL(oRecognizer))
63    bOK = bOK AND NOT isNULL(oRecognizer)
64    if (bOK) then
65        bOK = bOK AND hasUnoInterfaces(oRecognizer, "com.sun.star.datatransfer.dnd.XDragGestureRecognizer")
66        if (NOT bOK) then Out.Log("Returned object doesn't support XDragGestureRecognizer interface.")
67    end if
68    Test.MethodTested("getDragGestureRecognizer()", bOK)
69
70    Test.StartMethod("getDragSource()")
71    bOK = true
72    Dim oDragSource As Object
73    oDragSource = oObj.getDragSource(oWnd)
74    Out.Log("DragSource is NULL : " &amp; isNULL(oDragSource))
75    bOK = bOK AND NOT isNULL(oDragSource)
76    if (bOK) then
77        bOK = bOK AND hasUnoInterfaces(oDragSource, "com.sun.star.datatransfer.dnd.XDragSource")
78        if (NOT bOK) then Out.Log("Returned object doesn't support XDragSource interface.")
79    end if
80    Test.MethodTested("getDragSource()", bOK)
81
82    Test.StartMethod("getDropTarget()")
83    bOK = true
84    Dim oDropTarget As Object
85    oDropTarget = oObj.getDropTarget(oWnd)
86    Out.Log("DropTarget is NULL : " &amp; isNULL(oDropTarget))
87    bOK = bOK AND NOT isNULL(oDropTarget)
88    if (bOK) then
89        bOK = bOK AND hasUnoInterfaces(oDropTarget, "com.sun.star.datatransfer.dnd.XDropTarget")
90        if (NOT bOK) then Out.Log("Returned object doesn't support XDropTarget interface.")
91    end if
92     Test.MethodTested("getDropTarget()", bOK)
93
94    Test.StartMethod("getClipboard()")
95    bOK = true
96    Dim oClipboard As Object
97    oClipboard = oObj.getClipboard("")
98    Out.Log("Clipboard is NULL : " &amp; isNULL(oClipboard))
99    bOK = bOK AND NOT isNULL(oClipboard)
100    if (bOK) then
101        bOK = bOK AND hasUnoInterfaces(oClipboard, "com.sun.star.datatransfer.clipboard.XClipboard")
102        if (NOT bOK) then Out.Log("Returned object doesn't support XClipboard interface.")
103    end if
104    Test.MethodTested("getClipboard()", bOK)
105
106Exit Sub
107ErrHndl:
108    Test.Exception()
109    bOK = false
110    resume next
111End Sub
112</script:module>
113