1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
19 #ifndef INCLUDED_SFX2_APPUNO_HXX
20 #define INCLUDED_SFX2_APPUNO_HXX
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>
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/implbase3.hxx>
43 #include <cppuhelper/implbase4.hxx>
44 #include <cppuhelper/implbase5.hxx>
46 #include <tools/errcode.hxx>
47 #include <sfx2/sfxuno.hxx>
50 class SfxMacroLoader
: public ::cppu::WeakImplHelper5
<
51 css::frame::XDispatchProvider
,
52 css::frame::XNotifyingDispatch
,
53 css::frame::XSynchronousDispatch
,
54 css::lang::XServiceInfo
,
55 css::lang::XInitialization
>
57 ::com::sun::star::uno::WeakReference
< ::com::sun::star::frame::XFrame
> m_xFrame
;
59 SfxObjectShell
* GetObjectShell_Impl();
62 // XInterface, XTypeProvider, XServiceInfo
65 SfxMacroLoader( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& )
68 static ErrCode
loadMacro( const OUString
& aURL
, ::com::sun::star::uno::Any
& rRetval
, SfxObjectShell
* pDoc
=NULL
) throw( ::com::sun::star::uno::RuntimeException
);
70 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatch
> SAL_CALL
71 queryDispatch( const ::com::sun::star::util::URL
& aURL
, const OUString
& sTargetFrameName
,
72 FrameSearchFlags eSearchFlags
) throw( ::com::sun::star::uno::RuntimeException
) ;
73 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatch
> > SAL_CALL
74 queryDispatches( const ::com::sun::star::uno::Sequence
< ::com::sun::star::frame::DispatchDescriptor
>& seqDescriptor
)
75 throw( ::com::sun::star::uno::RuntimeException
) ;
76 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
);
77 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
);
78 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
);
79 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
);
80 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
);
81 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
);
84 class SfxAppDispatchProvider
: public ::cppu::WeakImplHelper3
< ::com::sun::star::frame::XAppDispatchProvider
,
85 ::com::sun::star::lang::XServiceInfo
,
86 ::com::sun::star::lang::XInitialization
>
88 ::com::sun::star::uno::WeakReference
< ::com::sun::star::frame::XFrame
> m_xFrame
;
90 SfxAppDispatchProvider( const com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& )
94 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatch
> SAL_CALL
95 queryDispatch( const ::com::sun::star::util::URL
& aURL
, const OUString
& sTargetFrameName
,
96 FrameSearchFlags eSearchFlags
) throw( ::com::sun::star::uno::RuntimeException
) ;
97 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatch
> > SAL_CALL
98 queryDispatches( const ::com::sun::star::uno::Sequence
< ::com::sun::star::frame::DispatchDescriptor
>& seqDescriptor
)
99 throw( ::com::sun::star::uno::RuntimeException
) ;
100 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
);
101 virtual ::com::sun::star::uno::Sequence
< sal_Int16
> SAL_CALL
getSupportedCommandGroups() throw (::com::sun::star::uno::RuntimeException
);
102 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::frame::DispatchInformation
> SAL_CALL
getConfigurableDispatchInformation( sal_Int16
) throw (::com::sun::star::uno::RuntimeException
);
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */