tdf#154285 Check upper bound of arguments in SbRtl_Minute function
[LibreOffice.git] / chart2 / source / controller / main / UndoActions.hxx
blob10fc0aeb5817cc32eb2dc9d0c4c32fcda543d697
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 #pragma once
21 #include <com/sun/star/document/XUndoAction.hpp>
23 #include <rtl/ref.hxx>
24 #include <rtl/ustring.hxx>
25 #include <comphelper/compbase.hxx>
27 #include <memory>
29 class SdrUndoAction;
31 namespace chart
33 class ChartModel;
34 class ChartModelClone;
36 namespace impl
39 typedef comphelper::WeakComponentImplHelper< css::document::XUndoAction > UndoElement_TBase;
41 class UndoElement final : public UndoElement_TBase
43 public:
44 /** creates a new undo action
46 @param i_actionString
47 is the title of the Undo action
48 @param i_documentModel
49 is the actual document model which the undo actions operates on
50 @param i_modelClone
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;
63 // XUndoAction
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;
71 private:
72 void impl_toggleModelState();
74 private:
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
83 public:
84 explicit ShapeUndoElement( std::unique_ptr<SdrUndoAction> xSdrUndoAction );
85 virtual ~ShapeUndoElement() override;
87 // XUndoAction
88 virtual OUString SAL_CALL getTitle() override;
89 virtual void SAL_CALL undo( ) override;
90 virtual void SAL_CALL redo( ) override;
92 private:
93 std::unique_ptr<SdrUndoAction> m_xAction;
96 } // namespace impl
97 } // namespace chart
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */