Commits

Anonymous committed 19ffeff

Fix #i42852#: Undo-patch from CH2000

  • Participants
  • Parent commits 11faae2

Comments (0)

Files changed (16)

File sw/inc/editsh.hxx

 	void UpdateCharts( const String &rName );
 
 	//	aktuelles Wort erfragen
-	String GetCurWord();
+	// i42852
+	//String GetCurWord();
+	String GetCurWord( BOOL IsMarkedObjects = FALSE );
 
 	// Textbaustein aus dem Textbausteindokument in
 	// das aktuelle Dokument, Vorlagen nur wenn es nicht schon gibt

File sw/inc/swundo.hxx

 	UNDO_SETNUMRULESTART,                   // 30
 	UNDO_CHGFTN,                            // 31
 	UNDO_REDLINE,                           // 32
-	UNDO_ACCEPT_REDLINE,                    // 33
-	UNDO_REJECT_REDLINE,                    // 34
-	UNDO_SPLIT_TABLE,                       // 35
-	UNDO_DONTEXPAND,                        // 36
-	UNDO_AUTOCORRECT,                    	// 37
-	UNDO_MERGE_TABLE,                    	// 38
-	UNDO_TRANSLITERATE,                     // 39
+
+	// OOoIssue42852-12
+	//UNDO_ACCEPT_REDLINE,                    // 33
+	//UNDO_REJECT_REDLINE,                    // 34	
+
+	UNDO_SPLIT_TABLE,                       // 33
+	UNDO_DONTEXPAND,                        // 34
+	UNDO_AUTOCORRECT,                    	// 35
+	UNDO_MERGE_TABLE,                    	// 36
+	UNDO_TRANSLITERATE,                     // 37
 
     // -> #111827#
-	UNDO_PASTE_CLIPBOARD,                           // 40
-	UNDO_TYPING,                           // 41
+	UNDO_PASTE_CLIPBOARD,                           // 38
+	UNDO_TYPING,                           // 39
     // <- #111827#
-	UNDO_REPEAT_DUMMY_6,                    // 42
-	UNDO_REPEAT_DUMMY_7,                    // 43
-	UNDO_REPEAT_DUMMY_8,                    // 44
-	UNDO_REPEAT_DUMMY_9,                    // 45
+
+	UNDO_REPEAT_DUMMY_6,                    // 40
+	UNDO_REPEAT_DUMMY_7,                    // 41
+	UNDO_REPEAT_DUMMY_8,                    // 42
+	UNDO_REPEAT_DUMMY_9,                    // 43
 	REPEAT_END,
 
