1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
21 #include <com/sun/star/document/XUndoAction.hpp>
23 #include <rtl/ref.hxx>
24 #include <rtl/ustring.hxx>
25 #include <comphelper/compbase.hxx>
34 class ChartModelClone
;
39 typedef comphelper::WeakComponentImplHelper
< css::document::XUndoAction
> UndoElement_TBase
;
41 class UndoElement final
: public UndoElement_TBase
44 /** creates a new undo action
47 is the title of the Undo action
48 @param i_documentModel
49 is the actual document model which the undo actions operates on
51 is the cloned model from before the changes, which the Undo action represents, have been applied.
52 Upon <member>invoking</member>, the clone model is applied to the document model.
54 UndoElement( OUString i_actionString
,
55 rtl::Reference
<::chart::ChartModel
> i_documentModel
,
56 std::shared_ptr
< ChartModelClone
> i_modelClone
58 virtual ~UndoElement() override
;
60 UndoElement(const UndoElement
&) = delete;
61 const UndoElement
& operator=(const UndoElement
&) = delete;
64 virtual OUString SAL_CALL
getTitle() override
;
65 virtual void SAL_CALL
undo( ) override
;
66 virtual void SAL_CALL
redo( ) override
;
68 // WeakComponentImplHelper
69 virtual void disposing(std::unique_lock
<std::mutex
>&) override
;
72 void impl_toggleModelState();
75 OUString m_sActionString
;
76 rtl::Reference
<::chart::ChartModel
> m_xDocumentModel
;
77 std::shared_ptr
< ChartModelClone
> m_pModelClone
;
80 typedef comphelper::WeakComponentImplHelper
< css::document::XUndoAction
> ShapeUndoElement_TBase
;
81 class ShapeUndoElement final
: public ShapeUndoElement_TBase
84 explicit ShapeUndoElement( std::unique_ptr
<SdrUndoAction
> xSdrUndoAction
);
85 virtual ~ShapeUndoElement() override
;
88 virtual OUString SAL_CALL
getTitle() override
;
89 virtual void SAL_CALL
undo( ) override
;
90 virtual void SAL_CALL
redo( ) override
;
93 std::unique_ptr
<SdrUndoAction
> m_xAction
;
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */