1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: UndoGuard.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef CHART2_UNDOGUARD_HXX
31 #define CHART2_UNDOGUARD_HXX
33 #include <com/sun/star/frame/XModel.hpp>
34 #include <com/sun/star/chart2/XUndoManager.hpp>
35 #include "charttoolsdllapi.hxx"
37 // header for class OUString
38 #include <rtl/ustring.hxx>
42 /** Base Class for UndoGuard and UndoLiveUpdateGuard
47 explicit UndoGuard_Base( const rtl::OUString
& rUndoMessage
48 , const ::com::sun::star::uno::Reference
<
49 ::com::sun::star::chart2::XUndoManager
> & xUndoManager
50 , const ::com::sun::star::uno::Reference
<
51 ::com::sun::star::frame::XModel
> & xModel
);
52 virtual ~UndoGuard_Base();
54 OOO_DLLPUBLIC_CHARTTOOLS
void commitAction();
57 ::com::sun::star::uno::Reference
<
58 ::com::sun::star::frame::XModel
> m_xModel
;
59 ::com::sun::star::uno::Reference
<
60 ::com::sun::star::chart2::XUndoManager
> m_xUndoManager
;
62 rtl::OUString m_aUndoString
;
66 /** This guard calls preAction at the given Model in the CTOR and
67 cancelAction in the DTOR if no other method is called.
68 If commitAction is called the destructor does nothin anymore.
70 class OOO_DLLPUBLIC_CHARTTOOLS UndoGuard
: public UndoGuard_Base
73 explicit UndoGuard( const rtl::OUString
& rUndoMessage
74 , const ::com::sun::star::uno::Reference
<
75 ::com::sun::star::chart2::XUndoManager
> & xUndoManager
76 , const ::com::sun::star::uno::Reference
<
77 ::com::sun::star::frame::XModel
> & xModel
);
81 /** This guard calls preAction at the given Model in the CTOR and
82 cancelActionUndo in the DTOR if no other method is called.
83 If commitAction is called the destructor does nothin anymore.
85 class OOO_DLLPUBLIC_CHARTTOOLS UndoLiveUpdateGuard
: public UndoGuard_Base
88 explicit UndoLiveUpdateGuard( const rtl::OUString
& rUndoMessage
89 , const ::com::sun::star::uno::Reference
<
90 ::com::sun::star::chart2::XUndoManager
> & xUndoManager
91 , const ::com::sun::star::uno::Reference
<
92 ::com::sun::star::frame::XModel
> & xModel
);
93 virtual ~UndoLiveUpdateGuard();
96 /** Same as UndoLiveUpdateGuard but with additional storage of the chart's data.
97 Only use this if the data has internal data.
99 class OOO_DLLPUBLIC_CHARTTOOLS UndoLiveUpdateGuardWithData
:
100 public UndoGuard_Base
103 explicit UndoLiveUpdateGuardWithData( const rtl::OUString
& rUndoMessage
104 , const ::com::sun::star::uno::Reference
<
105 ::com::sun::star::chart2::XUndoManager
> & xUndoManager
106 , const ::com::sun::star::uno::Reference
<
107 ::com::sun::star::frame::XModel
> & xModel
);
108 virtual ~UndoLiveUpdateGuardWithData();
111 class OOO_DLLPUBLIC_CHARTTOOLS UndoGuardWithSelection
: public UndoGuard_Base
114 explicit UndoGuardWithSelection( const rtl::OUString
& rUndoMessage
115 , const ::com::sun::star::uno::Reference
<
116 ::com::sun::star::chart2::XUndoManager
> & xUndoManager
117 , const ::com::sun::star::uno::Reference
<
118 ::com::sun::star::frame::XModel
> & xModel
);
119 virtual ~UndoGuardWithSelection();
123 // CHART2_UNDOGUARD_HXX