-	UNDO_MOVE = REPEAT_END,                 // 46
-	UNDO_INSGLOSSARY,                       // 47
-	UNDO_DELBOOKMARK,                       // 48
-	UNDO_INSBOOKMARK,                       // 49
-	UNDO_SORT_TBL,                          // 50
-	UNDO_DELLAYFMT,                         // 51
-	UNDO_AUTOFORMAT,                        // 52
-	UNDO_REPLACE,                           // 53
-	UNDO_DELSECTION,                        // 54
-	UNDO_CHGSECTION,                        // 55
-	UNDO_CHGSECTIONPASSWD,                  // 56
-	UNDO_SETDEFTATTR,                       // 57
-	UNDO_DELNUM,                            // 58
-	UNDO_DRAWUNDO,                          // 59
-	UNDO_DRAWGROUP,                         // 60
-	UNDO_DRAWUNGROUP,                       // 61
-	UNDO_DRAWDELETE,                        // 62
-	UNDO_REREAD,                            // 63
-	UNDO_DELGRF,                            // 64
-	UNDO_DELOLE,                            // 65
-	UNDO_TABLE_ATTR,                        // 66
-	UNDO_TABLE_AUTOFMT,                     // 67
-	UNDO_TABLE_INSCOL,                      // 68
-	UNDO_TABLE_INSROW,                      // 69
-	UNDO_TABLE_DELBOX,                      // 70
-	UNDO_TABLE_SPLIT,                       // 71
-	UNDO_TABLE_MERGE,                       // 72
-	UNDO_TBLNUMFMT,                         // 73
-	UNDO_INSTOX,                            // 74
-	UNDO_CLEARTOXRANGE,                     // 75
-	UNDO_TBLCPYTBL,                         // 76
-	UNDO_CPYTBL,                            // 77
-	UNDO_INS_FROM_SHADOWCRSR,               // 78
-	UNDO_CHAINE,                            // 79
-	UNDO_UNCHAIN,                           // 80
-	UNDO_FTNINFO,                           // 81
-	UNDO_ENDNOTEINFO,                       // 82
-	UNDO_COMPAREDOC,                        // 83
-	UNDO_SETFLYFRMFMT,                      // 84
-	UNDO_SETRUBYATTR,						// 85
+	UNDO_MOVE = REPEAT_END,                 // 44
+	UNDO_INSGLOSSARY,                       // 45
+	UNDO_DELBOOKMARK,                       // 46
+	UNDO_INSBOOKMARK,                       // 47
+	UNDO_SORT_TBL,                          // 48
+	UNDO_DELLAYFMT,                         // 49
+	UNDO_AUTOFORMAT,                        // 50
+	UNDO_REPLACE,                           // 51
+	UNDO_DELSECTION,                        // 52
+	UNDO_CHGSECTION,                        // 53
+	UNDO_CHGSECTIONPASSWD,                  // 54
+	UNDO_SETDEFTATTR,                       // 55
+	UNDO_DELNUM,                            // 56
+	UNDO_DRAWUNDO,                          // 57
+	UNDO_DRAWGROUP,                         // 58
+	UNDO_DRAWUNGROUP,                       // 59
+	UNDO_DRAWDELETE,                        // 60
+	UNDO_REREAD,                            // 61
+	UNDO_DELGRF,                            // 62
+	UNDO_DELOLE,                            // 63
+	UNDO_TABLE_ATTR,                        // 64
+	UNDO_TABLE_AUTOFMT,                     // 65
+	UNDO_TABLE_INSCOL,                      // 66
+	UNDO_TABLE_INSROW,                      // 67
+	UNDO_TABLE_DELBOX,                      // 68
+	UNDO_TABLE_SPLIT,                       // 69
+	UNDO_TABLE_MERGE,                       // 70
+	UNDO_TBLNUMFMT,                         // 71
+	UNDO_INSTOX,                            // 72
+	UNDO_CLEARTOXRANGE,                     // 73
+	UNDO_TBLCPYTBL,                         // 74
+	UNDO_CPYTBL,                            // 75
+	UNDO_INS_FROM_SHADOWCRSR,               // 76
+	UNDO_CHAINE,                            // 77
+	UNDO_UNCHAIN,                           // 78
+	UNDO_FTNINFO,                           // 79
+	UNDO_ENDNOTEINFO,                       // 80
+	UNDO_COMPAREDOC,                        // 81
+	UNDO_SETFLYFRMFMT,                      // 82
+	UNDO_SETRUBYATTR,						// 83
 
