Author: alg Date: Mon Feb 17 15:48:54 2014 New Revision: 1569029 URL: http://svn.apache.org/r1569029 Log: i123468 Added SdrEndTextEdit before replacing EmptyPresObj, also secured ReplaceObjectAtView to check for active TextEdit, assert this and make an emergency correction
Modified: openoffice/trunk/main/sd/source/ui/func/fuinsert.cxx openoffice/trunk/main/svx/source/svdraw/svdedtv.cxx Modified: openoffice/trunk/main/sd/source/ui/func/fuinsert.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/ui/func/fuinsert.cxx?rev=1569029&r1=1569028&r2=1569029&view=diff ============================================================================== --- openoffice/trunk/main/sd/source/ui/func/fuinsert.cxx (original) +++ openoffice/trunk/main/sd/source/ui/func/fuinsert.cxx Mon Feb 17 15:48:54 2014 @@ -378,7 +378,15 @@ void FuInsertOLE::DoExecute( SfxRequest& pPage->InsertPresObj( pOleObj, ePresObjKind ); pOleObj->SetUserCall(pPickObj->GetUserCall()); } - } + + // #123468# we need to end text edit before replacing the object. There cannot yet + // being text typed (else it would not be an EmptyPresObj anymore), but it may be + // in text edit mode + if(mpView->IsTextEdit()) + { + mpView->SdrEndTextEdit(); + } + } bool bRet = true; if( pPickObj ) Modified: openoffice/trunk/main/svx/source/svdraw/svdedtv.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/svdraw/svdedtv.cxx?rev=1569029&r1=1569028&r2=1569029&view=diff ============================================================================== --- openoffice/trunk/main/svx/source/svdraw/svdedtv.cxx (original) +++ openoffice/trunk/main/svx/source/svdraw/svdedtv.cxx Mon Feb 17 15:48:54 2014 @@ -39,6 +39,7 @@ #include "svx/svdstr.hrc" // Namen aus der Resource #include "svx/svdglob.hxx" // StringCache #include <svx/e3dsceneupdater.hxx> +#include <svx/svdview.hxx> // #i13033# #include <clonelist.hxx> @@ -1022,6 +1023,26 @@ sal_Bool SdrEditView::InsertObjectAtView void SdrEditView::ReplaceObjectAtView(SdrObject* pOldObj, SdrPageView& rPV, SdrObject* pNewObj, sal_Bool bMark) { + if(IsTextEdit()) + { +#ifdef DBG_UTIL + if(pOldObj && dynamic_cast< SdrTextObj* >(pOldObj) && static_cast< SdrTextObj* >(pOldObj)->IsTextEditActive()) + { + OSL_ENSURE(false, "OldObject is in TextEdit mode, this has to be ended before replacing it usnig SdrEndTextEdit (!)"); + } + + if(pNewObj && dynamic_cast< SdrTextObj* >(pNewObj) && static_cast< SdrTextObj* >(pNewObj)->IsTextEditActive()) + { + OSL_ENSURE(false, "NewObject is in TextEdit mode, this has to be ended before replacing it usnig SdrEndTextEdit (!)"); + } +#endif + + // #123468# emergency repair situation, needs to cast up to a class derived from + // this one; (aw080 has a mechanism for that and the view hierarchy is secured to + // always be a SdrView) + if(dynamic_cast< SdrView* >(this)) static_cast< SdrView* >(this)->SdrEndTextEdit(); + } + SdrObjList* pOL=pOldObj->GetObjList(); const bool bUndo = IsUndoEnabled(); if( bUndo )