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 "ChartModelClone.hxx"
23 #include <rtl/ustring.hxx>
27 namespace com::sun::star::document
{ class XUndoManager
; }
28 namespace com::sun::star::frame
{ class XModel
; }
33 /** A guard which does nothing, unless you explicitly call commitAction. In particular, in its destructor, it
34 does neither auto-commit nor auto-rollback the model changes.
40 OUString i_undoMessage
,
41 const css::uno::Reference
< css::document::XUndoManager
> & i_undoManager
,
42 const ModelFacet i_facet
= E_MODEL
50 bool isActionPosted() const { return m_bActionPosted
; }
53 void discardSnapshot();
56 rtl::Reference
<::chart::ChartModel
> m_xChartModel
;
57 const css::uno::Reference
< css::document::XUndoManager
> m_xUndoManager
;
59 std::shared_ptr
< ChartModelClone
> m_pDocumentSnapshot
;
60 OUString m_aUndoString
;
64 /** A guard which, in its destructor, restores the model state it found in the constructor. If
65 <member>commitAction</member> is called inbetween, the restoration is not performed.
67 class UndoLiveUpdateGuard
: public UndoGuard
70 explicit UndoLiveUpdateGuard(
71 const OUString
& i_undoMessage
,
72 const css::uno::Reference
< css::document::XUndoManager
> & i_undoManager
74 ~UndoLiveUpdateGuard();
77 /** Same as UndoLiveUpdateGuard but with additional storage of the chart's data.
78 Only use this if the data has internal data.
80 class UndoLiveUpdateGuardWithData
:
84 explicit UndoLiveUpdateGuardWithData(
85 const OUString
& i_undoMessage
,
86 const css::uno::Reference
< css::document::XUndoManager
> & i_undoManager
88 ~UndoLiveUpdateGuardWithData();
91 class UndoGuardWithSelection
: public UndoGuard
94 explicit UndoGuardWithSelection(
95 const OUString
& i_undoMessage
,
96 const css::uno::Reference
< css::document::XUndoManager
> & i_undoManager
98 virtual ~UndoGuardWithSelection();
101 class HiddenUndoContext
104 explicit HiddenUndoContext(
105 const css::uno::Reference
< css::document::XUndoManager
> & i_undoManager
107 ~HiddenUndoContext();
110 css::uno::Reference
< css::document::XUndoManager
> m_xUndoManager
;
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */