1*f8e07b45SAndrew Rist /************************************************************** 2*f8e07b45SAndrew Rist * 3*f8e07b45SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*f8e07b45SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*f8e07b45SAndrew Rist * distributed with this work for additional information 6*f8e07b45SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*f8e07b45SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*f8e07b45SAndrew Rist * "License"); you may not use this file except in compliance 9*f8e07b45SAndrew Rist * with the License. You may obtain a copy of the License at 10*f8e07b45SAndrew Rist * 11*f8e07b45SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*f8e07b45SAndrew Rist * 13*f8e07b45SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*f8e07b45SAndrew Rist * software distributed under the License is distributed on an 15*f8e07b45SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*f8e07b45SAndrew Rist * KIND, either express or implied. See the License for the 17*f8e07b45SAndrew Rist * specific language governing permissions and limitations 18*f8e07b45SAndrew Rist * under the License. 19*f8e07b45SAndrew Rist * 20*f8e07b45SAndrew Rist *************************************************************/ 21*f8e07b45SAndrew Rist 22cdf0e10cSrcweir 23cdf0e10cSrcweir #ifndef __FRAMEWORK_RECORDING_DISPATCHRECORDER_HXX_ 24cdf0e10cSrcweir #define __FRAMEWORK_RECORDING_DISPATCHRECORDER_HXX_ 25cdf0e10cSrcweir 26cdf0e10cSrcweir /** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble 27cdf0e10cSrcweir with solaris headers ... 28cdf0e10cSrcweir */ 29cdf0e10cSrcweir #include <vector> 30cdf0e10cSrcweir 31cdf0e10cSrcweir // own includes 32cdf0e10cSrcweir #include <threadhelp/threadhelpbase.hxx> 33cdf0e10cSrcweir #include <macros/xinterface.hxx> 34cdf0e10cSrcweir #include <macros/xtypeprovider.hxx> 35cdf0e10cSrcweir #include <macros/xserviceinfo.hxx> 36cdf0e10cSrcweir #include <macros/debug.hxx> 37cdf0e10cSrcweir #include <macros/generic.hxx> 38cdf0e10cSrcweir #include <general.h> 39cdf0e10cSrcweir #include <rtl/ustring.hxx> 40cdf0e10cSrcweir #include <rtl/ustrbuf.hxx> 41cdf0e10cSrcweir #include <com/sun/star/lang/XTypeProvider.hpp> 42cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchRecorder.hpp> 43cdf0e10cSrcweir #include <com/sun/star/frame/DispatchStatement.hpp> 44cdf0e10cSrcweir #include <com/sun/star/container/XIndexReplace.hpp> 45cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 46cdf0e10cSrcweir #include <com/sun/star/util/URL.hpp> 47cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp> 48cdf0e10cSrcweir #include <com/sun/star/uno/RuntimeException.hdl> 49cdf0e10cSrcweir #include <com/sun/star/script/XTypeConverter.hpp> 50cdf0e10cSrcweir #include <cppuhelper/weak.hxx> 51cdf0e10cSrcweir 52cdf0e10cSrcweir namespace framework{ 53cdf0e10cSrcweir 54cdf0e10cSrcweir typedef ::std::vector < com::sun::star::frame::DispatchStatement > DispatchStatementList; 55cdf0e10cSrcweir 56cdf0e10cSrcweir class DispatchRecorder 57cdf0e10cSrcweir : private ThreadHelpBase 58cdf0e10cSrcweir , public css::lang::XTypeProvider 59cdf0e10cSrcweir , public css::lang::XServiceInfo 60cdf0e10cSrcweir , public css::frame::XDispatchRecorder 61cdf0e10cSrcweir , public css::container::XIndexReplace 62cdf0e10cSrcweir , public ::cppu::OWeakObject 63cdf0e10cSrcweir { 64cdf0e10cSrcweir // private member 65cdf0e10cSrcweir private: 66cdf0e10cSrcweir css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR ; 67cdf0e10cSrcweir DispatchStatementList m_aStatements; 68cdf0e10cSrcweir sal_Int32 m_nRecordingID ; 69cdf0e10cSrcweir css::uno::Reference< css::script::XTypeConverter > m_xConverter; 70cdf0e10cSrcweir 71cdf0e10cSrcweir // public interface 72cdf0e10cSrcweir public: 73cdf0e10cSrcweir DispatchRecorder( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ); 74cdf0e10cSrcweir ~DispatchRecorder(); 75cdf0e10cSrcweir 76cdf0e10cSrcweir // XInterface, XTypeProvider, XServiceInfo 77cdf0e10cSrcweir FWK_DECLARE_XINTERFACE 78cdf0e10cSrcweir FWK_DECLARE_XTYPEPROVIDER 79cdf0e10cSrcweir DECLARE_XSERVICEINFO 80cdf0e10cSrcweir 81cdf0e10cSrcweir // XDispatchRecorder 82cdf0e10cSrcweir virtual void SAL_CALL startRecording ( const css::uno::Reference< css::frame::XFrame >& xFrame ) throw( css::uno::RuntimeException ); 83cdf0e10cSrcweir virtual void SAL_CALL recordDispatch ( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException ); 84cdf0e10cSrcweir virtual void SAL_CALL recordDispatchAsComment( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::uno::RuntimeException ); 85cdf0e10cSrcweir virtual void SAL_CALL endRecording () throw( css::uno::RuntimeException ); 86cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getRecordedMacro () throw( css::uno::RuntimeException ); 87cdf0e10cSrcweir 88cdf0e10cSrcweir virtual com::sun::star::uno::Type SAL_CALL getElementType() throw (::com::sun::star::uno::RuntimeException); 89cdf0e10cSrcweir 90cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasElements() throw (::com::sun::star::uno::RuntimeException); 91cdf0e10cSrcweir 92cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getCount() throw (::com::sun::star::uno::RuntimeException); 93cdf0e10cSrcweir 94cdf0e10cSrcweir 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); 95cdf0e10cSrcweir 96cdf0e10cSrcweir 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); 97cdf0e10cSrcweir 98cdf0e10cSrcweir // private functions 99cdf0e10cSrcweir private: 100cdf0e10cSrcweir void SAL_CALL implts_recordMacro( const ::rtl::OUString& aURL, 101cdf0e10cSrcweir const css::uno::Sequence< css::beans::PropertyValue >& lArguments, 102cdf0e10cSrcweir sal_Bool bAsComment, ::rtl::OUStringBuffer& ); 103cdf0e10cSrcweir void SAL_CALL AppendToBuffer( css::uno::Any aValue, ::rtl::OUStringBuffer& aArgumentBuffer ); 104cdf0e10cSrcweir 105cdf0e10cSrcweir }; // class DispatcRecorder 106cdf0e10cSrcweir 107cdf0e10cSrcweir } // namespace framework 108cdf0e10cSrcweir 109cdf0e10cSrcweir #endif // define __FRAMEWORK... 110