Update git submodules
[LibreOffice.git] / framework / inc / recording / dispatchrecorder.hxx
blobec03189d3cb4fdec4ac2de08e7d67bd246ea8d93
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
22 #include <sal/config.h>
24 #include <vector>
26 #include <rtl/ustring.hxx>
27 #include <rtl/ustrbuf.hxx>
28 #include <com/sun/star/frame/XDispatchRecorder.hpp>
29 #include <com/sun/star/frame/DispatchStatement.hpp>
30 #include <com/sun/star/container/XIndexReplace.hpp>
31 #include <com/sun/star/util/URL.hpp>
32 #include <com/sun/star/beans/PropertyValue.hpp>
33 #include <com/sun/star/script/XTypeConverter.hpp>
34 #include <com/sun/star/lang/XServiceInfo.hpp>
35 #include <com/sun/star/uno/XComponentContext.hpp>
36 #include <cppuhelper/implbase.hxx>
38 namespace framework{
40 class DispatchRecorder final
41 : public ::cppu::WeakImplHelper<
42 css::lang::XServiceInfo
43 , css::frame::XDispatchRecorder
44 , css::container::XIndexReplace >
46 // private member
47 private:
48 ::std::vector < css::frame::DispatchStatement > m_aStatements;
49 sal_Int32 m_nRecordingID;
50 css::uno::Reference< css::script::XTypeConverter > m_xConverter;
52 // public interface
53 public:
54 DispatchRecorder( const css::uno::Reference< css::uno::XComponentContext >& xSMGR );
55 virtual ~DispatchRecorder() override;
57 /* interface XServiceInfo */
58 virtual OUString SAL_CALL getImplementationName() override;
59 virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) override;
60 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
62 // XDispatchRecorder
63 virtual void SAL_CALL startRecording ( const css::uno::Reference< css::frame::XFrame >& xFrame ) override;
64 virtual void SAL_CALL recordDispatch ( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) override;
65 virtual void SAL_CALL recordDispatchAsComment( const css::util::URL& aURL, const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) override;
66 virtual void SAL_CALL endRecording () override;
67 virtual OUString SAL_CALL getRecordedMacro () override;
69 virtual css::uno::Type SAL_CALL getElementType() override;
71 virtual sal_Bool SAL_CALL hasElements() override;
73 virtual sal_Int32 SAL_CALL getCount() override;
75 virtual css::uno::Any SAL_CALL getByIndex(sal_Int32) override;
77 virtual void SAL_CALL replaceByIndex(sal_Int32, const css::uno::Any&) override;
79 // private functions
80 private:
81 void implts_recordMacro( std::u16string_view aURL,
82 const css::uno::Sequence< css::beans::PropertyValue >& lArguments,
83 bool bAsComment, OUStringBuffer& );
84 void AppendToBuffer( const css::uno::Any& aValue, OUStringBuffer& aArgumentBuffer );
86 }; // class DispatcRecorder
88 } // namespace framework
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */