1 
2 #ifndef __FRAMEWORK_RECORDING_DISPATCHRECORDER_HXX_
3 #define __FRAMEWORK_RECORDING_DISPATCHRECORDER_HXX_
4 
5 /** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble
6                with solaris headers ...
7 */
8 #include <vector>
9 
10 // own includes
11 #include <threadhelp/threadhelpbase.hxx>
12 #include <macros/xinterface.hxx>
13 #include <macros/xtypeprovider.hxx>
14 #include <macros/xserviceinfo.hxx>
15 #include <macros/debug.hxx>
16 #include <macros/generic.hxx>
17 #include <general.h>
18 #include <rtl/ustring.hxx>
19 #include <rtl/ustrbuf.hxx>
20 #include <com/sun/star/lang/XTypeProvider.hpp>
21 #include <com/sun/star/frame/XDispatchRecorder.hpp>
22 #include <com/sun/star/frame/DispatchStatement.hpp>
23 #include <com/sun/star/container/XIndexReplace.hpp>
24 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
25 #include <com/sun/star/util/URL.hpp>
26 #include <com/sun/star/beans/PropertyValue.hpp>
27 #include <com/sun/star/uno/RuntimeException.hdl>
28 #include <com/sun/star/script/XTypeConverter.hpp>
29 #include <cppuhelper/weak.hxx>
30 
31 namespace framework{
32 
33 typedef ::std::vector < com::sun::star::frame::DispatchStatement > DispatchStatementList;
34 
35 class DispatchRecorder
36     : private ThreadHelpBase
37     , public  css::lang::XTypeProvider
38     , public  css::lang::XServiceInfo
39     , public  css::frame::XDispatchRecorder
40     , public  css::container::XIndexReplace
41     , public  ::cppu::OWeakObject
42 {
43     // private member
44     private:
45         css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR        ;
46 		DispatchStatementList 			   					   m_aStatements;
47         sal_Int32                                              m_nRecordingID ;
48         css::uno::Reference< css::script::XTypeConverter >     m_xConverter;
49 
50     // public interface
51     public:
52         DispatchRecorder( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR );
53         ~DispatchRecorder();
54 
55         // XInterface, XTypeProvider, XServiceInfo
56         FWK_DECLARE_XINTERFACE
57         FWK_DECLARE_XTYPEPROVIDER
58         DECLARE_XSERVICEINFO
59 
60         // XDispatchRecorder
61         virtual void SAL_CALL            startRecording         ( const css::uno::Reference< css::frame::XFrame >& xFrame ) throw( css::uno::RuntimeException );
62         virtual void SAL_CALL            recordDispatch         ( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException );
63         virtual void SAL_CALL            recordDispatchAsComment( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException );
64         virtual void SAL_CALL            endRecording           () throw( css::uno::RuntimeException );
65         virtual ::rtl::OUString SAL_CALL getRecordedMacro       () throw( css::uno::RuntimeException );
66 
67 	virtual com::sun::star::uno::Type SAL_CALL getElementType() throw (::com::sun::star::uno::RuntimeException);
68 
69 	virtual sal_Bool SAL_CALL hasElements()  throw (::com::sun::star::uno::RuntimeException);
70 
71 	virtual sal_Int32 SAL_CALL getCount() throw (::com::sun::star::uno::RuntimeException);
72 
73 	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);
74 
75 	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);
76 
77     // private functions
78     private:
79         void SAL_CALL implts_recordMacro( const ::rtl::OUString& aURL,
80                                           const css::uno::Sequence< css::beans::PropertyValue >& lArguments,
81                                                 sal_Bool bAsComment, ::rtl::OUStringBuffer& );
82         void SAL_CALL AppendToBuffer( css::uno::Any aValue, ::rtl::OUStringBuffer& aArgumentBuffer );
83 
84 }; // class DispatcRecorder
85 
86 } // namespace framework
87 
88 #endif // define __FRAMEWORK...
89