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 .
20 #ifndef INCLUDED_FRAMEWORK_INC_RECORDING_DISPATCHRECORDER_HXX
21 #define INCLUDED_FRAMEWORK_INC_RECORDING_DISPATCHRECORDER_HXX
23 /** Attention: stl headers must(!) be included at first. Otherwise it can make trouble
24 with solaris headers ...
28 #include <macros/xinterface.hxx>
29 #include <macros/xtypeprovider.hxx>
30 #include <macros/xserviceinfo.hxx>
31 #include <macros/generic.hxx>
33 #include <rtl/ustring.hxx>
34 #include <rtl/ustrbuf.hxx>
35 #include <com/sun/star/lang/XTypeProvider.hpp>
36 #include <com/sun/star/frame/XDispatchRecorder.hpp>
37 #include <com/sun/star/frame/DispatchStatement.hpp>
38 #include <com/sun/star/container/XIndexReplace.hpp>
39 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
40 #include <com/sun/star/util/URL.hpp>
41 #include <com/sun/star/beans/PropertyValue.hpp>
42 #include <com/sun/star/uno/RuntimeException.hpp>
43 #include <com/sun/star/script/XTypeConverter.hpp>
44 #include <cppuhelper/implbase3.hxx>
48 typedef ::std::vector
< com::sun::star::frame::DispatchStatement
> DispatchStatementList
;
50 class DispatchRecorder
51 : public ::cppu::WeakImplHelper3
<
52 css::lang::XServiceInfo
53 , css::frame::XDispatchRecorder
54 , css::container::XIndexReplace
>
58 DispatchStatementList m_aStatements
;
59 sal_Int32 m_nRecordingID
;
60 css::uno::Reference
< css::script::XTypeConverter
> m_xConverter
;
64 DispatchRecorder( const css::uno::Reference
< css::uno::XComponentContext
>& xSMGR
);
65 virtual ~DispatchRecorder();
67 // XInterface, XTypeProvider, XServiceInfo
71 virtual void SAL_CALL
startRecording ( const css::uno::Reference
< css::frame::XFrame
>& xFrame
) throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
72 virtual void SAL_CALL
recordDispatch ( const css::util::URL
& aURL
, const css::uno::Sequence
< css::beans::PropertyValue
>& lArguments
) throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
73 virtual void SAL_CALL
recordDispatchAsComment( const css::util::URL
& aURL
, const css::uno::Sequence
< css::beans::PropertyValue
>& lArguments
) throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
74 virtual void SAL_CALL
endRecording () throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
75 virtual OUString SAL_CALL
getRecordedMacro () throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
77 virtual com::sun::star::uno::Type SAL_CALL
getElementType() throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
79 virtual sal_Bool SAL_CALL
hasElements() throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
81 virtual sal_Int32 SAL_CALL
getCount() throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
83 virtual com::sun::star::uno::Any SAL_CALL
getByIndex(sal_Int32
) throw (com::sun::star::uno::RuntimeException
, com::sun::star::lang::WrappedTargetException
, com::sun::star::lang::IndexOutOfBoundsException
, std::exception
) SAL_OVERRIDE
;
85 virtual void SAL_CALL
replaceByIndex(sal_Int32
, const com::sun::star::uno::Any
&) throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
89 void SAL_CALL
implts_recordMacro( const OUString
& aURL
,
90 const css::uno::Sequence
< css::beans::PropertyValue
>& lArguments
,
91 bool bAsComment
, OUStringBuffer
& );
92 void SAL_CALL
AppendToBuffer( css::uno::Any aValue
, OUStringBuffer
& aArgumentBuffer
);
94 }; // class DispatcRecorder
96 } // namespace framework
98 #endif // define __FRAMEWORK...
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */