xref: /trunk/main/reportdesign/source/ui/inc/RptUndo.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
1*9ee13d13SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*9ee13d13SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*9ee13d13SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*9ee13d13SAndrew Rist  * distributed with this work for additional information
6*9ee13d13SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*9ee13d13SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*9ee13d13SAndrew Rist  * "License"); you may not use this file except in compliance
9*9ee13d13SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*9ee13d13SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*9ee13d13SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*9ee13d13SAndrew Rist  * software distributed under the License is distributed on an
15*9ee13d13SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9ee13d13SAndrew Rist  * KIND, either express or implied.  See the License for the
17*9ee13d13SAndrew Rist  * specific language governing permissions and limitations
18*9ee13d13SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*9ee13d13SAndrew Rist  *************************************************************/
21*9ee13d13SAndrew Rist 
22*9ee13d13SAndrew Rist 
23cdf0e10cSrcweir #ifndef RPTUI_UNDO_HXX
24cdf0e10cSrcweir #define RPTUI_UNDO_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include "UndoActions.hxx"
27cdf0e10cSrcweir #include <functional>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir FORWARD_DECLARE_INTERFACE(awt,XControl)
30cdf0e10cSrcweir FORWARD_DECLARE_INTERFACE(awt,XControlContainer)
31cdf0e10cSrcweir FORWARD_DECLARE_INTERFACE(drawing,XShape)
32cdf0e10cSrcweir namespace dbaui
33cdf0e10cSrcweir {
34cdf0e10cSrcweir     class IController;
35cdf0e10cSrcweir }
36cdf0e10cSrcweir namespace rptui
37cdf0e10cSrcweir {
38cdf0e10cSrcweir     class OObjectBase;
39cdf0e10cSrcweir 
40cdf0e10cSrcweir 
41cdf0e10cSrcweir     /** \class OSectionUndo
42cdf0e10cSrcweir      * Undo class for section add and remove.
43cdf0e10cSrcweir      */
44cdf0e10cSrcweir     class OSectionUndo : public OCommentUndoAction
45cdf0e10cSrcweir     {
46cdf0e10cSrcweir         OSectionUndo(const OSectionUndo&);
47cdf0e10cSrcweir         void operator =(const OSectionUndo&);
48cdf0e10cSrcweir     protected:
49cdf0e10cSrcweir         ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> >
50cdf0e10cSrcweir                                                     m_aControls;
51cdf0e10cSrcweir         ::std::vector< ::std::pair< ::rtl::OUString ,::com::sun::star::uno::Any> >
52cdf0e10cSrcweir                                                     m_aValues;
53cdf0e10cSrcweir         Action                                      m_eAction;
54cdf0e10cSrcweir         sal_uInt16                                  m_nSlot;
55cdf0e10cSrcweir         bool                                        m_bInserted;
56cdf0e10cSrcweir 
57cdf0e10cSrcweir         virtual void    implReInsert( ) = 0;
58cdf0e10cSrcweir         virtual void    implReRemove( ) = 0;
59cdf0e10cSrcweir 
60cdf0e10cSrcweir         void collectControls(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection);
61cdf0e10cSrcweir     public:
62cdf0e10cSrcweir         TYPEINFO();
63cdf0e10cSrcweir         OSectionUndo(   OReportModel& rMod
64cdf0e10cSrcweir                         ,sal_uInt16 _nSlot
65cdf0e10cSrcweir                         ,Action _eAction
66cdf0e10cSrcweir                         ,sal_uInt16 nCommentID);
67cdf0e10cSrcweir         virtual ~OSectionUndo();
68cdf0e10cSrcweir 
69cdf0e10cSrcweir         virtual void        Undo();
70cdf0e10cSrcweir         virtual void        Redo();
71cdf0e10cSrcweir     };
72cdf0e10cSrcweir 
73cdf0e10cSrcweir     /** Undo action for the group header, footer, page header, footer
74cdf0e10cSrcweir     */
75cdf0e10cSrcweir     class OReportSectionUndo : public OSectionUndo
76cdf0e10cSrcweir     {
77cdf0e10cSrcweir         OReportHelper                               m_aReportHelper;
78cdf0e10cSrcweir         ::std::mem_fun_t< ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >
79cdf0e10cSrcweir                                     ,OReportHelper> m_pMemberFunction;
80cdf0e10cSrcweir 
81cdf0e10cSrcweir         void    implReInsert( );
82cdf0e10cSrcweir         void    implReRemove( );
83cdf0e10cSrcweir         OReportSectionUndo(const OReportSectionUndo&);
84cdf0e10cSrcweir         void operator =(const OReportSectionUndo&);
85cdf0e10cSrcweir     public:
86cdf0e10cSrcweir         TYPEINFO();
87cdf0e10cSrcweir         //OReportSectionUndo(    const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection
88cdf0e10cSrcweir         OReportSectionUndo( OReportModel& rMod
89cdf0e10cSrcweir                             ,sal_uInt16 _nSlot
90cdf0e10cSrcweir                             ,::std::mem_fun_t< ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >
91cdf0e10cSrcweir                                 ,OReportHelper> _pMemberFunction
92cdf0e10cSrcweir                             ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition >& _xReport
93cdf0e10cSrcweir                             ,Action _eAction
94cdf0e10cSrcweir                             ,sal_uInt16 nCommentID);
95cdf0e10cSrcweir         virtual ~OReportSectionUndo();
96cdf0e10cSrcweir     };
97cdf0e10cSrcweir 
98cdf0e10cSrcweir     /** Undo action for the group header, footer
99cdf0e10cSrcweir     */
100cdf0e10cSrcweir     class OGroupSectionUndo : public OSectionUndo
101cdf0e10cSrcweir     {
102cdf0e10cSrcweir         OGroupHelper                                m_aGroupHelper;
103cdf0e10cSrcweir         ::std::mem_fun_t< ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >
104cdf0e10cSrcweir                                     ,OGroupHelper> m_pMemberFunction;
105cdf0e10cSrcweir 
106cdf0e10cSrcweir         mutable ::rtl::OUString                     m_sName;
107cdf0e10cSrcweir 
108cdf0e10cSrcweir         void    implReInsert( );
109cdf0e10cSrcweir         void    implReRemove( );
110cdf0e10cSrcweir         OGroupSectionUndo(const OGroupSectionUndo&);
111cdf0e10cSrcweir         void operator =(const OGroupSectionUndo&);
112cdf0e10cSrcweir     public:
113cdf0e10cSrcweir         TYPEINFO();
114cdf0e10cSrcweir         //OGroupSectionUndo(     const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection
115cdf0e10cSrcweir         OGroupSectionUndo(  OReportModel& rMod
116cdf0e10cSrcweir                             ,sal_uInt16 _nSlot
117cdf0e10cSrcweir                             ,::std::mem_fun_t< ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >
118cdf0e10cSrcweir                                             ,OGroupHelper> _pMemberFunction
119cdf0e10cSrcweir                             ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup >& _xGroup
120cdf0e10cSrcweir                             ,Action _eAction
121cdf0e10cSrcweir                             ,sal_uInt16 nCommentID);
122cdf0e10cSrcweir 
123cdf0e10cSrcweir         virtual String      GetComment() const;
124cdf0e10cSrcweir     };
125cdf0e10cSrcweir 
126cdf0e10cSrcweir     /** /class OGroupUndo
127cdf0e10cSrcweir      * \brief Undo action for removing a group object.
128cdf0e10cSrcweir     */
129cdf0e10cSrcweir     class OGroupUndo : public OCommentUndoAction
130cdf0e10cSrcweir     {
131cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup>             m_xGroup; ///<! the group for the undo redo action
132cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition > m_xReportDefinition; ///<! the parent report definition
133cdf0e10cSrcweir         Action                                                                          m_eAction; ///<! the current action
134cdf0e10cSrcweir         sal_Int32                                                                       m_nLastPosition; ///<! the last position of the group
135cdf0e10cSrcweir 
136cdf0e10cSrcweir         void    implReInsert( );
137cdf0e10cSrcweir         void    implReRemove( );
138cdf0e10cSrcweir     public:
139cdf0e10cSrcweir         TYPEINFO();
140cdf0e10cSrcweir         OGroupUndo(OReportModel& rMod
141cdf0e10cSrcweir                     ,sal_uInt16 nCommentID
142cdf0e10cSrcweir                     ,Action _eAction
143cdf0e10cSrcweir                     ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup>& _xGroup
144cdf0e10cSrcweir                     ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition >& _xReportDefinition);
145cdf0e10cSrcweir         virtual void        Undo();
146cdf0e10cSrcweir         virtual void        Redo();
147cdf0e10cSrcweir     };
148cdf0e10cSrcweir }
149cdf0e10cSrcweir #endif // RPTUI_UNDO_HXX
150