1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir #ifndef RPTUI_UNDO_HXX 28*cdf0e10cSrcweir #define RPTUI_UNDO_HXX 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir #include "UndoActions.hxx" 31*cdf0e10cSrcweir #include <functional> 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir FORWARD_DECLARE_INTERFACE(awt,XControl) 34*cdf0e10cSrcweir FORWARD_DECLARE_INTERFACE(awt,XControlContainer) 35*cdf0e10cSrcweir FORWARD_DECLARE_INTERFACE(drawing,XShape) 36*cdf0e10cSrcweir namespace dbaui 37*cdf0e10cSrcweir { 38*cdf0e10cSrcweir class IController; 39*cdf0e10cSrcweir } 40*cdf0e10cSrcweir namespace rptui 41*cdf0e10cSrcweir { 42*cdf0e10cSrcweir class OObjectBase; 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir /** \class OSectionUndo 46*cdf0e10cSrcweir * Undo class for section add and remove. 47*cdf0e10cSrcweir */ 48*cdf0e10cSrcweir class OSectionUndo : public OCommentUndoAction 49*cdf0e10cSrcweir { 50*cdf0e10cSrcweir OSectionUndo(const OSectionUndo&); 51*cdf0e10cSrcweir void operator =(const OSectionUndo&); 52*cdf0e10cSrcweir protected: 53*cdf0e10cSrcweir ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> > 54*cdf0e10cSrcweir m_aControls; 55*cdf0e10cSrcweir ::std::vector< ::std::pair< ::rtl::OUString ,::com::sun::star::uno::Any> > 56*cdf0e10cSrcweir m_aValues; 57*cdf0e10cSrcweir Action m_eAction; 58*cdf0e10cSrcweir sal_uInt16 m_nSlot; 59*cdf0e10cSrcweir bool m_bInserted; 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir virtual void implReInsert( ) = 0; 62*cdf0e10cSrcweir virtual void implReRemove( ) = 0; 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir void collectControls(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection); 65*cdf0e10cSrcweir public: 66*cdf0e10cSrcweir TYPEINFO(); 67*cdf0e10cSrcweir OSectionUndo( OReportModel& rMod 68*cdf0e10cSrcweir ,sal_uInt16 _nSlot 69*cdf0e10cSrcweir ,Action _eAction 70*cdf0e10cSrcweir ,sal_uInt16 nCommentID); 71*cdf0e10cSrcweir virtual ~OSectionUndo(); 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir virtual void Undo(); 74*cdf0e10cSrcweir virtual void Redo(); 75*cdf0e10cSrcweir }; 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir /** Undo action for the group header, footer, page header, footer 78*cdf0e10cSrcweir */ 79*cdf0e10cSrcweir class OReportSectionUndo : public OSectionUndo 80*cdf0e10cSrcweir { 81*cdf0e10cSrcweir OReportHelper m_aReportHelper; 82*cdf0e10cSrcweir ::std::mem_fun_t< ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > 83*cdf0e10cSrcweir ,OReportHelper> m_pMemberFunction; 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir void implReInsert( ); 86*cdf0e10cSrcweir void implReRemove( ); 87*cdf0e10cSrcweir OReportSectionUndo(const OReportSectionUndo&); 88*cdf0e10cSrcweir void operator =(const OReportSectionUndo&); 89*cdf0e10cSrcweir public: 90*cdf0e10cSrcweir TYPEINFO(); 91*cdf0e10cSrcweir //OReportSectionUndo( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection 92*cdf0e10cSrcweir OReportSectionUndo( OReportModel& rMod 93*cdf0e10cSrcweir ,sal_uInt16 _nSlot 94*cdf0e10cSrcweir ,::std::mem_fun_t< ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > 95*cdf0e10cSrcweir ,OReportHelper> _pMemberFunction 96*cdf0e10cSrcweir ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition >& _xReport 97*cdf0e10cSrcweir ,Action _eAction 98*cdf0e10cSrcweir ,sal_uInt16 nCommentID); 99*cdf0e10cSrcweir virtual ~OReportSectionUndo(); 100*cdf0e10cSrcweir }; 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir /** Undo action for the group header, footer 103*cdf0e10cSrcweir */ 104*cdf0e10cSrcweir class OGroupSectionUndo : public OSectionUndo 105*cdf0e10cSrcweir { 106*cdf0e10cSrcweir OGroupHelper m_aGroupHelper; 107*cdf0e10cSrcweir ::std::mem_fun_t< ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > 108*cdf0e10cSrcweir ,OGroupHelper> m_pMemberFunction; 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir mutable ::rtl::OUString m_sName; 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir void implReInsert( ); 113*cdf0e10cSrcweir void implReRemove( ); 114*cdf0e10cSrcweir OGroupSectionUndo(const OGroupSectionUndo&); 115*cdf0e10cSrcweir void operator =(const OGroupSectionUndo&); 116*cdf0e10cSrcweir public: 117*cdf0e10cSrcweir TYPEINFO(); 118*cdf0e10cSrcweir //OGroupSectionUndo( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection 119*cdf0e10cSrcweir OGroupSectionUndo( OReportModel& rMod 120*cdf0e10cSrcweir ,sal_uInt16 _nSlot 121*cdf0e10cSrcweir ,::std::mem_fun_t< ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > 122*cdf0e10cSrcweir ,OGroupHelper> _pMemberFunction 123*cdf0e10cSrcweir ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup >& _xGroup 124*cdf0e10cSrcweir ,Action _eAction 125*cdf0e10cSrcweir ,sal_uInt16 nCommentID); 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir virtual String GetComment() const; 128*cdf0e10cSrcweir }; 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir /** /class OGroupUndo 131*cdf0e10cSrcweir * \brief Undo action for removing a group object. 132*cdf0e10cSrcweir */ 133*cdf0e10cSrcweir class OGroupUndo : public OCommentUndoAction 134*cdf0e10cSrcweir { 135*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup> m_xGroup; ///<! the group for the undo redo action 136*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition > m_xReportDefinition; ///<! the parent report definition 137*cdf0e10cSrcweir Action m_eAction; ///<! the current action 138*cdf0e10cSrcweir sal_Int32 m_nLastPosition; ///<! the last position of the group 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir void implReInsert( ); 141*cdf0e10cSrcweir void implReRemove( ); 142*cdf0e10cSrcweir public: 143*cdf0e10cSrcweir TYPEINFO(); 144*cdf0e10cSrcweir OGroupUndo(OReportModel& rMod 145*cdf0e10cSrcweir ,sal_uInt16 nCommentID 146*cdf0e10cSrcweir ,Action _eAction 147*cdf0e10cSrcweir ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup>& _xGroup 148*cdf0e10cSrcweir ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition >& _xReportDefinition); 149*cdf0e10cSrcweir virtual void Undo(); 150*cdf0e10cSrcweir virtual void Redo(); 151*cdf0e10cSrcweir }; 152*cdf0e10cSrcweir } 153*cdf0e10cSrcweir #endif // RPTUI_UNDO_HXX 154