svdedxv.cxx (69ffbee1) | svdedxv.cxx (3d9b0034) |
---|---|
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 --- 536 unchanged lines hidden (view full) --- 545} 546 547IMPL_LINK(SdrObjEditView, EndTextEditHdl, SdrUndoManager*, /*pUndoManager*/) 548{ 549 SdrEndTextEdit(); 550 return 0; 551} 552 | 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 --- 536 unchanged lines hidden (view full) --- 545} 546 547IMPL_LINK(SdrObjEditView, EndTextEditHdl, SdrUndoManager*, /*pUndoManager*/) 548{ 549 SdrEndTextEdit(); 550 return 0; 551} 552 |
553SdrUndoManager* SdrObjEditView::getSdrUndoManagerForEnhancedTextEdit() const 554{ 555 // default returns registered UndoManager 556 return GetModel() ? dynamic_cast< SdrUndoManager* >(GetModel()->GetSdrUndoManager()) : 0; 557} 558 |
|
553sal_Bool SdrObjEditView::SdrBeginTextEdit( 554 SdrObject* pObj, SdrPageView* pPV, Window* pWin, 555 sal_Bool bIsNewObj, SdrOutliner* pGivenOutliner, 556 OutlinerView* pGivenOutlinerView, 557 sal_Bool bDontDeleteOutliner, sal_Bool bOnlyOneView, 558 sal_Bool bGrabFocus) 559{ 560 SdrEndTextEdit(); --- 214 unchanged lines hidden (view full) --- 775 776 pTextEditOutliner->setVisualizedPage(0); 777 778 if( mxSelectionController.is() ) 779 mxSelectionController->onSelectionHasChanged(); 780 781 if(IsUndoEnabled()) 782 { | 559sal_Bool SdrObjEditView::SdrBeginTextEdit( 560 SdrObject* pObj, SdrPageView* pPV, Window* pWin, 561 sal_Bool bIsNewObj, SdrOutliner* pGivenOutliner, 562 OutlinerView* pGivenOutlinerView, 563 sal_Bool bDontDeleteOutliner, sal_Bool bOnlyOneView, 564 sal_Bool bGrabFocus) 565{ 566 SdrEndTextEdit(); --- 214 unchanged lines hidden (view full) --- 781 782 pTextEditOutliner->setVisualizedPage(0); 783 784 if( mxSelectionController.is() ) 785 mxSelectionController->onSelectionHasChanged(); 786 787 if(IsUndoEnabled()) 788 { |
783 SdrUndoManager* pSdrUndoManager = dynamic_cast< SdrUndoManager* >(GetModel()->GetSdrUndoManager()); | 789 SdrUndoManager* pSdrUndoManager = getSdrUndoManagerForEnhancedTextEdit(); |
784 785 if(pSdrUndoManager) 786 { 787 // we have an outliner, undo manager and it's an EditUndoManager, exchange 788 // the document undo manager and the default one from the outliner and tell 789 // it that text edit starts by setting a callback if it needs to end text edit mode. 790 if(mpOldTextEditUndoManager) 791 { | 790 791 if(pSdrUndoManager) 792 { 793 // we have an outliner, undo manager and it's an EditUndoManager, exchange 794 // the document undo manager and the default one from the outliner and tell 795 // it that text edit starts by setting a callback if it needs to end text edit mode. 796 if(mpOldTextEditUndoManager) 797 { |
792 // should not happen, delete it | 798 // should not happen, delete it since it was probably forgotten somewhere 799 OSL_ENSURE(false, "Deleting forgotten old TextEditUndoManager, should be checked (!)"); |
793 delete mpOldTextEditUndoManager; 794 mpOldTextEditUndoManager = 0; 795 } 796 797 mpOldTextEditUndoManager = pTextEditOutliner->SetUndoManager(pSdrUndoManager); 798 pSdrUndoManager->SetEndTextEditHdl(LINK(this, SdrObjEditView, EndTextEditHdl)); 799 } 800 else --- 54 unchanged lines hidden (view full) --- 855SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(sal_Bool bDontDeleteReally) 856{ 857 SdrEndTextEditKind eRet=SDRENDTEXTEDIT_UNCHANGED; 858 SdrTextObj* pTEObj = dynamic_cast< SdrTextObj* >( mxTextEditObj.get() ); 859 Window* pTEWin =pTextEditWin; 860 SdrOutliner* pTEOutliner =pTextEditOutliner; 861 OutlinerView* pTEOutlinerView=pTextEditOutlinerView; 862 Cursor* pTECursorMerker=pTextEditCursorMerker; | 800 delete mpOldTextEditUndoManager; 801 mpOldTextEditUndoManager = 0; 802 } 803 804 mpOldTextEditUndoManager = pTextEditOutliner->SetUndoManager(pSdrUndoManager); 805 pSdrUndoManager->SetEndTextEditHdl(LINK(this, SdrObjEditView, EndTextEditHdl)); 806 } 807 else --- 54 unchanged lines hidden (view full) --- 862SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(sal_Bool bDontDeleteReally) 863{ 864 SdrEndTextEditKind eRet=SDRENDTEXTEDIT_UNCHANGED; 865 SdrTextObj* pTEObj = dynamic_cast< SdrTextObj* >( mxTextEditObj.get() ); 866 Window* pTEWin =pTextEditWin; 867 SdrOutliner* pTEOutliner =pTextEditOutliner; 868 OutlinerView* pTEOutlinerView=pTextEditOutlinerView; 869 Cursor* pTECursorMerker=pTextEditCursorMerker; |
863 SdrUndoManager* pExtraUndoEditUndoManager = 0; | 870 SdrUndoManager* pUndoEditUndoManager = 0; 871 bool bNeedToUndoSavedRedoTextEdit(false); |
864 865 if(IsUndoEnabled() && GetModel() && pTEObj && pTEOutliner) 866 { 867 // change back the UndoManager to the remembered original one 868 ::svl::IUndoManager* pOriginal = pTEOutliner->SetUndoManager(mpOldTextEditUndoManager); 869 mpOldTextEditUndoManager = 0; 870 871 if(pOriginal) 872 { 873 // check if we got back our document undo manager | 872 873 if(IsUndoEnabled() && GetModel() && pTEObj && pTEOutliner) 874 { 875 // change back the UndoManager to the remembered original one 876 ::svl::IUndoManager* pOriginal = pTEOutliner->SetUndoManager(mpOldTextEditUndoManager); 877 mpOldTextEditUndoManager = 0; 878 879 if(pOriginal) 880 { 881 // check if we got back our document undo manager |
874 SdrUndoManager* pSdrUndoManager = dynamic_cast< SdrUndoManager* >(GetModel()->GetSdrUndoManager()); | 882 SdrUndoManager* pSdrUndoManager = getSdrUndoManagerForEnhancedTextEdit(); |
875 876 if(pSdrUndoManager && dynamic_cast< SdrUndoManager* >(pOriginal) == pSdrUndoManager) 877 { | 883 884 if(pSdrUndoManager && dynamic_cast< SdrUndoManager* >(pOriginal) == pSdrUndoManager) 885 { |
878 // We are ending text edit; execute all redos to create a complete text change 879 // undo action for the redo buffer. Also mark this state when at least one redo was 880 // executed; the created TextChange needs to be undone plus the first real undo 881 // outside the text edit changes 882 while(pSdrUndoManager->GetRedoActionCount()) | 886 if(pSdrUndoManager->isEndTextEditTriggeredFromUndo()) |
883 { | 887 { |
884 pExtraUndoEditUndoManager = pSdrUndoManager; 885 pSdrUndoManager->Redo(); | 888 // remember the UndoManager where missing Undos have to be triggered after end 889 // text edit. When the undo had triggered the end text edit, the original action 890 // which had to be undone originally is not yet undone. 891 pUndoEditUndoManager = pSdrUndoManager; 892 893 // We are ending text edit; if text edit was triggered from undo, execute all redos 894 // to create a complete text change undo action for the redo buffer. Also mark this 895 // state when at least one redo was executed; the created extra TextChange needs to 896 // be undone in addition to the first real undo outside the text edit changes 897 while(pSdrUndoManager->GetRedoActionCount()) 898 { 899 bNeedToUndoSavedRedoTextEdit = true; 900 pSdrUndoManager->Redo(); 901 } |
886 } 887 888 // reset the callback link and let the undo manager cleanup all text edit 889 // undo actions to get the stack back to the form before the text edit 890 pSdrUndoManager->SetEndTextEditHdl(Link()); 891 } 892 else 893 { --- 206 unchanged lines hidden (view full) --- 1100 !pTEObj->GetModel()->isLocked() && 1101 pTEObj->GetBroadcaster()) 1102 { 1103 SdrHint aHint(HINT_ENDEDIT); 1104 aHint.SetObject(pTEObj); 1105 ((SfxBroadcaster*)pTEObj->GetBroadcaster())->Broadcast(aHint); 1106 } 1107 | 902 } 903 904 // reset the callback link and let the undo manager cleanup all text edit 905 // undo actions to get the stack back to the form before the text edit 906 pSdrUndoManager->SetEndTextEditHdl(Link()); 907 } 908 else 909 { --- 206 unchanged lines hidden (view full) --- 1116 !pTEObj->GetModel()->isLocked() && 1117 pTEObj->GetBroadcaster()) 1118 { 1119 SdrHint aHint(HINT_ENDEDIT); 1120 aHint.SetObject(pTEObj); 1121 ((SfxBroadcaster*)pTEObj->GetBroadcaster())->Broadcast(aHint); 1122 } 1123 |
1108 if(pExtraUndoEditUndoManager) | 1124 if(pUndoEditUndoManager) |
1109 { | 1125 { |
1110 // undo the text edit action since it was created as part of a EndTextEdit 1111 // callback from undo itself. This needs to be done after the call to 1112 // FmFormView::SdrEndTextEdit since it gets created there 1113 pExtraUndoEditUndoManager->Undo(); | 1126 if(bNeedToUndoSavedRedoTextEdit) 1127 { 1128 // undo the text edit action since it was created as part of an EndTextEdit 1129 // callback from undo itself. This needs to be done after the call to 1130 // FmFormView::SdrEndTextEdit since it gets created there 1131 pUndoEditUndoManager->Undo(); 1132 } 1133 1134 // trigger the Undo which was not executed, but lead to this 1135 // end text edit 1136 pUndoEditUndoManager->Undo(); |
1114 } 1115 1116 return eRet; 1117} 1118 1119//////////////////////////////////////////////////////////////////////////////////////////////////// 1120// info about TextEdit. Default is sal_False. 1121bool SdrObjEditView::IsTextEdit() const --- 1129 unchanged lines hidden --- | 1137 } 1138 1139 return eRet; 1140} 1141 1142//////////////////////////////////////////////////////////////////////////////////////////////////// 1143// info about TextEdit. Default is sal_False. 1144bool SdrObjEditView::IsTextEdit() const --- 1129 unchanged lines hidden --- |