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 CHART2_UNDOCOMMANDDISPATCH_HXX 24 #define CHART2_UNDOCOMMANDDISPATCH_HXX 25 26 #include "CommandDispatch.hxx" 27 28 #include <com/sun/star/frame/XModel.hpp> 29 #include <com/sun/star/document/XUndoManager.hpp> 30 31 namespace chart 32 { 33 34 /** This is a CommandDispatch implementation for Undo and Redo. 35 */ 36 class UndoCommandDispatch : public CommandDispatch 37 { 38 public: 39 explicit UndoCommandDispatch( 40 const ::com::sun::star::uno::Reference< 41 ::com::sun::star::uno::XComponentContext > & xContext, 42 const ::com::sun::star::uno::Reference< 43 ::com::sun::star::frame::XModel > & xModel ); 44 virtual ~UndoCommandDispatch(); 45 46 // late initialisation, especially for adding as listener 47 virtual void initialize(); 48 49 protected: 50 // ____ XDispatch ____ 51 virtual void SAL_CALL dispatch( 52 const ::com::sun::star::util::URL& URL, 53 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments ) 54 throw (::com::sun::star::uno::RuntimeException); 55 56 // ____ WeakComponentImplHelperBase ____ 57 /// is called when this is disposed 58 virtual void SAL_CALL disposing(); 59 60 // ____ XEventListener (base of XModifyListener) ____ 61 virtual void SAL_CALL disposing( 62 const ::com::sun::star::lang::EventObject& Source ) 63 throw (::com::sun::star::uno::RuntimeException); 64 65 virtual void fireStatusEvent( 66 const ::rtl::OUString & rURL, 67 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xSingleListener ); 68 69 private: 70 ::com::sun::star::uno::Reference< 71 ::com::sun::star::frame::XModel > m_xModel; 72 ::com::sun::star::uno::Reference< 73 ::com::sun::star::document::XUndoManager > m_xUndoManager; 74 }; 75 76 } // namespace chart 77 78 // CHART2_UNDOCOMMANDDISPATCH_HXX 79 #endif 80