-	UNDO_TMPAUTOCORR,                       // 86 #102505#
-	UNDO_TOXCHANGE,                         // 87
-	UNDO_CREATE_PAGEDESC,                           // 88
-	UNDO_CHANGE_PAGEDESC,                           // 89
-	UNDO_DELETE_PAGEDESC,                           // 90
-	UNDO_HEADER_FOOTER,                           // 91 #i7983#
-    UNDO_FIELD,                             // 92 #111840#
-    UNDO_TXTFMTCOL_CREATE,                   // 93
-    UNDO_TXTFMTCOL_DELETE,                   // 94
-    UNDO_TXTFMTCOL_RENAME, // 95
-    UNDO_CHARFMT_CREATE, // 96
-    UNDO_CHARFMT_DELETE, // 97
-    UNDO_CHARFMT_RENAME, // 98
-    UNDO_FRMFMT_CREATE, // 99
-    UNDO_FRMFMT_DELETE, // 100
-    UNDO_FRMFMT_RENAME, // 101
-    UNDO_NUMRULE_CREATE,// 102
-    UNDO_NUMRULE_DELETE,// 103
-    UNDO_NUMRULE_RENAME,// 104
-    UNDO_BOOKMARK_RENAME, // 105
-    UNDO_INDEX_ENTRY_INSERT, // 106
-    UNDO_INDEX_ENTRY_DELETE, // 107
-    UNDO_COL_DELETE, // 108
-    UNDO_ROW_DELETE, // 109
-    UNDO_RENAME_PAGEDESC, // 110
-    UNDO_NUMDOWN, // 111
-    UNDO_STD_END= UNDO_NUMDOWN,
+	UNDO_TMPAUTOCORR,                       // 84 #102505#
+	UNDO_TOXCHANGE,                         // 85
+	UNDO_CREATE_PAGEDESC,                           // 86
+	UNDO_CHANGE_PAGEDESC,                           // 87
+	UNDO_DELETE_PAGEDESC,                           // 88
+	UNDO_HEADER_FOOTER,                           // 89 #i7983#
+    UNDO_FIELD,                             // 90 #111840#
+    UNDO_TXTFMTCOL_CREATE,                   // 91
+    UNDO_TXTFMTCOL_DELETE,                   // 92
+    UNDO_TXTFMTCOL_RENAME, // 93
+    UNDO_CHARFMT_CREATE, // 94
+    UNDO_CHARFMT_DELETE, // 95
+    UNDO_CHARFMT_RENAME, // 96
+    UNDO_FRMFMT_CREATE, // 97
+    UNDO_FRMFMT_DELETE, // 98
+    UNDO_FRMFMT_RENAME, // 99
+    UNDO_NUMRULE_CREATE,// 100
+    UNDO_NUMRULE_DELETE,// 101
+    UNDO_NUMRULE_RENAME,// 102
+    UNDO_BOOKMARK_RENAME, // 103
+    UNDO_INDEX_ENTRY_INSERT, // 104
+    UNDO_INDEX_ENTRY_DELETE, // 105
+    UNDO_COL_DELETE, // 106
+    UNDO_ROW_DELETE, // 107
+    UNDO_RENAME_PAGEDESC, // 108
+    UNDO_NUMDOWN, // 109
+
+	// OOoIssue42852-12
+    //UNDO_STD_END= UNDO_NUMDOWN,
+	UNDO_ACCEPT_REDLINE,                    // 110
+	UNDO_REJECT_REDLINE,                    // 111
+	UNDO_CUT,								// 112
+	UNDO_STD_END= UNDO_CUT,
 
     // UI undo ID's...
     UNDO_UI_REPLACE             =  UNDO_STD_END + 1,

File sw/inc/undobj.hxx

 	OUT_UNDOBJ( Delete )
 
 	DECL_FIXEDMEMPOOL_NEWDEL(SwUndoDelete)
+
+	//OOoIssue42852-4 20080521
+private:
+	String aDelCnt;
 };
 
 
 class SwUndoCpyDoc : public SwUndoInserts
 {
 public:
-	SwUndoCpyDoc( const SwPaM& );
+	//i42852-11
+	//SwUndoCpyDoc( const SwPaM& );
+	SwUndoCpyDoc( const SwPaM&, SwUndoId eUndoId = UNDO_COPY );
 	OUT_UNDOBJ( Copy )
 };
 
 	void ChgShowSel( BOOL bNew ) { bShowSelFrm = bNew; }
 
     virtual SwRewriter GetRewriter() const;
+	
+	String GetComment() const;		//issue42852-8 20081015
 
 	OUT_UNDOBJ( DelLayFmt )
 };
     SwUndoId GetUserId() const { return nUserId; }
 	USHORT GetRedlSaveCount() const
 		{ return pRedlSaveData ? pRedlSaveData->Count() : 0; }
+// OOoIssue42852-13
+private:
+	SwRewriter mRewriter;
+public:
+	SwRewriter GetRewriter() const;
+	void SetRewriter( SwRewriter & rRewriter ) { mRewriter = rRewriter; }
 };
 
 class SwUndoRedlineDelete : public SwUndoRedline

File sw/source/core/doc/docredln.cxx

 		do {
 
 			if( DoesUndo() )
-				AppendUndo( new SwUndoAcceptRedline( *pTmp ));
+			//OOoIssue42852-1 20080521 stt
+			//	AppendUndo( new SwUndoAcceptRedline( *pTmp ));
+			{
+				SwRewriter aRewriter;
+				aRewriter.AddRule(UNDO_ARG1, pTmp->GetDescr());
+				SwUndoAcceptRedline * pUndo = new SwUndoAcceptRedline(*pTmp);
+				pUndo->SetRewriter(aRewriter);
+				AppendUndo(pUndo);
+			}
+			//OOoIssue42852-1 20080521 end
 
 			bRet |= lcl_AcceptRedline( *pRedlineTbl, nPos, bCallDelete );
 
             SwRewriter aRewriter;
 
             aRewriter.AddRule(UNDO_ARG1, pTmp->GetDescr());
-			StartUndo( UNDO_REJECT_REDLINE, NULL );
+			//OOoIssue42852-2 20080521
+			//StartUndo( UNDO_REJECT_REDLINE, NULL );
+			StartUndo( UNDO_REJECT_REDLINE, &aRewriter );
         }
 
 		int nLoopCnt = 2;

