xref: /aoo41x/main/svx/inc/svx/sdrundomanager.hxx (revision 31b2f7b2)
169ffbee1SArmin Le Grand /**************************************************************
269ffbee1SArmin Le Grand  *
369ffbee1SArmin Le Grand  * Licensed to the Apache Software Foundation (ASF) under one
469ffbee1SArmin Le Grand  * or more contributor license agreements.  See the NOTICE file
569ffbee1SArmin Le Grand  * distributed with this work for additional information
669ffbee1SArmin Le Grand  * regarding copyright ownership.  The ASF licenses this file
769ffbee1SArmin Le Grand  * to you under the Apache License, Version 2.0 (the
869ffbee1SArmin Le Grand  * "License"); you may not use this file except in compliance
969ffbee1SArmin Le Grand  * with the License.  You may obtain a copy of the License at
1069ffbee1SArmin Le Grand  *
1169ffbee1SArmin Le Grand  *   http://www.apache.org/licenses/LICENSE-2.0
1269ffbee1SArmin Le Grand  *
1369ffbee1SArmin Le Grand  * Unless required by applicable law or agreed to in writing,
1469ffbee1SArmin Le Grand  * software distributed under the License is distributed on an
1569ffbee1SArmin Le Grand  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1669ffbee1SArmin Le Grand  * KIND, either express or implied.  See the License for the
1769ffbee1SArmin Le Grand  * specific language governing permissions and limitations
1869ffbee1SArmin Le Grand  * under the License.
1969ffbee1SArmin Le Grand  *
2069ffbee1SArmin Le Grand  *************************************************************/
2169ffbee1SArmin Le Grand 
2269ffbee1SArmin Le Grand #ifndef _SDR_UNDOMANAGER_HXX
2369ffbee1SArmin Le Grand #define _SDR_UNDOMANAGER_HXX
2469ffbee1SArmin Le Grand 
2569ffbee1SArmin Le Grand #include "svx/svxdllapi.h"
2669ffbee1SArmin Le Grand #include <sal/types.h>
2769ffbee1SArmin Le Grand #include <editeng/editund2.hxx>
2869ffbee1SArmin Le Grand #include <tools/link.hxx>
2969ffbee1SArmin Le Grand 
3069ffbee1SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
3169ffbee1SArmin Le Grand 
3269ffbee1SArmin Le Grand class SVX_DLLPUBLIC SdrUndoManager : public EditUndoManager
3369ffbee1SArmin Le Grand {
3469ffbee1SArmin Le Grand private:
3569ffbee1SArmin Le Grand 	using EditUndoManager::Undo;
3669ffbee1SArmin Le Grand 	using EditUndoManager::Redo;
3769ffbee1SArmin Le Grand 
3869ffbee1SArmin Le Grand     Link            maEndTextEditHdl;
3969ffbee1SArmin Le Grand     SfxUndoAction*  mpLastUndoActionBeforeTextEdit;
403d9b0034SArmin Le Grand     bool            mbEndTextEditTriggeredFromUndo;
413d9b0034SArmin Le Grand 
423d9b0034SArmin Le Grand protected:
433d9b0034SArmin Le Grand     // call to check for TextEdit active
443d9b0034SArmin Le Grand     bool isTextEditActive() const;
4569ffbee1SArmin Le Grand 
4669ffbee1SArmin Le Grand public:
4769ffbee1SArmin Le Grand 	SdrUndoManager(sal_uInt16 nMaxUndoActionCount = 20);
4869ffbee1SArmin Le Grand     virtual ~SdrUndoManager();
4969ffbee1SArmin Le Grand 
5069ffbee1SArmin Le Grand     /// react depending on edit mode and if no more undo is possible
5169ffbee1SArmin Le Grand     virtual sal_Bool Undo();
5269ffbee1SArmin Le Grand     virtual sal_Bool Redo();
5369ffbee1SArmin Le Grand 
54*31b2f7b2SArmin Le Grand     // ##
55*31b2f7b2SArmin Le Grand     virtual void Clear();
56*31b2f7b2SArmin Le Grand 
5769ffbee1SArmin Le Grand     // Call for the view which starts the interactive text edit. Use link to
5869ffbee1SArmin Le Grand     // activate (start text edit) and empty link to reset (end text edit). On
5969ffbee1SArmin Le Grand     // reset all text edit actions will be removed from this undo manager to
6069ffbee1SArmin Le Grand     // restore the state before activation
6169ffbee1SArmin Le Grand     void SetEndTextEditHdl(const Link& rLink);
623d9b0034SArmin Le Grand 
633d9b0034SArmin Le Grand     // check from outside if we are inside a callback for ending text edit. This
643d9b0034SArmin Le Grand     // is needed to detect inside end text edit if it is a regular one or triggered
653d9b0034SArmin Le Grand     // by a last undo during text edit
isEndTextEditTriggeredFromUndo()663d9b0034SArmin Le Grand     bool isEndTextEditTriggeredFromUndo() { return mbEndTextEditTriggeredFromUndo; }
6769ffbee1SArmin Le Grand };
6869ffbee1SArmin Le Grand 
6969ffbee1SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
7069ffbee1SArmin Le Grand 
7169ffbee1SArmin Le Grand #endif //_SDR_UNDOMANAGER_HXX
7269ffbee1SArmin Le Grand // eof
73