futext3.cxx (b3f79822) futext3.cxx (a840a559)
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

--- 73 unchanged lines hidden (view full) ---

82
83 ScDocShell* pDocShell = rViewData.GetDocShell();
84 ::svl::IUndoManager* pUndoMgr = rDoc.IsUndoEnabled() ? pDocShell->GetUndoManager() : 0;
85 bool bNewNote = false;
86 if( pNote && pUndoMgr )
87 {
88 /* Put all undo actions already collected (e.g. create caption object)
89 and all following undo actions (text changed) together into a ListAction. */
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

--- 73 unchanged lines hidden (view full) ---

82
83 ScDocShell* pDocShell = rViewData.GetDocShell();
84 ::svl::IUndoManager* pUndoMgr = rDoc.IsUndoEnabled() ? pDocShell->GetUndoManager() : 0;
85 bool bNewNote = false;
86 if( pNote && pUndoMgr )
87 {
88 /* Put all undo actions already collected (e.g. create caption object)
89 and all following undo actions (text changed) together into a ListAction. */
90 String aUndoStr = ScGlobal::GetRscString( STR_UNDO_EDITNOTE );
91 pUndoMgr->EnterListAction( aUndoStr, aUndoStr );
92 if( SdrUndoGroup* pCalcUndo = pDrawLayer->GetCalcUndo() )
90 SdrUndoGroup* pCalcUndo = pDrawLayer->GetCalcUndo();
91
92 if(pCalcUndo)
93 {
93 {
94 const String aUndoStr = ScGlobal::GetRscString( STR_UNDO_EDITNOTE );
95 pUndoMgr->EnterListAction( aUndoStr, aUndoStr );
96
94 /* Note has been created before editing, if first undo action is
95 an insert action. Needed below to decide whether to drop the
96 undo if editing a new note has been cancelled. */
97 bNewNote = (pCalcUndo->GetActionCount() > 0) && pCalcUndo->GetAction( 0 )->ISA( SdrUndoNewObj );
97 /* Note has been created before editing, if first undo action is
98 an insert action. Needed below to decide whether to drop the
99 undo if editing a new note has been cancelled. */
100 bNewNote = (pCalcUndo->GetActionCount() > 0) && pCalcUndo->GetAction( 0 )->ISA( SdrUndoNewObj );
101
98 // create a "insert note" undo action if needed
99 if( bNewNote )
100 pUndoMgr->AddUndoAction( new ScUndoReplaceNote( *pDocShell, aNotePos, pNote->GetNoteData(), true, pCalcUndo ) );
101 else
102 pUndoMgr->AddUndoAction( pCalcUndo );
103 }
104 }
105

--- 29 unchanged lines hidden (view full) ---

135 object have to be removed. */
136 SdrTextObj* pTextObject = dynamic_cast< SdrTextObj* >( pObject );
137 bool bDeleteNote = !pTextObject || !pTextObject->HasText();
138 if( bDeleteNote )
139 {
140 if( pUndoMgr )
141 {
142 // collect the "remove object" drawing undo action created by DeleteNote()
102 // create a "insert note" undo action if needed
103 if( bNewNote )
104 pUndoMgr->AddUndoAction( new ScUndoReplaceNote( *pDocShell, aNotePos, pNote->GetNoteData(), true, pCalcUndo ) );
105 else
106 pUndoMgr->AddUndoAction( pCalcUndo );
107 }
108 }
109

--- 29 unchanged lines hidden (view full) ---

139 object have to be removed. */
140 SdrTextObj* pTextObject = dynamic_cast< SdrTextObj* >( pObject );
141 bool bDeleteNote = !pTextObject || !pTextObject->HasText();
142 if( bDeleteNote )
143 {
144 if( pUndoMgr )
145 {
146 // collect the "remove object" drawing undo action created by DeleteNote()
143 pDrawLayer->BeginCalcUndo();
147 pDrawLayer->BeginCalcUndo(false);
144 // rescue note data before deletion
145 ScNoteData aNoteData( pNote->GetNoteData() );
146 // delete note from document (removes caption, but does not delete it)
147 rDoc.DeleteNote( aNotePos );
148 // create undo action for removed note
149 pUndoMgr->AddUndoAction( new ScUndoReplaceNote( *pDocShell, aNotePos, aNoteData, false, pDrawLayer->GetCalcUndo() ) );
150 }
151 else

--- 94 unchanged lines hidden ---
148 // rescue note data before deletion
149 ScNoteData aNoteData( pNote->GetNoteData() );
150 // delete note from document (removes caption, but does not delete it)
151 rDoc.DeleteNote( aNotePos );
152 // create undo action for removed note
153 pUndoMgr->AddUndoAction( new ScUndoReplaceNote( *pDocShell, aNotePos, aNoteData, false, pDrawLayer->GetCalcUndo() ) );
154 }
155 else

--- 94 unchanged lines hidden ---