LibreOffice Module framework (master) 1
dispatchrecorder.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include <sal/config.h>
23
24#include <vector>
25
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>
37
38namespace framework{
39
41 : public ::cppu::WeakImplHelper<
42 css::lang::XServiceInfo
43 , css::frame::XDispatchRecorder
44 , css::container::XIndexReplace >
45{
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;
51
52 // public interface
53 public:
54 DispatchRecorder( const css::uno::Reference< css::uno::XComponentContext >& xSMGR );
55 virtual ~DispatchRecorder() override;
56
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;
61
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;
68
69 virtual css::uno::Type SAL_CALL getElementType() override;
70
71 virtual sal_Bool SAL_CALL hasElements() override;
72
73 virtual sal_Int32 SAL_CALL getCount() override;
74
75 virtual css::uno::Any SAL_CALL getByIndex(sal_Int32) override;
76
77 virtual void SAL_CALL replaceByIndex(sal_Int32, const css::uno::Any&) override;
78
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 );
85
86}; // class DispatcRecorder
87
88} // namespace framework
89
90/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL replaceByIndex(sal_Int32, const css::uno::Any &) override
virtual OUString SAL_CALL getRecordedMacro() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Type SAL_CALL getElementType() override
virtual OUString SAL_CALL getImplementationName() override
virtual void SAL_CALL startRecording(const css::uno::Reference< css::frame::XFrame > &xFrame) override
virtual void SAL_CALL recordDispatch(const css::util::URL &aURL, const css::uno::Sequence< css::beans::PropertyValue > &lArguments) override
virtual sal_Bool SAL_CALL supportsService(const OUString &sServiceName) override
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32) override
DispatchRecorder(const css::uno::Reference< css::uno::XComponentContext > &xSMGR)
virtual sal_Int32 SAL_CALL getCount() override
::std::vector< css::frame::DispatchStatement > m_aStatements
css::uno::Reference< css::script::XTypeConverter > m_xConverter
virtual sal_Bool SAL_CALL hasElements() override
void implts_recordMacro(std::u16string_view aURL, const css::uno::Sequence< css::beans::PropertyValue > &lArguments, bool bAsComment, OUStringBuffer &)
virtual ~DispatchRecorder() override
virtual void SAL_CALL recordDispatchAsComment(const css::util::URL &aURL, const css::uno::Sequence< css::beans::PropertyValue > &lArguments) override
virtual void SAL_CALL endRecording() override
void AppendToBuffer(const css::uno::Any &aValue, OUStringBuffer &aArgumentBuffer)
unsigned char sal_Bool