Issue 103373

Summary: Can't delete note when selecting a drawing object
Product: Writer Reporter: amy2008 <amy2008>
Component: editingAssignee: max.odendahl
Status: CLOSED FIXED QA Contact: issues@sw <issues>
Severity: Trivial    
Priority: P3 CC: issues, ooo.redflag, os_ooo, peter.junge, zhuangyuelin
Version: DEV300m51   
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Issue Depends on:    
Issue Blocks: 84405    

Description amy2008 2009-07-07 02:35:11 UTC
Can reproduce it in DEV300m51 

How to reproduce it
1 Create a new Writer doc
2 Input some characters, then insert notes for part or all of these characters
3 Insert a drawing object from drawing bar, like rectangle.
4 Select the drawing object, then click the drop down arrow of the Notes, 
  select "Delete all notes" or "Delete all notes by unknown author", pay 
  attention to the notes

Result
Notes couldn't be deleted

Expectation
Notes can be deleted

Note
At step 4, if you try to delete the notes by right_clicking the note and then
select "Delete all notes" or "Delete all notes by unknown author", find notes
can be deleted.
IMO, these two operations shoud give us the same result, but now it is totally
different.

Regards
Li Meiying
Comment 1 amy2008 2009-07-07 02:41:03 UTC
Have checked in OOo3.0 on WinXP and Fedora, can reproduce it too.
Further,
At step 4, Select the drawing object, then click the drop down arrow of the
Notes, select "Delete note", pay attention to the selected drawing, the drawing
object lost its focus (without 8 points).
Comment 2 max.odendahl 2009-07-07 04:59:48 UTC
confirmed
Comment 3 max.odendahl 2009-07-20 05:09:39 UTC
mod->os: I tried ResetSelect as a first call inside WrtShell::GotoField, but did
not help. Any insight or help from your side into this issue? Thanks!
Comment 4 Oliver Specht 2009-07-20 13:24:52 UTC
->mod: There is some odd behaviour when drawings are selected. The code you call
can only be executed in text mode. To achieve this the drawing or frame
selection must be removed and the TextShell need to be put on top of the
dispatcher stack. The changes below do that (for deletion of notes from a
certain author only)
Jumping to a text content using double click in the Navigator also doesn't work
when a drawing is selected.


Index: source/ui/docvw/postit.cxx
===================================================================
--- source/ui/docvw/postit.cxx	(revision 273580)
+++ source/ui/docvw/postit.cxx	(working copy)
@@ -1311,6 +1311,16 @@
 		case FN_DELETE_NOTE_AUTHOR:
 		case FN_HIDE_NOTE_AUTHOR:
 		{
+            SwWrtShell& rSh = mpView->GetWrtShell();
+            if( rSh.IsSelFrmMode() || rSh.IsObjSelected())
+            {
+                rSh.UnSelectFrm();
+                rSh.LeaveSelFrmMode();
+                rSh.EnterStdMode();

+                rSh.DrawSelChanged();

+                mpView->StopShellTimer();
+            }
+
 			// not possible as slot as this would require that "this" is the active postit
 			SfxStringItem aItem( nSlot, GetAuthor() );
 			const SfxPoolItem* aItems[2];
Index: source/ui/wrtsh/select.cxx
===================================================================
--- source/ui/wrtsh/select.cxx	(revision 273257)
+++ source/ui/wrtsh/select.cxx	(working copy)
@@ -337,6 +337,7 @@
     // Rahmenselektion aufheben mit garantiert ungueltiger Position
 	Point aPt(LONG_MIN, LONG_MIN);
     SelectObj(aPt, 0);
+    GetView().LeaveDrawCreate();
 	SwTransferable::ClearSelection( *this );
 }
 
Comment 5 max.odendahl 2009-07-20 17:38:11 UTC
mod->os: great, thanks for your help, will fix this(and some other related
navigator deletion issues) in notes10.

When the cursor is inside a draw object in editmode instead of only being
selected, I got a crash using this scenario, see issue 103645.

With your changes, I now get:

SwFEShell::IsFrmVertical: missing SwContact instance at marked object-> This is
a serious issue, please inform OD

SwFEShell::GetObjAttr: missing pContact - please inform OD

and then a crash as well.

As this is related to this issue, would you have a look into that as well?  
Comment 6 Oliver Specht 2009-07-20 18:01:49 UTC
->mod: I think the crash and the assertion are related to issue 102752
Comment 7 max.odendahl 2009-07-20 19:22:04 UTC
->os: no, using the patch from there does not fix the crash...
Comment 8 max.odendahl 2009-07-26 01:43:51 UTC
fixed in notes10, including navigator behaviour
Comment 9 eric.savary 2009-08-26 16:56:28 UTC
Verified in CWS notes10