File sw/source/core/docnode/ndcopy.cxx

 
 	SwTblNumFmtMerge aTNFM( *this, *pDoc );
 
+	//i42852-11
+	USHORT nSize = nUndoPos;
+
 	if( pDoc->DoesUndo() )
 	{
 		pDoc->ClearRedo();
-		pUndo = new SwUndoCpyDoc( aCpyPam );
+		//i42852-11
+		if (nSize)
+			pUndo = new SwUndoCpyDoc( aCpyPam, (*pUndos)[ --nSize ]->GetId() );
+		else
+			pUndo = new SwUndoCpyDoc( aCpyPam );
+		
 		pDoc->AppendUndo( pUndo );
 	}
 

File sw/source/core/edit/editsh.cxx

 #include <numrule.hxx>
 #include <SwNodeNum.hxx>
 
+// i42852
+#ifndef _VIEWIMP_HXX
+#include "viewimp.hxx"
+#endif
+#include "dview.hxx"
+
 using namespace com::sun::star;
 
 SV_IMPL_PTRARR(SwGetINetAttrs, SwGetINetAttr*)
 
 // erfragen des akt. Wortes
 
-String SwEditShell::GetCurWord()
+// i42852
+String SwEditShell::GetCurWord( BOOL IsMarkedObjects )
 {
-    const SwPaM& rPaM = *GetCrsr();
-    const SwTxtNode* pNd = rPaM.GetNode()->GetTxtNode();
-    String aString = pNd ?
+    String aString;
+	if(IsMarkedObjects)
+	{
+		SwDrawView *pDrawView = Imp()->GetDrawView();
+		aString = pDrawView->GetDescriptionOfMarkedObjects();
+	}
+	else
+	{
+		const SwPaM& rPaM = *GetCrsr();
+		const SwTxtNode* pNd = rPaM.GetNode()->GetTxtNode();
+		aString = pNd ?
                      pNd->GetCurWord(rPaM.GetPoint()->nContent.GetIndex()) :
                      aEmptyStr;
+	}
 	return aString;
 }
 

File sw/source/core/edit/edlingu.cxx

 #include <splargs.hxx>
 #include <redline.hxx>      // SwRedline
 #include <docary.hxx>       // SwRedlineTbl
+#include <SwRewriter.hxx>
 #include <docsh.hxx>
 
 using namespace ::svx;
             return;
 
         SwPaM *pCrsr = GetCrsr();
-        pDoc->StartUndo( UNDO_OVERWRITE, NULL );
+		// OOoIssue42852-7 20080521
+        //pDoc->StartUndo( UNDO_OVERWRITE, NULL );
+		SpellPortions::const_iterator aNewPortion = rNewPortions.end();
+		SpellPortions::const_iterator aOldPortion = rLastPortions.end();
+		--aNewPortion;
+		--aOldPortion;
+		while (aNewPortion->bIsHidden) 
+			--aNewPortion;
+		while (aOldPortion->bIsHidden)
+ 			--aOldPortion;
+		String aNewText = aNewPortion->sText;
+		String aOldText = aOldPortion->sText;
+		SwRewriter aRewriter;
+		aRewriter.AddRule(String("$1",RTL_TEXTENCODING_ASCII_US), aOldText);
+		aRewriter.AddRule(String("$2",RTL_TEXTENCODING_ASCII_US), aNewText);
+        pDoc->StartUndo( UNDO_OVERWRITE, &aRewriter );
+
         StartAction();
         sal_uInt32 nRedlinePortions = lcl_CountRedlines(rLastPortions);
         if((rLastPortions.size() - nRedlinePortions) == rNewPortions.size())

File sw/source/core/undo/makefile.mk

         $(SLO)$/unattr.obj \
         $(SLO)$/undobj.obj \
         $(SLO)$/undraw.obj \
+		$(SLO)$/unredln.obj \
         $(SLO)$/untbl.obj
 
 SLOFILES =	\

File sw/source/core/undo/undel.cxx

 		rPam.GetPoint()->nContent.Assign( 0, 0 );
 
 	// wird die History ueberhaupt benoetigt ??
-	if( pHistory && !pHistory->Count() )
-		DELETEZ( pHistory );
+	// OOoIssue42852-4 20080521
+	//if( pHistory && !pHistory->Count() )
+	//	DELETEZ( pHistory );
+	aDelCnt = String::CreateFromAscii("");
+	if (pHistory)
+	{
+		for (int n = 0; n < pHistory->Count(); n++)
+		{
+			String aDescr = (*pHistory)[n]->GetDescription();
+			if (aDescr.Len() > 0)
+			{
+				aDelCnt = aDescr;
+				break;
+			}
+		}
+		if (!pHistory->Count())
+		DELETEZ( pHistory );	
+	}
 }
 
 BOOL SwUndoDelete::SaveCntnt( const SwPosition* pStt, const SwPosition* pEnd,
         {
             aStr = ShortenString(aStr, nUndoStringLength,
                                  String(SW_RES(STR_LDOTS)));
+			//OOoIssue42852-4 20080521
+			if ( aStr == UNDO_ARG2 && aDelCnt.Len() )
+				aStr = aDelCnt;
         }
 
         aResult.AddRule(UNDO_ARG1, aStr);

File sw/source/core/undo/undo.hrc

 #define STR_SETNUMRULESTART		(UNDO_BASE      +30)
 #define STR_CHANGEFTN			(UNDO_BASE      +31)
 #define STR_REDLINE				(UNDO_BASE      +32)
-#define STR_ACCEPT_REDLINE		(UNDO_BASE      +33)
-#define STR_REJECT_REDLINE		(UNDO_BASE      +34)
-#define STR_SPLIT_TABLE			(UNDO_BASE      +35)
-#define STR_DONTEXPAND			(UNDO_BASE      +36)
-#define STR_AUTOCORRECT			(UNDO_BASE      +37)
-#define STR_MERGE_TABLE			(UNDO_BASE      +38)
-#define STR_TRANSLITERATE		(UNDO_BASE      +39)
-#define STR_PASTE_CLIPBOARD_UNDO    (UNDO_BASE      +40)
-#define STR_TYPING_UNDO 		    (UNDO_BASE      +41)
 
-#define STR_REPEAT_DUMMY_6		(UNDO_BASE      +42)
-#define STR_REPEAT_DUMMY_7		(UNDO_BASE      +43)
-#define STR_REPEAT_DUMMY_8		(UNDO_BASE      +44)
-#define STR_REPEAT_DUMMY_9		(UNDO_BASE      +45)
+//i42852 - 12
+//#define STR_ACCEPT_REDLINE		(UNDO_BASE      +33)
+//#define STR_REJECT_REDLINE		(UNDO_BASE      +34)
+#define STR_SPLIT_TABLE			(UNDO_BASE      +33)
+#define STR_DONTEXPAND			(UNDO_BASE      +34)
+#define STR_AUTOCORRECT			(UNDO_BASE      +35)
+#define STR_MERGE_TABLE			(UNDO_BASE      +36)
+#define STR_TRANSLITERATE		(UNDO_BASE      +37)
+#define STR_PASTE_CLIPBOARD_UNDO    (UNDO_BASE      +38)
+#define STR_TYPING_UNDO 		    (UNDO_BASE      +39)
+
+#define STR_REPEAT_DUMMY_6		(UNDO_BASE      +40)
+#define STR_REPEAT_DUMMY_7		(UNDO_BASE      +41)
+#define STR_REPEAT_DUMMY_8		(UNDO_BASE      +42)
+#define STR_REPEAT_DUMMY_9		(UNDO_BASE      +43)
 // !!!!!! umsetzen !!!!!!!!!!! umsetzen !!!!!!!!!!! umsetzen !!!!
 #define CORE_REPEAT_END          STR_REPEAT_DUMMY_9// !!!! umsetzen !!!
 
 #define STR_NUMDOWN                         (CORE_REPEAT_END      +66)
 
 // !!!!!! umsetzen !!!!!!!!!!! umsetzen !!!!!!!!!!! umsetzen !!!!
-#define CORE_UNDO_END           STR_NUMDOWN// !!!! umsetzen !!!
+
+//i42852 - 12
+//#define CORE_UNDO_END           STR_NUMDOWN// !!!! umsetzen !!!
+#define STR_ACCEPT_REDLINE					(CORE_REPEAT_END      +67)
+#define STR_REJECT_REDLINE					(CORE_REPEAT_END      +68)
+#define STR_CUT_UNDO						(CORE_REPEAT_END      +69)
+#define CORE_UNDO_END           STR_CUT_UNDO
 
 // UI-Undo Klammerungen
 #define UI_UNDO_BEGIN                   (CORE_UNDO_END + 1)

File sw/source/core/undo/undo.src

 };
 String STR_OVR_UNDO
 {
-	Text [ en-US ] = "Overwrite: $1" ;
+	// OOoIssue42852-7 20080521
+	//Text [ en-US ] = "Overwrite: $1" ;
+	Text [ en-US ] = "replace $1 -> $2";
 };
 String STR_SPLITNODE_UNDO
 {
 };
 String STR_UNDO_SETRUBYATTR
 {
-	Text [ en-US ] = "Ruby Setting";
+	//OOoIssue42852-5 20080521
+	//Text [ en-US ] = "Ruby Setting";
+	Text [ en-US ] = "Asian phonetic guides setting";
 };
 #102505#
 String STR_UNDO_TMPAUTOCORR
 {
     Text[ en-US ] = "paragraph";
 };
+String STR_CUT_UNDO //OOoIssue42852-12
+{
+	Text[ en-US ] = "Cut $1";
+};

File sw/source/core/undo/undobj1.cxx

 	DelFly( pFrmFmt->GetDoc() );
 }
 
+//issue42852-8 20081015 why imp GetRewriter()? commented above GetRewriter()
+String SwUndoDelLayFmt::GetComment() const
+{
+    String aResult;
+
+    if (! pComment)
+    {
+        /*
+          If frame format is present and has an SdrObject use the undo
+          comment of the SdrObject. Otherwise use the default comment.
+        */
+
+        bool bDone = false;
+        if (pFrmFmt)
+        {
+            const SdrObject * pSdrObj = pFrmFmt->FindSdrObject();
+            if ( pSdrObj )
+            {
+                aResult = SdrUndoDelObj::GetComment( *pSdrObj );
+                bDone = true;
+            }
+        }
+	
+        if (! bDone)
+            aResult = SwUndo::GetComment();
+    }
+    else
+        aResult = *pComment;
+
+    return aResult;
+}
+//end
+
 /* 
 */
 
 SwUndoSetFlyFmt::SwUndoSetFlyFmt( SwFrmFmt& rFlyFmt, SwFrmFmt& rNewFrmFmt )

File sw/source/core/undo/unredln.cxx

 #include <unotools/charclass.hxx>
 #include <doc.hxx>
 #include <swundo.hxx>			// fuer die UndoIds
+#include <SwRewriter.hxx>
 #include <pam.hxx>
 #include <ndtxt.hxx>
 #include <undobj.hxx>
 
 
 SwUndoRedline::SwUndoRedline( SwUndoId nUsrId, const SwPaM& rRange )
-	: SwUndo( UNDO_REDLINE ), SwUndRng( rRange ),
+	//: SwUndo( UNDO_REDLINE ), SwUndRng( rRange ), //OOoIssue42852-13
+	: SwUndo( nUsrId ), SwUndRng( rRange ),
 	pRedlData( 0 ), pRedlSaveData( 0 ), nUserId( nUsrId ),
 	bHiddenRedlines( FALSE )
 {
 	rIter.GetDoc().DeleteRedline( *rIter.pAktPam, true, USHRT_MAX );
 }
 
+//i42852-13
+SwRewriter SwUndoRedline::GetRewriter() const
+{ 
+	return mRewriter; 
+}
 
 /* 
 */
 
     : SwUndoRedline( nUsrId = (nUsrId ? nUsrId : UNDO_DELETE), rRange ),
 	bCanGroup( FALSE ), bIsDelim( FALSE ), bIsBackspace( FALSE )
 {
+	String aText;
+	if ( rRange.GetNode() && rRange.GetNode()->GetTxtNode() )
+		aText = rRange.GetNode()->GetTxtNode()->GetTxt();
+	aText = String("\'", RTL_TEXTENCODING_ASCII_US).Append(aText).AppendAscii("\'");
+	SwRewriter aRewriter;
+	aRewriter.AddRule(UNDO_ARG1, aText);
+	SetRewriter(aRewriter);
 	const SwTxtNode* pTNd;
 	if( UNDO_DELETE == nUserId &&
 		nSttNode == nEndNode && nSttCntnt + 1 == nEndCntnt &&

File sw/source/core/undo/untblk.cxx

 {
 }
 
-SwUndoCpyDoc::SwUndoCpyDoc( const SwPaM& rPam )
-	: SwUndoInserts( UNDO_COPY, rPam )
+//i42852-11
+//SwUndoCpyDoc::SwUndoCpyDoc( const SwPaM& rPam )
+//	: SwUndoInserts( UNDO_COPY, rPam )
+SwUndoCpyDoc::SwUndoCpyDoc( const SwPaM& rPam, SwUndoId eUndoId )
+	: SwUndoInserts( eUndoId, rPam )	
 {
 }
 

File sw/source/ui/dochdl/swdtflvr.cxx

 {
 	int nRet = Copy( TRUE );
 	if( nRet )
-		DeleteSelection();
+		// OOoIssue42852-12
+		//DeleteSelection();
+		DeleteSelection(TRUE);
 	return nRet;
 }
 
 // -----------------------------------------------------------------------
 
-void SwTransferable::DeleteSelection()
+// OOoIssue42852-12
+void SwTransferable::DeleteSelection( BOOL bIsCut )
 {
     if(!pWrtShell)
         return;
+
+	SwRewriter aRewriter;
+	String aText;
+	int nSelection = pWrtShell->GetSelectionType();
+	
+	if(nSelection & nsSelectionType::SEL_TBL_CELLS)
+		nSelection = nsSelectionType::SEL_TBL;
+	if(nSelection & nsSelectionType::SEL_TXT)
+		nSelection = nsSelectionType::SEL_TXT;
+
+
+    switch( nSelection & ~(nsSelectionType::SEL_BEZ) )
+	{
+    case nsSelectionType::SEL_TXT:
+    case nsSelectionType::SEL_TBL:
+    case nsSelectionType::SEL_NUM:
+			aText = pWrtShell->GetCurWord();
+			break;
+	case nsSelectionType::SEL_FRM:
+    case nsSelectionType::SEL_GRF:
+    case nsSelectionType::SEL_OLE:
+    case nsSelectionType::SEL_DRW:
+    case nsSelectionType::SEL_DRW_TXT:
+    case nsSelectionType::SEL_DRW_FORM: 
+		{	
+			aText = pWrtShell->GetCurWord( TRUE );
+			break;
+		}
+	default:
+		break;
+
+	}
+	aText = String("\'", RTL_TEXTENCODING_ASCII_US).Append(aText).AppendAscii("\'");
+	aRewriter.AddRule(String("$1",RTL_TEXTENCODING_ASCII_US), aText);
+
     // Selektionsart vor Action-Klammerung erfragen
-	const int nSelection = pWrtShell->GetSelectionType();
-	pWrtShell->StartUndo( UNDO_DELETE );
+	//const int nSelection = pWrtShell->GetSelectionType();
+	if (bIsCut)
+		pWrtShell->StartUndo( UNDO_CUT, &aRewriter );
+	else
+		pWrtShell->StartUndo( UNDO_DELETE );
 	if( ( nsSelectionType::SEL_TXT | nsSelectionType::SEL_TBL ) & nSelection )
 		pWrtShell->IntelligentCut( nSelection );
 	pWrtShell->DelRight();
-	pWrtShell->EndUndo( UNDO_DELETE );
+	if (bIsCut)
+		pWrtShell->EndUndo( UNDO_CUT, &aRewriter );
+	else
+		pWrtShell->EndUndo( UNDO_DELETE );
 }
 
 // -----------------------------------------------------------------------

File sw/source/ui/inc/swdtflvr.hxx

 	// helper methods for the copy
     com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > FindOLEObj( sal_Int64& nAspect ) const;
 	Graphic* FindOLEReplacementGraphic() const;
-	void DeleteSelection();
+	//void DeleteSelection(); //OOoIssue42852-12
+	void DeleteSelection( BOOL bIsCut = FALSE );
 
 	// helper methods for the paste
 	static void SetSelInShell( SwWrtShell& , BOOL , const Point* );