| 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 |
#pragma once |
| 20 |
|
| 21 |
#include <sal/config.h> |
| 22 |
|
| 23 |
#include <CommandDispatch.hxx> |
| 24 |
#include <rtl/ref.hxx> |
| 25 |
|
| 26 |
namespace com::sun::star::document { class XUndoManager; } |
| 27 |
|
| 28 |
namespace chart |
| 29 |
{ |
| 30 |
class ChartModel; |
| 31 |
|
| 32 |
/** This is a CommandDispatch implementation for Undo and Redo. |
| 33 |
*/ |
| 34 |
class UndoCommandDispatch : public CommandDispatch |
| 35 |
{ |
| 36 |
public: |
| 37 |
explicit UndoCommandDispatch( |
| 38 |
const css::uno::Reference< css::uno::XComponentContext > & xContext, |
| 39 |
rtl::Reference<::chart::ChartModel> xModel ); |
| 40 |
virtual ~UndoCommandDispatch() override; |
| 41 |
|
| 42 |
// late initialisation, especially for adding as listener |
| 43 |
virtual void initialize() override; |
| 44 |
|
| 45 |
protected: |
| 46 |
// ____ XDispatch ____ |
| 47 |
virtual void SAL_CALL dispatch( |
| 48 |
const css::util::URL& URL, |
| 49 |
const css::uno::Sequence< css::beans::PropertyValue >& Arguments ) override; |
| 50 |
|
| 51 |
// ____ WeakComponentImplHelperBase ____ |
| 52 |
/// is called when this is disposed |
| 53 |
virtual void disposing(std::unique_lock<std::mutex>& rGuard) override; |
| 54 |
|
| 55 |
// ____ XEventListener (base of XModifyListener) ____ |
| 56 |
virtual void SAL_CALL disposing( |
| 57 |
const css::lang::EventObject& Source ) override; |
| 58 |
|
| 59 |
virtual void fireStatusEvent( |
| 60 |
const OUString & rURL, |
| 61 |
const css::uno::Reference< css::frame::XStatusListener > & xSingleListener ) override; |
| 62 |
|
| 63 |
private: |
| 64 |
rtl::Reference<::chart::ChartModel> m_xModel; |
| 65 |
css::uno::Reference< css::document::XUndoManager > m_xUndoManager; |
| 66 |
}; |
| 67 |
|
| 68 |
} // namespace chart |
| 69 |
|
| 70 |
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |