diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2003-03-27 09:58:12 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2003-03-27 09:58:12 +0000 |
commit | 2c32696a04bc195c8ce61a0df6dcafb8c0c49fe0 (patch) | |
tree | 20f65f4b4d1a3a1c7c73f694210b3a07b6bea496 /sd/source/ui/view/drviews4.cxx | |
parent | #106612# do not close dialog on escape while in drag'n'drop (diff) | |
download | core-2c32696a04bc195c8ce61a0df6dcafb8c0c49fe0.tar.gz core-2c32696a04bc195c8ce61a0df6dcafb8c0c49fe0.zip |
MWS_SRX644: migrate branch mws_srx644 -> HEAD
Diffstat (limited to 'sd/source/ui/view/drviews4.cxx')
-rw-r--r-- | sd/source/ui/view/drviews4.cxx | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx index c51be6720d75..6a5d2dec3e16 100644 --- a/sd/source/ui/view/drviews4.cxx +++ b/sd/source/ui/view/drviews4.cxx @@ -2,9 +2,9 @@ * * $RCSfile: drviews4.cxx,v $ * - * $Revision: 1.13 $ + * $Revision: 1.14 $ * - * last change: $Author: thb $ $Date: 2002-07-26 09:50:47 $ + * last change: $Author: hr $ $Date: 2003-03-27 10:58:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -804,7 +804,38 @@ void SdDrawViewShell::Command(const CommandEvent& rCEvt, SdWindow* pWin) if (nSdResId) { pWindow->ReleaseMouse(); - GetViewFrame()->GetDispatcher()->ExecutePopup(SdResId(nSdResId)); + + if(rCEvt.IsMouseEvent()) + GetViewFrame()->GetDispatcher()->ExecutePopup(SdResId(nSdResId)); + else + { + //#106326# don't open contextmenu at mouse position if not opened via mouse + + //middle of the window if nothing is marked + Point aMenuPos(pWindow->GetSizePixel().Width()/2 + ,pWindow->GetSizePixel().Height()/2); + + //middle of the bounding rect if something is marked + if( pDrView->HasMarkedObj() && pDrView->GetMarkList().GetMarkCount() >= 1 ) + { + Rectangle aMarkRect; + pDrView->GetMarkList().TakeBoundRect(NULL,aMarkRect); + aMenuPos = pWindow->LogicToPixel( aMarkRect.Center() ); + + //move the point into the visible window area + if( aMenuPos.X() < 0 ) + aMenuPos.X() = 0; + if( aMenuPos.Y() < 0 ) + aMenuPos.Y() = 0; + if( aMenuPos.X() > pWindow->GetSizePixel().Width() ) + aMenuPos.X() = pWindow->GetSizePixel().Width(); + if( aMenuPos.Y() > pWindow->GetSizePixel().Height() ) + aMenuPos.Y() = pWindow->GetSizePixel().Height(); + } + + //open context menu at that point + GetViewFrame()->GetDispatcher()->ExecutePopup(SdResId(nSdResId),pWindow,&aMenuPos); + } bMousePosFreezed = FALSE; } } |