Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef _SFX_APPUNO_HXX
20 : #define _SFX_APPUNO_HXX
21 :
22 : #include <com/sun/star/frame/XFrame.hpp>
23 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
24 : #include <com/sun/star/lang/XServiceInfo.hpp>
25 : #include <com/sun/star/lang/XInitialization.hpp>
26 : #include <com/sun/star/lang/XTypeProvider.hpp>
27 : #include <com/sun/star/registry/XSimpleRegistry.hpp>
28 : #include <com/sun/star/beans/PropertyValue.hpp>
29 : #include <com/sun/star/util/URL.hpp>
30 : #include <com/sun/star/uno/Exception.hpp>
31 : #include <com/sun/star/frame/XAppDispatchProvider.hpp>
32 : #include <com/sun/star/frame/XDispatch.hpp>
33 : #include <com/sun/star/frame/XSynchronousDispatch.hpp>
34 : #include <com/sun/star/frame/XNotifyingDispatch.hpp>
35 : #include <com/sun/star/frame/XDispatchResultListener.hpp>
36 : #include <com/sun/star/frame/DispatchDescriptor.hpp>
37 : #include <com/sun/star/frame/XDispatchInformationProvider.hpp>
38 :
39 : #include <com/sun/star/uno/Any.h>
40 : #include <com/sun/star/uno/Reference.h>
41 : #include <com/sun/star/uno/Sequence.hxx>
42 : #include <cppuhelper/weak.hxx>
43 : #include <cppuhelper/implbase3.hxx>
44 : #include <cppuhelper/implbase4.hxx>
45 :
46 : #include <tools/errcode.hxx>
47 : #include <sfx2/sfxuno.hxx>
48 :
49 : class SfxObjectShell;
50 4 : class SfxMacroLoader : public ::com::sun::star::frame::XDispatchProvider,
51 : public ::com::sun::star::frame::XNotifyingDispatch,
52 : public ::com::sun::star::frame::XSynchronousDispatch,
53 : public ::com::sun::star::lang::XTypeProvider,
54 : public ::com::sun::star::lang::XServiceInfo,
55 : public ::com::sun::star::lang::XInitialization,
56 : public ::cppu::OWeakObject
57 : {
58 : ::com::sun::star::uno::WeakReference < ::com::sun::star::frame::XFrame > m_xFrame;
59 :
60 : SfxObjectShell* GetObjectShell_Impl();
61 :
62 : public:
63 : // XInterface, XTypeProvider, XServiceInfo
64 : SFX_DECL_XINTERFACE_XTYPEPROVIDER_XSERVICEINFO
65 :
66 2 : SfxMacroLoader( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& )
67 2 : {}
68 :
69 : static ErrCode loadMacro( const OUString& aURL, ::com::sun::star::uno::Any& rRetval, SfxObjectShell* pDoc=NULL ) throw( ::com::sun::star::uno::RuntimeException );
70 :
71 : virtual ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > SAL_CALL
72 : queryDispatch( const ::com::sun::star::util::URL& aURL, const OUString& sTargetFrameName,
73 : FrameSearchFlags eSearchFlags ) throw( ::com::sun::star::uno::RuntimeException ) ;
74 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > > SAL_CALL
75 : queryDispatches( const ::com::sun::star::uno::Sequence < ::com::sun::star::frame::DispatchDescriptor >& seqDescriptor )
76 : throw( ::com::sun::star::uno::RuntimeException ) ;
77 : virtual void SAL_CALL dispatchWithNotification( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArgs, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
78 : virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArgs ) throw (::com::sun::star::uno::RuntimeException);
79 : virtual ::com::sun::star::uno::Any SAL_CALL dispatchWithReturnValue( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArgs ) throw (::com::sun::star::uno::RuntimeException);
80 : virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw (::com::sun::star::uno::RuntimeException);
81 : virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw (::com::sun::star::uno::RuntimeException);
82 : virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
83 : };
84 :
85 4350 : class SfxAppDispatchProvider : public ::cppu::WeakImplHelper3< ::com::sun::star::frame::XAppDispatchProvider,
86 : ::com::sun::star::lang::XServiceInfo,
87 : ::com::sun::star::lang::XInitialization >
88 : {
89 : ::com::sun::star::uno::WeakReference < ::com::sun::star::frame::XFrame > m_xFrame;
90 : public:
91 2175 : SfxAppDispatchProvider( const com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& )
92 2175 : {}
93 :
94 : SFX_DECL_XSERVICEINFO
95 : virtual ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > SAL_CALL
96 : queryDispatch( const ::com::sun::star::util::URL& aURL, const OUString& sTargetFrameName,
97 : FrameSearchFlags eSearchFlags ) throw( ::com::sun::star::uno::RuntimeException ) ;
98 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > > SAL_CALL
99 : queryDispatches( const ::com::sun::star::uno::Sequence < ::com::sun::star::frame::DispatchDescriptor >& seqDescriptor )
100 : throw( ::com::sun::star::uno::RuntimeException ) ;
101 : virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
102 : virtual ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getSupportedCommandGroups() throw (::com::sun::star::uno::RuntimeException);
103 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchInformation > SAL_CALL getConfigurableDispatchInformation( sal_Int16 ) throw (::com::sun::star::uno::RuntimeException);
104 : };
105 :
106 : #endif
107 :
108 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|