Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / chart2 / source / controller / main / UndoActions.hxx
blobf1ecf3ee131a8a442dba523c9fabb8b45dfeef74
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 .
19 #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_UNDOACTIONS_HXX
20 #define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_UNDOACTIONS_HXX
22 #include <com/sun/star/frame/XModel.hpp>
23 #include <com/sun/star/document/XUndoAction.hpp>
25 #include <rtl/ustring.hxx>
26 #include <unotools/configitem.hxx>
27 #include <cppuhelper/compbase.hxx>
28 #include <cppuhelper/basemutex.hxx>
30 #include <memory>
31 #include <deque>
32 #include <utility>
34 class SdrUndoAction;
36 namespace chart
38 class ChartModelClone;
40 namespace impl
43 typedef ::cppu::BaseMutex UndoElement_MBase;
44 typedef ::cppu::WeakComponentImplHelper< css::document::XUndoAction > UndoElement_TBase;
46 class UndoElement :public UndoElement_MBase
47 ,public UndoElement_TBase
49 public:
50 /** creates a new undo action
52 @param i_actionString
53 is the title of the Undo action
54 @param i_documentModel
55 is the actual document model which the undo actions operates on
56 @param i_modelClone
57 is the cloned model from before the changes, which the Undo action represents, have been applied.
58 Upon <member>invoking</member>, the clone model is applied to the document model.
60 UndoElement( const OUString & i_actionString,
61 const css::uno::Reference< css::frame::XModel >& i_documentModel,
62 const std::shared_ptr< ChartModelClone >& i_modelClone
65 UndoElement(const UndoElement&) = delete;
66 const UndoElement& operator=(const UndoElement&) = delete;
68 // XUndoAction
69 virtual OUString SAL_CALL getTitle() override;
70 virtual void SAL_CALL undo( ) override;
71 virtual void SAL_CALL redo( ) override;
73 // OComponentHelper
74 virtual void SAL_CALL disposing() override;
76 protected:
77 virtual ~UndoElement() override;
79 private:
80 void impl_toggleModelState();
82 private:
83 OUString m_sActionString;
84 css::uno::Reference< css::frame::XModel > m_xDocumentModel;
85 std::shared_ptr< ChartModelClone > m_pModelClone;
88 typedef ::cppu::BaseMutex ShapeUndoElement_MBase;
89 typedef ::cppu::WeakComponentImplHelper< css::document::XUndoAction > ShapeUndoElement_TBase;
90 class ShapeUndoElement :public ShapeUndoElement_MBase
91 ,public ShapeUndoElement_TBase
93 public:
94 explicit ShapeUndoElement( SdrUndoAction& i_sdrUndoAction );
96 // XUndoAction
97 virtual OUString SAL_CALL getTitle() override;
98 virtual void SAL_CALL undo( ) override;
99 virtual void SAL_CALL redo( ) override;
101 // OComponentHelper
102 virtual void SAL_CALL disposing() override;
104 protected:
105 virtual ~ShapeUndoElement() override;
107 private:
108 SdrUndoAction* m_pAction;
111 } // namespace impl
112 } // namespace chart
114 // INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_UNDOACTIONS_HXX
115 #endif
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */