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 .
19 #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_UNDOACTIONS_HXX
20 #define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_UNDOACTIONS_HXX
22 #include "ConfigItemListener.hxx"
24 #include <com/sun/star/frame/XModel.hpp>
25 #include <com/sun/star/document/XUndoAction.hpp>
26 #include <com/sun/star/uno/Sequence.hxx>
28 #include <rtl/ustring.hxx>
29 #include <unotools/configitem.hxx>
30 #include <cppuhelper/compbase1.hxx>
31 #include <cppuhelper/basemutex.hxx>
36 #include <boost/noncopyable.hpp>
37 #include <boost/shared_ptr.hpp>
43 class ChartModelClone
;
48 typedef ::cppu::BaseMutex UndoElement_MBase
;
49 typedef ::cppu::WeakComponentImplHelper1
< ::com::sun::star::document::XUndoAction
> UndoElement_TBase
;
51 class UndoElement
:public UndoElement_MBase
52 ,public UndoElement_TBase
53 ,public ::boost::noncopyable
56 /** creates a new undo action
59 is the title of the Undo action
60 @param i_documentModel
61 is the actual document model which the undo actions operates on
63 is the cloned model from before the changes, which the Undo action represents, have been applied.
64 Upon <member>invoking</member>, the clone model is applied to the document model.
66 UndoElement( const OUString
& i_actionString
,
67 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XModel
>& i_documentModel
,
68 const ::boost::shared_ptr
< ChartModelClone
>& i_modelClone
72 virtual OUString SAL_CALL
getTitle() throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
73 virtual void SAL_CALL
undo( ) throw (::com::sun::star::document::UndoFailedException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
74 virtual void SAL_CALL
redo( ) throw (::com::sun::star::document::UndoFailedException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
77 virtual void SAL_CALL
disposing() SAL_OVERRIDE
;
80 virtual ~UndoElement();
83 void impl_toggleModelState();
86 OUString m_sActionString
;
87 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XModel
> m_xDocumentModel
;
88 ::boost::shared_ptr
< ChartModelClone
> m_pModelClone
;
91 typedef ::cppu::BaseMutex ShapeUndoElement_MBase
;
92 typedef ::cppu::WeakComponentImplHelper1
< ::com::sun::star::document::XUndoAction
> ShapeUndoElement_TBase
;
93 class ShapeUndoElement
:public ShapeUndoElement_MBase
94 ,public ShapeUndoElement_TBase
97 ShapeUndoElement( SdrUndoAction
& i_sdrUndoAction
);
100 virtual OUString SAL_CALL
getTitle() throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
101 virtual void SAL_CALL
undo( ) throw (::com::sun::star::document::UndoFailedException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
102 virtual void SAL_CALL
redo( ) throw (::com::sun::star::document::UndoFailedException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
105 virtual void SAL_CALL
disposing() SAL_OVERRIDE
;
108 virtual ~ShapeUndoElement();
111 SdrUndoAction
* m_pAction
;
117 // INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_UNDOACTIONS_HXX
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */