1 #*************************************************************************
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 # Copyright 2000, 2010 Oracle and/or its affiliates.
7 # OpenOffice.org - a multi-platform office productivity suite
9 # This file is part of OpenOffice.org.
11 # OpenOffice.org is free software: you can redistribute it and/or modify
12 # it under the terms of the GNU Lesser General Public License version 3
13 # only, as published by the Free Software Foundation.
15 # OpenOffice.org is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU Lesser General Public License version 3 for more details
19 # (a copy is included in the LICENSE file that accompanied this code).
21 # You should have received a copy of the GNU Lesser General Public License
22 # version 3 along with OpenOffice.org. If not, see
23 # <http://www.openoffice.org/license.html>
24 # for a copy of the LGPLv3 License.
26 #***********************************************************************/
31 from com
.sun
.star
.awt
import Rectangle
32 from com
.sun
.star
.awt
.MessageBoxButtons
import BUTTONS_OK
33 from com
.sun
.star
.frame
import XDispatch
, XDispatchProvider
34 from com
.sun
.star
.lang
import XServiceInfo
36 class Provider(unohelper
.Base
, XServiceInfo
, XDispatchProvider
):
37 implementationName
= "com.sun.star.comp.test.deployment.passive_python"
39 serviceNames
= ("com.sun.star.test.deployment.passive_python",)
41 def __init__(self
, context
):
42 self
.context
= context
44 def getImplementationName(self
):
45 return self
.implementationName
47 def supportsService(self
, ServiceName
):
48 return ServiceName
in self
.serviceNames
50 def getSupportedServiceNames(self
):
51 return self
.serviceNames
53 def queryDispatch(self
, URL
, TargetFrame
, SearchFlags
):
54 return self
.context
.getValueByName( \
55 "/singletons/com.sun.star.test.deployment.passive_python_singleton")
57 def queryDispatches(self
, Requests
):
59 self
.queryDispatch(i
.FeatureURL
, i
.FrameName
, i
.SearchFlags
) \
62 class Dispatch(unohelper
.Base
, XServiceInfo
, XDispatch
):
63 implementationName
= \
64 "com.sun.star.comp.test.deployment.passive_python_singleton"
68 def __init__(self
, context
):
69 self
.context
= context
71 def getImplementationName(self
):
72 return self
.implementationName
74 def supportsService(self
, ServiceName
):
75 return ServiceName
in self
.serviceNames
77 def getSupportedServiceNames(self
):
78 return self
.serviceNames
80 def dispatch(self
, URL
, Arguments
):
81 smgr
= self
.context
.getServiceManager()
82 box
= smgr
.createInstanceWithContext( \
83 "com.sun.star.awt.Toolkit", self
.context
).createMessageBox( \
84 smgr
.createInstanceWithContext( \
85 "com.sun.star.frame.Desktop", self
.context
). \
86 getCurrentFrame().getComponentWindow(), \
87 Rectangle(), "infobox", BUTTONS_OK
, "passive", "python")
91 def addStatusListener(self
, Control
, URL
):
94 def removeStatusListener(self
, Control
, URL
):
97 g_ImplementationHelper
= unohelper
.ImplementationHelper()
98 g_ImplementationHelper
.addImplementation( \
99 Provider
, Provider
.implementationName
, Provider
.serviceNames
)
100 g_ImplementationHelper
.addImplementation( \
101 Dispatch
, Dispatch
.implementationName
, Dispatch
.serviceNames
)