Branch libreoffice-5-0-4
[LibreOffice.git] / scripting / source / protocolhandler / scripthandler.hxx
blob309a8a66b0c5bd3edb70d3a18e51f12352ab2050
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SCRIPTING_SOURCE_PROTOCOLHANDLER_SCRIPTHANDLER_HXX
21 #define INCLUDED_SCRIPTING_SOURCE_PROTOCOLHANDLER_SCRIPTHANDLER_HXX
23 #include <com/sun/star/uno/RuntimeException.hpp>
24 #include <com/sun/star/frame/XDispatchProvider.hpp>
25 #include <com/sun/star/frame/XNotifyingDispatch.hpp>
26 #include <com/sun/star/lang/XServiceInfo.hpp>
27 #include <com/sun/star/lang/XInitialization.hpp>
28 #include <cppuhelper/implbase4.hxx>
29 #include <com/sun/star/script/provider/XScriptProvider.hpp>
32 namespace com { namespace sun { namespace star {
34 namespace document {
35 class XScriptInvocationContext;
37 namespace uno {
38 class Any;
39 class XComponentContext;
41 namespace lang {
42 class XMultiServiceFactory;
43 class XSingleServiceFactory;
45 namespace frame {
46 class XFrame;
47 class XDispatch;
48 class XNotifyingDispatch;
49 class XDispatchResultListener;
50 struct DispatchDescriptor;
52 namespace beans {
53 struct PropertyValue;
55 namespace util {
56 struct URL;
58 } } }
60 namespace scripting_protocolhandler
63 class ScriptProtocolHandler :
64 public ::cppu::WeakImplHelper4< css::frame::XDispatchProvider,
65 css::frame::XNotifyingDispatch, css::lang::XServiceInfo, css::lang::XInitialization >
67 private:
68 bool m_bInitialised;
69 css::uno::Reference < css::uno::XComponentContext > m_xContext;
70 css::uno::Reference < css::frame::XFrame > m_xFrame;
71 css::uno::Reference < css::script::provider::XScriptProvider > m_xScriptProvider;
72 css::uno::Reference< css::document::XScriptInvocationContext > m_xScriptInvocation;
74 void createScriptProvider();
75 bool getScriptInvocation();
77 public:
78 ScriptProtocolHandler( const css::uno::Reference < css::uno::XComponentContext >& xContext );
79 virtual ~ScriptProtocolHandler();
81 /* XServiceInfo */
82 virtual OUString SAL_CALL getImplementationName()
83 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
84 virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName )
85 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
86 virtual css::uno::Sequence < OUString > SAL_CALL getSupportedServiceNames()
87 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
89 /* Helper for XServiceInfo */
90 static css::uno::Sequence < OUString > impl_getStaticSupportedServiceNames();
91 static OUString impl_getStaticImplementationName();
93 /* Helper for registry */
94 static css::uno::Reference < css::uno::XInterface > SAL_CALL
95 impl_createInstance(
96 const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager )
97 throw( css::uno::RuntimeException );
98 static css::uno::Reference < css::lang::XSingleServiceFactory > impl_createFactory(
99 const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager );
101 /* Implementation for XDispatchProvider */
102 virtual css::uno::Reference < css::frame::XDispatch > SAL_CALL
103 queryDispatch( const css::util::URL& aURL, const OUString& sTargetFrameName,
104 sal_Int32 eSearchFlags ) throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE ;
105 virtual css::uno::Sequence< css::uno::Reference < css::frame::XDispatch > > SAL_CALL
106 queryDispatches(
107 const css::uno::Sequence < css::frame::DispatchDescriptor >& seqDescriptor )
108 throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
110 /* Implementation for X(Notifying)Dispatch */
111 virtual void SAL_CALL dispatchWithNotification(
112 const css::util::URL& aURL,
113 const css::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArgs,
114 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& Listener )
115 throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
116 virtual void SAL_CALL dispatch(
117 const css::util::URL& aURL,
118 const css::uno::Sequence< css::beans::PropertyValue >& lArgs )
119 throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
120 virtual void SAL_CALL addStatusListener(
121 const css::uno::Reference< css::frame::XStatusListener >& xControl,
122 const css::util::URL& aURL )
123 throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
124 virtual void SAL_CALL removeStatusListener(
125 const css::uno::Reference< css::frame::XStatusListener >& xControl,
126 const css::util::URL& aURL )
127 throw ( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
129 /* Implementation for XInitialization */
130 virtual void SAL_CALL initialize(
131 const css::uno::Sequence < css::uno::Any >& aArguments )
132 throw ( css::uno::Exception, std::exception ) SAL_OVERRIDE;
136 #endif
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */