build fix: no comphelper/profilezone.hxx in this branch
[LibreOffice.git] / include / framework / dispatchhelper.hxx
blob3cca78c6a90ae7828967062b137066d810b8b339
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_FRAMEWORK_INC_SERVICES_DISPATCHHELPER_HXX
21 #define INCLUDED_FRAMEWORK_INC_SERVICES_DISPATCHHELPER_HXX
23 #include <com/sun/star/uno/Any.hxx>
24 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
25 #include <com/sun/star/uno/XComponentContext.hpp>
26 #include <com/sun/star/frame/XDispatchHelper.hpp>
27 #include <com/sun/star/frame/XDispatchResultListener.hpp>
28 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
29 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <cppuhelper/implbase.hxx>
33 #include <osl/conditn.hxx>
34 #include <framework/fwedllapi.h>
36 namespace framework{
38 /**
39 @short implements an easy way for dispatches
40 @descr Dispatches are splitted into different parts:
41 - parsing of the URL
42 - searching for a dispatch object
43 - dispatching of the URL
44 All these steps are done inside one method call here.
46 class FWE_DLLPUBLIC DispatchHelper : public ::cppu::WeakImplHelper< css::lang::XServiceInfo,css::frame::XDispatchHelper,css::frame::XDispatchResultListener >
49 // member
51 private:
53 osl::Mutex m_mutex;
55 /** global uno service manager.
56 Can be used to create own needed services. */
57 css::uno::Reference< css::uno::XComponentContext > m_xContext;
59 /** used to wait for asynchronous listener callbacks. */
60 ::osl::Condition m_aBlock;
62 css::uno::Any m_aResult;
64 css::uno::Reference< css::uno::XInterface > m_xBroadcaster;
66 // interface
68 public:
70 // ctor/dtor
72 DispatchHelper( const css::uno::Reference< css::uno::XComponentContext >& xContext );
73 virtual ~DispatchHelper( ) override;
75 // XServiceInfo
76 virtual OUString SAL_CALL getImplementationName ( ) throw( css::uno::RuntimeException, std::exception ) override;
77 virtual sal_Bool SAL_CALL supportsService ( const OUString& sServiceName ) throw( css::uno::RuntimeException, std::exception ) override;
78 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames ( ) throw( css::uno::RuntimeException, std::exception ) override;
80 static css::uno::Sequence< OUString > SAL_CALL impl_getStaticSupportedServiceNames( );
81 static OUString SAL_CALL impl_getStaticImplementationName ( );
82 // Helper for initialization of service by using own reference!
83 void SAL_CALL impl_initService ( );
85 // Helper for registry
86 static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager ) throw( css::uno::Exception );
87 static css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager );
90 // XDispatchHelper
91 virtual css::uno::Any SAL_CALL executeDispatch(
92 const css::uno::Reference< css::frame::XDispatchProvider >& xDispatchProvider ,
93 const OUString& sURL ,
94 const OUString& sTargetFrameName ,
95 sal_Int32 nSearchFlags ,
96 const css::uno::Sequence< css::beans::PropertyValue >& lArguments )
97 throw(css::uno::RuntimeException, std::exception) override;
99 // not a public XDispatchHelper-method, need in sfx2/source/control/statcach.cxx for extensions
100 css::uno::Any SAL_CALL executeDispatch(
101 const css::uno::Reference< css::frame::XDispatch >& xDispatch ,
102 const css::util::URL& aURL ,
103 bool SyncronFlag ,
104 const css::uno::Sequence< css::beans::PropertyValue >& lArguments )
105 throw(css::uno::RuntimeException);
108 // XDispatchResultListener
109 virtual void SAL_CALL dispatchFinished(
110 const css::frame::DispatchResultEvent& aResult )
111 throw(css::uno::RuntimeException, std::exception) override;
113 // XEventListener
114 virtual void SAL_CALL disposing(
115 const css::lang::EventObject& aEvent )
116 throw(css::uno::RuntimeException, std::exception) override;
121 #endif
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */