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