summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2010-12-22 12:31:22 -0500
committerKohei Yoshida <kyoshida@novell.com>2010-12-22 12:33:42 -0500
commit342f3cfe6f2b27ea62bd9883e16014c188276356 (patch)
tree7e7cb69c770a9f5b377fef36543bba409ff892a1
parent22fa80775b122810f65a894d30978238998e1cee (diff)
Avoid double-paste when pasting text into cell comment. (fdo#32572)
Original patch is from Caolan. I re-worked it to handle more use cases.
-rw-r--r--sc/source/ui/view/gridwin.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 0d32bae85..682682946 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -4298,6 +4298,26 @@ void ScGridWindow::PasteSelection( const Point& rPosPixel )
SCsROW nPosY;
pViewData->GetPosFromPixel( rPosPixel.X(), rPosPixel.Y(), eWhich, nPosX, nPosY );
+ // If the mouse down was inside a visible note window, ignore it and
+ // leave it up to the ScPostIt to handle it
+ SdrView* pDrawView = pViewData->GetViewShell()->GetSdrView();
+ if (pDrawView)
+ {
+ ULONG nCount = pDrawView->GetMarkedObjectCount();
+ for (ULONG i = 0; i < nCount; ++i)
+ {
+ SdrObject* pObj = pDrawView->GetMarkedObjectByIndex(i);
+ if (pObj && ScDrawLayer::IsNoteCaption(pObj))
+ {
+ if (pObj->GetLogicRect().IsInside(aLogicPos))
+ {
+ // Inside an active note object. Bail out.
+ return;
+ }
+ }
+ }
+ }
+
ScSelectionTransferObj* pOwnSelection = SC_MOD()->GetSelectionTransfer();
if ( pOwnSelection )
{