Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef RPTUI_UNDO_HXX
20 : #define RPTUI_UNDO_HXX
21 :
22 : #include "UndoActions.hxx"
23 : #include <functional>
24 :
25 : namespace com { namespace sun { namespace star {
26 : namespace drawing {
27 : class XShape;
28 : }
29 : }}}
30 :
31 : namespace rptui
32 : {
33 : /** \class OSectionUndo
34 : * Undo class for section add and remove.
35 : */
36 : class OSectionUndo : public OCommentUndoAction
37 : {
38 : OSectionUndo(const OSectionUndo&);
39 : void operator =(const OSectionUndo&);
40 : protected:
41 : ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> >
42 : m_aControls;
43 : ::std::vector< ::std::pair< OUString ,::com::sun::star::uno::Any> >
44 : m_aValues;
45 : Action m_eAction;
46 : sal_uInt16 m_nSlot;
47 : bool m_bInserted;
48 :
49 : virtual void implReInsert( ) = 0;
50 : virtual void implReRemove( ) = 0;
51 :
52 : void collectControls(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection);
53 : public:
54 : TYPEINFO_OVERRIDE();
55 : OSectionUndo( OReportModel& rMod
56 : ,sal_uInt16 _nSlot
57 : ,Action _eAction
58 : ,sal_uInt16 nCommentID);
59 : virtual ~OSectionUndo();
60 :
61 : virtual void Undo() SAL_OVERRIDE;
62 : virtual void Redo() SAL_OVERRIDE;
63 : };
64 :
65 : /** Undo action for the group header, footer, page header, footer
66 : */
67 : class OReportSectionUndo : public OSectionUndo
68 : {
69 : OReportHelper m_aReportHelper;
70 : ::std::mem_fun_t< ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >
71 : ,OReportHelper> m_pMemberFunction;
72 :
73 : void implReInsert( ) SAL_OVERRIDE;
74 : void implReRemove( ) SAL_OVERRIDE;
75 : OReportSectionUndo(const OReportSectionUndo&);
76 : void operator =(const OReportSectionUndo&);
77 : public:
78 : TYPEINFO_OVERRIDE();
79 : //OReportSectionUndo( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection
80 : OReportSectionUndo( OReportModel& rMod
81 : ,sal_uInt16 _nSlot
82 : ,::std::mem_fun_t< ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >
83 : ,OReportHelper> _pMemberFunction
84 : ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition >& _xReport
85 : ,Action _eAction
86 : ,sal_uInt16 nCommentID);
87 : virtual ~OReportSectionUndo();
88 : };
89 :
90 : /** Undo action for the group header, footer
91 : */
92 0 : class OGroupSectionUndo : public OSectionUndo
93 : {
94 : OGroupHelper m_aGroupHelper;
95 : ::std::mem_fun_t< ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >
96 : ,OGroupHelper> m_pMemberFunction;
97 :
98 : mutable OUString m_sName;
99 :
100 : void implReInsert( ) SAL_OVERRIDE;
101 : void implReRemove( ) SAL_OVERRIDE;
102 : OGroupSectionUndo(const OGroupSectionUndo&);
103 : void operator =(const OGroupSectionUndo&);
104 : public:
105 : TYPEINFO_OVERRIDE();
106 : //OGroupSectionUndo( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection
107 : OGroupSectionUndo( OReportModel& rMod
108 : ,sal_uInt16 _nSlot
109 : ,::std::mem_fun_t< ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >
110 : ,OGroupHelper> _pMemberFunction
111 : ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup >& _xGroup
112 : ,Action _eAction
113 : ,sal_uInt16 nCommentID);
114 :
115 : virtual OUString GetComment() const SAL_OVERRIDE;
116 : };
117 :
118 : /** /class OGroupUndo
119 : * \brief Undo action for removing a group object.
120 : */
121 0 : class OGroupUndo : public OCommentUndoAction
122 : {
123 : ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup> m_xGroup; ///<! the group for the undo redo action
124 : ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition > m_xReportDefinition; ///<! the parent report definition
125 : Action m_eAction; ///<! the current action
126 : sal_Int32 m_nLastPosition; ///<! the last position of the group
127 :
128 : void implReInsert( );
129 : void implReRemove( );
130 : public:
131 : TYPEINFO_OVERRIDE();
132 : OGroupUndo(OReportModel& rMod
133 : ,sal_uInt16 nCommentID
134 : ,Action _eAction
135 : ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup>& _xGroup
136 : ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition >& _xReportDefinition);
137 : virtual void Undo() SAL_OVERRIDE;
138 : virtual void Redo() SAL_OVERRIDE;
139 : };
140 : }
141 : #endif // RPTUI_UNDO_HXX
142 :
143 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|