15b190011SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 35b190011SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 45b190011SAndrew Rist * or more contributor license agreements. See the NOTICE file 55b190011SAndrew Rist * distributed with this work for additional information 65b190011SAndrew Rist * regarding copyright ownership. The ASF licenses this file 75b190011SAndrew Rist * to you under the Apache License, Version 2.0 (the 85b190011SAndrew Rist * "License"); you may not use this file except in compliance 95b190011SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 115b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 135b190011SAndrew Rist * Unless required by applicable law or agreed to in writing, 145b190011SAndrew Rist * software distributed under the License is distributed on an 155b190011SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 165b190011SAndrew Rist * KIND, either express or implied. See the License for the 175b190011SAndrew Rist * specific language governing permissions and limitations 185b190011SAndrew Rist * under the License. 19cdf0e10cSrcweir * 205b190011SAndrew Rist *************************************************************/ 215b190011SAndrew Rist 225b190011SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sd.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawPagesSupplier.hpp> 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include "DrawViewShell.hxx" 30cdf0e10cSrcweir #include <vcl/msgbox.hxx> 31cdf0e10cSrcweir #include <svl/urlbmk.hxx> 32cdf0e10cSrcweir #include <svx/svdpagv.hxx> 33cdf0e10cSrcweir #include <svx/svdundo.hxx> 34cdf0e10cSrcweir #include <svx/fmglob.hxx> 35cdf0e10cSrcweir #include <editeng/eeitem.hxx> 36cdf0e10cSrcweir #ifndef _FLDITEM_HXX 37cdf0e10cSrcweir #include <editeng/flditem.hxx> 38cdf0e10cSrcweir #endif 39cdf0e10cSrcweir #ifndef _SVXIDS_HRC 40cdf0e10cSrcweir #include <svx/svxids.hrc> 41cdf0e10cSrcweir #endif 42cdf0e10cSrcweir #include <svx/ruler.hxx> 43cdf0e10cSrcweir #ifndef _GLOBL3D_HXX 44cdf0e10cSrcweir #include <svx/globl3d.hxx> 45cdf0e10cSrcweir #endif 46cdf0e10cSrcweir #include <editeng/outliner.hxx> 47cdf0e10cSrcweir #ifndef _SFX_CLIENTSH_HXX 48cdf0e10cSrcweir #include <sfx2/ipclient.hxx> 49cdf0e10cSrcweir #endif 50cdf0e10cSrcweir #include <sfx2/request.hxx> 51cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 52cdf0e10cSrcweir #include <svx/svdopath.hxx> 53cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 54cdf0e10cSrcweir #include <editeng/editview.hxx> 55cdf0e10cSrcweir #include <vcl/cursor.hxx> 56cdf0e10cSrcweir 57cdf0e10cSrcweir 58cdf0e10cSrcweir #include "app.hrc" 59cdf0e10cSrcweir #include "glob.hrc" 60cdf0e10cSrcweir #include "strings.hrc" 61cdf0e10cSrcweir #include "res_bmp.hrc" 62cdf0e10cSrcweir #include "DrawDocShell.hxx" 63cdf0e10cSrcweir #include "drawdoc.hxx" 64cdf0e10cSrcweir #include "Window.hxx" 65cdf0e10cSrcweir #include "fupoor.hxx" 66cdf0e10cSrcweir #include "fusnapln.hxx" 67cdf0e10cSrcweir #include "app.hxx" 68cdf0e10cSrcweir #include "Ruler.hxx" 69cdf0e10cSrcweir #include "sdresid.hxx" 70cdf0e10cSrcweir #include "GraphicViewShell.hxx" 71cdf0e10cSrcweir #include "sdpage.hxx" 72cdf0e10cSrcweir #include "slideshow.hxx" 73cdf0e10cSrcweir #include "anminfo.hxx" 74cdf0e10cSrcweir #include "sdpopup.hxx" 75cdf0e10cSrcweir #include "drawview.hxx" 76cdf0e10cSrcweir #include <svx/bmpmask.hxx> 77cdf0e10cSrcweir #include "LayerTabBar.hxx" 78cdf0e10cSrcweir 79cdf0e10cSrcweir // #97016# IV 80cdf0e10cSrcweir #include <svx/svditer.hxx> 81cdf0e10cSrcweir 820deba7fbSSteve Yin #include <navigatr.hxx> 83cdf0e10cSrcweir namespace sd { 84cdf0e10cSrcweir 85cdf0e10cSrcweir #define PIPETTE_RANGE 0 86cdf0e10cSrcweir 87cdf0e10cSrcweir #ifdef _MSC_VER 88cdf0e10cSrcweir #pragma optimize ( "", off ) 89cdf0e10cSrcweir #endif 90cdf0e10cSrcweir 91cdf0e10cSrcweir using namespace ::com::sun::star::uno; 92cdf0e10cSrcweir using namespace ::com::sun::star::drawing; 93cdf0e10cSrcweir 94cdf0e10cSrcweir /************************************************************************* 95cdf0e10cSrcweir |* 96cdf0e10cSrcweir |* aktuelle Seite loeschen 97cdf0e10cSrcweir |* 98cdf0e10cSrcweir \************************************************************************/ 99cdf0e10cSrcweir 100cdf0e10cSrcweir void DrawViewShell::DeleteActualPage() 101cdf0e10cSrcweir { 102cdf0e10cSrcweir sal_uInt16 nPage = maTabControl.GetCurPageId() - 1; 103cdf0e10cSrcweir 104cdf0e10cSrcweir mpDrawView->SdrEndTextEdit(); 105cdf0e10cSrcweir 106cdf0e10cSrcweir try 107cdf0e10cSrcweir { 108cdf0e10cSrcweir Reference<XDrawPagesSupplier> xDrawPagesSupplier( GetDoc()->getUnoModel(), UNO_QUERY_THROW ); 109cdf0e10cSrcweir Reference<XDrawPages> xPages( xDrawPagesSupplier->getDrawPages(), UNO_QUERY_THROW ); 110cdf0e10cSrcweir Reference< XDrawPage > xPage( xPages->getByIndex( nPage ), UNO_QUERY_THROW ); 111cdf0e10cSrcweir xPages->remove( xPage ); 112cdf0e10cSrcweir } 113cdf0e10cSrcweir catch( Exception& ) 114cdf0e10cSrcweir { 115cdf0e10cSrcweir DBG_ERROR("SelectionManager::DeleteSelectedMasterPages(), exception caught!"); 116cdf0e10cSrcweir } 117cdf0e10cSrcweir } 118cdf0e10cSrcweir 119cdf0e10cSrcweir /************************************************************************* 120cdf0e10cSrcweir |* 121cdf0e10cSrcweir |* aktuelle Ebene loeschen 122cdf0e10cSrcweir |* 123cdf0e10cSrcweir \************************************************************************/ 124cdf0e10cSrcweir 125cdf0e10cSrcweir void DrawViewShell::DeleteActualLayer() 126cdf0e10cSrcweir { 127*2d19362eSArmin Le Grand if(!GetLayerTabControl()) // #87182# 128*2d19362eSArmin Le Grand { 129*2d19362eSArmin Le Grand OSL_ENSURE(false, "No LayerTabBar (!)"); 130*2d19362eSArmin Le Grand return; 131*2d19362eSArmin Le Grand } 132*2d19362eSArmin Le Grand 133cdf0e10cSrcweir SdrLayerAdmin& rAdmin = GetDoc()->GetLayerAdmin(); 134cdf0e10cSrcweir const String& rName = GetLayerTabControl()->GetPageText(GetLayerTabControl()->GetCurPageId()); 135cdf0e10cSrcweir String aString(SdResId(STR_ASK_DELETE_LAYER)); 136cdf0e10cSrcweir 137cdf0e10cSrcweir // Platzhalter ersetzen 138cdf0e10cSrcweir sal_uInt16 nPos = aString.Search(sal_Unicode('$')); 139cdf0e10cSrcweir aString.Erase(nPos, 1); 140cdf0e10cSrcweir aString.Insert(rName, nPos); 141cdf0e10cSrcweir 142cdf0e10cSrcweir if (QueryBox(GetActiveWindow(), WB_YES_NO, aString).Execute() == RET_YES) 143cdf0e10cSrcweir { 144cdf0e10cSrcweir const SdrLayer* pLayer = rAdmin.GetLayer(rName, sal_False); 145cdf0e10cSrcweir mpDrawView->DeleteLayer( pLayer->GetName() ); 146cdf0e10cSrcweir 147cdf0e10cSrcweir // damit TabBar und Window neu gezeichnet werden; 148cdf0e10cSrcweir // sollte spaeter wie beim Aendern der Layerfolge durch einen 149cdf0e10cSrcweir // Hint von Joe angestossen werden 150cdf0e10cSrcweir // ( View::Notify() --> ViewShell::ResetActualLayer() ) 151cdf0e10cSrcweir 152cdf0e10cSrcweir mbIsLayerModeActive = false; // damit ChangeEditMode() ueberhaupt was tut 153cdf0e10cSrcweir ChangeEditMode(GetEditMode(), true); 154cdf0e10cSrcweir } 155cdf0e10cSrcweir } 156cdf0e10cSrcweir 157cdf0e10cSrcweir 158cdf0e10cSrcweir /************************************************************************* 159cdf0e10cSrcweir |* 160cdf0e10cSrcweir |* Keyboard event 161cdf0e10cSrcweir |* 162cdf0e10cSrcweir \************************************************************************/ 163cdf0e10cSrcweir 164cdf0e10cSrcweir sal_Bool DrawViewShell::KeyInput (const KeyEvent& rKEvt, ::sd::Window* pWin) 165cdf0e10cSrcweir { 166cdf0e10cSrcweir sal_Bool bRet = sal_False; 167cdf0e10cSrcweir 168cdf0e10cSrcweir if ( !IsInputLocked() || ( rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE ) ) 169cdf0e10cSrcweir { 170cdf0e10cSrcweir // #97016# IV 171cdf0e10cSrcweir if(KEY_RETURN == rKEvt.GetKeyCode().GetCode() 172cdf0e10cSrcweir && rKEvt.GetKeyCode().IsMod1() 173cdf0e10cSrcweir && GetView()->IsTextEdit()) 174cdf0e10cSrcweir { 175cdf0e10cSrcweir // this should be used for cursor travelling. 176cdf0e10cSrcweir SdPage* pActualPage = GetActualPage(); 177cdf0e10cSrcweir const SdrMarkList& rMarkList = GetView()->GetMarkedObjectList(); 178cdf0e10cSrcweir SdrTextObj* pCandidate = 0L; 179cdf0e10cSrcweir 180cdf0e10cSrcweir if(pActualPage && 1 == rMarkList.GetMarkCount()) 181cdf0e10cSrcweir { 182cdf0e10cSrcweir SdrMark* pMark = rMarkList.GetMark(0); 183cdf0e10cSrcweir 184cdf0e10cSrcweir // remember which object was the text in edit mode 185cdf0e10cSrcweir SdrObject* pOldObj = pMark->GetMarkedSdrObj(); 186cdf0e10cSrcweir 187cdf0e10cSrcweir // end text edit now 188cdf0e10cSrcweir GetView()->SdrEndTextEdit(); 189cdf0e10cSrcweir 190cdf0e10cSrcweir // look for a new candidate, a successor of pOldObj 191cdf0e10cSrcweir SdrObjListIter aIter(*pActualPage, IM_DEEPNOGROUPS); 192cdf0e10cSrcweir sal_Bool bDidVisitOldObject(sal_False); 193cdf0e10cSrcweir 194cdf0e10cSrcweir while(aIter.IsMore() && !pCandidate) 195cdf0e10cSrcweir { 196cdf0e10cSrcweir SdrObject* pObj = aIter.Next(); 197cdf0e10cSrcweir 198cdf0e10cSrcweir if(pObj && pObj->ISA(SdrTextObj)) 199cdf0e10cSrcweir { 200cdf0e10cSrcweir sal_uInt32 nInv(pObj->GetObjInventor()); 201cdf0e10cSrcweir sal_uInt16 nKnd(pObj->GetObjIdentifier()); 202cdf0e10cSrcweir 203cdf0e10cSrcweir if(SdrInventor == nInv && 204cdf0e10cSrcweir (OBJ_TITLETEXT == nKnd || OBJ_OUTLINETEXT == nKnd || OBJ_TEXT == nKnd) 205cdf0e10cSrcweir && bDidVisitOldObject) 206cdf0e10cSrcweir { 207cdf0e10cSrcweir pCandidate = (SdrTextObj*)pObj; 208cdf0e10cSrcweir } 209cdf0e10cSrcweir 210cdf0e10cSrcweir if(pObj == pOldObj) 211cdf0e10cSrcweir { 212cdf0e10cSrcweir bDidVisitOldObject = sal_True; 213cdf0e10cSrcweir } 214cdf0e10cSrcweir } 215cdf0e10cSrcweir } 216cdf0e10cSrcweir } 217cdf0e10cSrcweir 218cdf0e10cSrcweir if(pCandidate) 219cdf0e10cSrcweir { 220cdf0e10cSrcweir // set the new candidate to text edit mode 221cdf0e10cSrcweir GetView()->UnMarkAll(); 222cdf0e10cSrcweir GetView()->MarkObj(pCandidate, GetView()->GetSdrPageView()); 223cdf0e10cSrcweir 224cdf0e10cSrcweir GetViewFrame()->GetDispatcher()->Execute( 225cdf0e10cSrcweir SID_ATTR_CHAR, SFX_CALLMODE_ASYNCHRON); 226cdf0e10cSrcweir } 227cdf0e10cSrcweir else 228cdf0e10cSrcweir { 229cdf0e10cSrcweir // insert a new page with the same page layout 230cdf0e10cSrcweir GetViewFrame()->GetDispatcher()->Execute( 231cdf0e10cSrcweir SID_INSERTPAGE_QUICK, SFX_CALLMODE_ASYNCHRON); 232cdf0e10cSrcweir } 233cdf0e10cSrcweir } 234cdf0e10cSrcweir else 235cdf0e10cSrcweir { 236cdf0e10cSrcweir bRet = ViewShell::KeyInput(rKEvt, pWin); 2370deba7fbSSteve Yin //Solution: If object is marked , the corresponding entry is set true , 2380deba7fbSSteve Yin //else the corresponding entry is set false . 2390deba7fbSSteve Yin if(KEY_TAB == rKEvt.GetKeyCode().GetCode()) 2400deba7fbSSteve Yin { 2410deba7fbSSteve Yin FreshNavigatrTree(); 2420deba7fbSSteve Yin } 243cdf0e10cSrcweir } 244cdf0e10cSrcweir } 245cdf0e10cSrcweir 246cdf0e10cSrcweir return bRet; 247cdf0e10cSrcweir } 248cdf0e10cSrcweir 249cdf0e10cSrcweir /************************************************************************* 250cdf0e10cSrcweir |* 251cdf0e10cSrcweir |* Vom Lineal ausgehenden Drag (Hilflinien, Ursprung) beginnen 252cdf0e10cSrcweir |* 253cdf0e10cSrcweir \************************************************************************/ 254cdf0e10cSrcweir 255cdf0e10cSrcweir void DrawViewShell::StartRulerDrag ( 256cdf0e10cSrcweir const Ruler& rRuler, 257cdf0e10cSrcweir const MouseEvent& rMEvt) 258cdf0e10cSrcweir { 259cdf0e10cSrcweir GetActiveWindow()->CaptureMouse(); 260cdf0e10cSrcweir 261cdf0e10cSrcweir Point aWPos = GetActiveWindow()->PixelToLogic(GetActiveWindow()->GetPointerPosPixel()); 262cdf0e10cSrcweir 263cdf0e10cSrcweir if ( rRuler.GetExtraRect().IsInside(rMEvt.GetPosPixel()) ) 264cdf0e10cSrcweir { 265cdf0e10cSrcweir mpDrawView->BegSetPageOrg(aWPos); 266cdf0e10cSrcweir mbIsRulerDrag = sal_True; 267cdf0e10cSrcweir } 268cdf0e10cSrcweir else 269cdf0e10cSrcweir { 270cdf0e10cSrcweir // #i34536# if no guide-lines are visible yet, that show them 271cdf0e10cSrcweir if( ! mpDrawView->IsHlplVisible()) 272cdf0e10cSrcweir mpDrawView->SetHlplVisible( sal_True ); 273cdf0e10cSrcweir 274cdf0e10cSrcweir SdrHelpLineKind eKind; 275cdf0e10cSrcweir 276cdf0e10cSrcweir if ( rMEvt.IsMod1() ) 277cdf0e10cSrcweir eKind = SDRHELPLINE_POINT; 278cdf0e10cSrcweir else if ( rRuler.IsHorizontal() ) 279cdf0e10cSrcweir eKind = SDRHELPLINE_HORIZONTAL; 280cdf0e10cSrcweir else 281cdf0e10cSrcweir eKind = SDRHELPLINE_VERTICAL; 282cdf0e10cSrcweir 283cdf0e10cSrcweir mpDrawView->BegDragHelpLine(aWPos, eKind); 284cdf0e10cSrcweir mbIsRulerDrag = sal_True; 285cdf0e10cSrcweir } 286cdf0e10cSrcweir } 2870deba7fbSSteve Yin //Solution: If object is marked , the corresponding entry is set true , 2880deba7fbSSteve Yin //else the corresponding entry is set false . 2890deba7fbSSteve Yin void DrawViewShell::FreshNavigatrEntry() 2900deba7fbSSteve Yin { 2910deba7fbSSteve Yin sal_uInt16 nId = SID_NAVIGATOR; 2920deba7fbSSteve Yin SfxChildWindow* pWindow = GetViewFrame()->GetChildWindow( nId ); 2930deba7fbSSteve Yin if( pWindow ) 2940deba7fbSSteve Yin { 2950deba7fbSSteve Yin SdNavigatorWin* pNavWin = (SdNavigatorWin*)( pWindow->GetContextWindow( SD_MOD() ) ); 2960deba7fbSSteve Yin if( pNavWin ) 2970deba7fbSSteve Yin pNavWin->FreshEntry(); 2980deba7fbSSteve Yin } 2990deba7fbSSteve Yin } 300cdf0e10cSrcweir 3010deba7fbSSteve Yin void DrawViewShell::FreshNavigatrTree() 3020deba7fbSSteve Yin { 3030deba7fbSSteve Yin sal_uInt16 nId = SID_NAVIGATOR; 3040deba7fbSSteve Yin SfxChildWindow* pWindow = GetViewFrame()->GetChildWindow( nId ); 3050deba7fbSSteve Yin if( pWindow ) 3060deba7fbSSteve Yin { 3070deba7fbSSteve Yin SdNavigatorWin* pNavWin = (SdNavigatorWin*)( pWindow->GetContextWindow( SD_MOD() ) ); 3080deba7fbSSteve Yin if( pNavWin ) 3090deba7fbSSteve Yin pNavWin->FreshTree( GetDoc() ); 3100deba7fbSSteve Yin } 3110deba7fbSSteve Yin } 312cdf0e10cSrcweir /************************************************************************* 313cdf0e10cSrcweir |* 314cdf0e10cSrcweir |* MouseButtonDown event 315cdf0e10cSrcweir |* 316cdf0e10cSrcweir \************************************************************************/ 317cdf0e10cSrcweir 318cdf0e10cSrcweir void DrawViewShell::MouseButtonDown(const MouseEvent& rMEvt, 319cdf0e10cSrcweir ::sd::Window* pWin) 320cdf0e10cSrcweir { 321cdf0e10cSrcweir // We have to check if a context menu is shown and we have an UI 322cdf0e10cSrcweir // active inplace client. In that case we have to ignore the mouse 323cdf0e10cSrcweir // button down event. Otherwise we would crash (context menu has been 324cdf0e10cSrcweir // opened by inplace client and we would deactivate the inplace client, 325cdf0e10cSrcweir // the contex menu is closed by VCL asynchronously which in the end 326cdf0e10cSrcweir // would work on deleted objects or the context menu has no parent anymore) 327cdf0e10cSrcweir // See #126086# and #128122# 328cdf0e10cSrcweir SfxInPlaceClient* pIPClient = GetViewShell()->GetIPClient(); 329cdf0e10cSrcweir sal_Bool bIsOleActive = ( pIPClient && pIPClient->IsObjectInPlaceActive() ); 330cdf0e10cSrcweir 331cdf0e10cSrcweir if ( bIsOleActive && PopupMenu::IsInExecute() ) 332cdf0e10cSrcweir return; 333cdf0e10cSrcweir 334cdf0e10cSrcweir if ( !IsInputLocked() ) 335cdf0e10cSrcweir { 336cdf0e10cSrcweir ViewShell::MouseButtonDown(rMEvt, pWin); 337cdf0e10cSrcweir 3380deba7fbSSteve Yin //Solution: If object is marked , the corresponding entry is set true , 3390deba7fbSSteve Yin //else the corresponding entry is set false . 3400deba7fbSSteve Yin FreshNavigatrTree(); 341cdf0e10cSrcweir if ( mbPipette ) 342cdf0e10cSrcweir ( (SvxBmpMask*) GetViewFrame()->GetChildWindow( SvxBmpMaskChildWindow::GetChildWindowId() )->GetWindow() )->PipetteClicked(); 343cdf0e10cSrcweir } 344cdf0e10cSrcweir } 345cdf0e10cSrcweir 346cdf0e10cSrcweir /************************************************************************* 347cdf0e10cSrcweir |* 348cdf0e10cSrcweir |* MouseMove event 349cdf0e10cSrcweir |* 350cdf0e10cSrcweir \************************************************************************/ 351cdf0e10cSrcweir 352cdf0e10cSrcweir 353cdf0e10cSrcweir void DrawViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin) 354cdf0e10cSrcweir { 355cdf0e10cSrcweir if ( !IsInputLocked() ) 356cdf0e10cSrcweir { 357cdf0e10cSrcweir if ( mpDrawView->IsAction() ) 358cdf0e10cSrcweir { 359cdf0e10cSrcweir Rectangle aOutputArea(Point(0,0), GetActiveWindow()->GetOutputSizePixel()); 360cdf0e10cSrcweir 361cdf0e10cSrcweir if ( !aOutputArea.IsInside(rMEvt.GetPosPixel()) ) 362cdf0e10cSrcweir { 363cdf0e10cSrcweir sal_Bool bInsideOtherWindow = sal_False; 364cdf0e10cSrcweir 365cdf0e10cSrcweir if (mpContentWindow.get() != NULL) 366cdf0e10cSrcweir { 367cdf0e10cSrcweir aOutputArea = Rectangle(Point(0,0), 368cdf0e10cSrcweir mpContentWindow->GetOutputSizePixel()); 369cdf0e10cSrcweir 370cdf0e10cSrcweir Point aPos = mpContentWindow->GetPointerPosPixel(); 371cdf0e10cSrcweir if ( aOutputArea.IsInside(aPos) ) 372cdf0e10cSrcweir bInsideOtherWindow = sal_True; 373cdf0e10cSrcweir } 374cdf0e10cSrcweir 375cdf0e10cSrcweir if (! GetActiveWindow()->HasFocus ()) 376cdf0e10cSrcweir { 377cdf0e10cSrcweir GetActiveWindow()->ReleaseMouse (); 378cdf0e10cSrcweir mpDrawView->BrkAction (); 379cdf0e10cSrcweir return; 380cdf0e10cSrcweir } 381cdf0e10cSrcweir else if ( bInsideOtherWindow ) 382cdf0e10cSrcweir { 383cdf0e10cSrcweir GetActiveWindow()->ReleaseMouse(); 384cdf0e10cSrcweir pWin->CaptureMouse (); 385cdf0e10cSrcweir } 386cdf0e10cSrcweir } 387cdf0e10cSrcweir else if ( pWin != GetActiveWindow() ) 388cdf0e10cSrcweir pWin->CaptureMouse(); 389cdf0e10cSrcweir } 390cdf0e10cSrcweir 391cdf0e10cSrcweir // #109585# 392cdf0e10cSrcweir // Since the next MouseMove may execute a IsSolidDraggingNow() in 393cdf0e10cSrcweir // SdrCreateView::MovCreateObj and there the ApplicationBackgroundColor 394cdf0e10cSrcweir // is needed it is necessary to set it here. 395cdf0e10cSrcweir if(mpDrawView!=NULL && GetDoc()!=NULL) 396cdf0e10cSrcweir { 397cdf0e10cSrcweir svtools::ColorConfig aColorConfig; 398cdf0e10cSrcweir Color aFillColor; 399cdf0e10cSrcweir 400cdf0e10cSrcweir if(DOCUMENT_TYPE_IMPRESS == GetDoc()->GetDocumentType()) 401cdf0e10cSrcweir { 402cdf0e10cSrcweir aFillColor = Color( aColorConfig.GetColorValue( svtools::APPBACKGROUND ).nColor ); 403cdf0e10cSrcweir } 404cdf0e10cSrcweir else 405cdf0e10cSrcweir { 406cdf0e10cSrcweir aFillColor = Color( aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor ); 407cdf0e10cSrcweir } 408cdf0e10cSrcweir 409cdf0e10cSrcweir mpDrawView->SetApplicationBackgroundColor(aFillColor); 410cdf0e10cSrcweir } 411cdf0e10cSrcweir 412cdf0e10cSrcweir ViewShell::MouseMove(rMEvt, pWin); 413cdf0e10cSrcweir 414cdf0e10cSrcweir if( !mbMousePosFreezed ) 415cdf0e10cSrcweir maMousePos = rMEvt.GetPosPixel(); 416cdf0e10cSrcweir 417cdf0e10cSrcweir Rectangle aRect; 418cdf0e10cSrcweir 419cdf0e10cSrcweir if ( mbIsRulerDrag ) 420cdf0e10cSrcweir { 421cdf0e10cSrcweir Point aLogPos = GetActiveWindow()->PixelToLogic(maMousePos); 422cdf0e10cSrcweir mpDrawView->MovAction(aLogPos); 423cdf0e10cSrcweir } 424cdf0e10cSrcweir 425cdf0e10cSrcweir if ( mpDrawView->IsAction() ) 426cdf0e10cSrcweir { 427cdf0e10cSrcweir mpDrawView->TakeActionRect(aRect); 428cdf0e10cSrcweir aRect = GetActiveWindow()->LogicToPixel(aRect); 429cdf0e10cSrcweir } 430cdf0e10cSrcweir else 431cdf0e10cSrcweir { 432cdf0e10cSrcweir aRect = Rectangle(maMousePos, maMousePos); 433cdf0e10cSrcweir } 434cdf0e10cSrcweir 435cdf0e10cSrcweir ShowMousePosInfo(aRect, pWin); 436cdf0e10cSrcweir 437cdf0e10cSrcweir if ( mbPipette && GetViewFrame()->HasChildWindow( SvxBmpMaskChildWindow::GetChildWindowId() ) ) 438cdf0e10cSrcweir { 439cdf0e10cSrcweir const long nStartX = maMousePos.X() - PIPETTE_RANGE; 440cdf0e10cSrcweir const long nEndX = maMousePos.X() + PIPETTE_RANGE; 441cdf0e10cSrcweir const long nStartY = maMousePos.Y() - PIPETTE_RANGE; 442cdf0e10cSrcweir const long nEndY = maMousePos.Y() + PIPETTE_RANGE; 443cdf0e10cSrcweir long nRed = 0; 444cdf0e10cSrcweir long nGreen = 0; 445cdf0e10cSrcweir long nBlue = 0; 446cdf0e10cSrcweir const double fDiv = ( ( PIPETTE_RANGE << 1 ) + 1 ) * ( ( PIPETTE_RANGE << 1 ) + 1 ); 447cdf0e10cSrcweir 448cdf0e10cSrcweir for ( long nY = nStartY; nY <= nEndY; nY++ ) 449cdf0e10cSrcweir { 450cdf0e10cSrcweir for( long nX = nStartX; nX <= nEndX; nX++ ) 451cdf0e10cSrcweir { 452cdf0e10cSrcweir const Color aCol( pWin->GetPixel( pWin->PixelToLogic( Point( nX, nY ) ) ) ); 453cdf0e10cSrcweir 454cdf0e10cSrcweir nRed += aCol.GetRed(); 455cdf0e10cSrcweir nGreen += aCol.GetGreen(); 456cdf0e10cSrcweir nBlue += aCol.GetBlue(); 457cdf0e10cSrcweir } 458cdf0e10cSrcweir } 459cdf0e10cSrcweir 460cdf0e10cSrcweir ( (SvxBmpMask*) GetViewFrame()->GetChildWindow( SvxBmpMaskChildWindow::GetChildWindowId() )->GetWindow() )-> 461cdf0e10cSrcweir SetColor( Color( (sal_uInt8) ( nRed / fDiv + .5 ), 462cdf0e10cSrcweir (sal_uInt8) ( nGreen / fDiv + .5 ), 463cdf0e10cSrcweir (sal_uInt8) ( nBlue / fDiv + .5 ) ) ); 464cdf0e10cSrcweir } 465cdf0e10cSrcweir } 466cdf0e10cSrcweir } 467cdf0e10cSrcweir 468cdf0e10cSrcweir 469cdf0e10cSrcweir /************************************************************************* 470cdf0e10cSrcweir |* 471cdf0e10cSrcweir |* MouseButtonUp event 472cdf0e10cSrcweir |* 473cdf0e10cSrcweir \************************************************************************/ 474cdf0e10cSrcweir 475cdf0e10cSrcweir void DrawViewShell::MouseButtonUp(const MouseEvent& rMEvt, ::sd::Window* pWin) 476cdf0e10cSrcweir { 477cdf0e10cSrcweir if ( !IsInputLocked() ) 478cdf0e10cSrcweir { 479cdf0e10cSrcweir FASTBOOL bIsSetPageOrg = mpDrawView->IsSetPageOrg(); 480cdf0e10cSrcweir 481cdf0e10cSrcweir if (mbIsRulerDrag) 482cdf0e10cSrcweir { 483cdf0e10cSrcweir Rectangle aOutputArea(Point(0,0), GetActiveWindow()->GetOutputSizePixel()); 484cdf0e10cSrcweir 485cdf0e10cSrcweir if (aOutputArea.IsInside(rMEvt.GetPosPixel())) 486cdf0e10cSrcweir { 487cdf0e10cSrcweir mpDrawView->EndAction(); 488cdf0e10cSrcweir 489cdf0e10cSrcweir if (bIsSetPageOrg) 490cdf0e10cSrcweir GetViewFrame()->GetBindings().Invalidate(SID_RULER_NULL_OFFSET); 491cdf0e10cSrcweir } 492cdf0e10cSrcweir else if (rMEvt.IsLeft() && bIsSetPageOrg) 493cdf0e10cSrcweir { 494cdf0e10cSrcweir mpDrawView->BrkAction(); 495cdf0e10cSrcweir SdPage* pPage = (SdPage*) mpDrawView->GetSdrPageView()->GetPage(); 496cdf0e10cSrcweir Point aOrg(pPage->GetLftBorder(), pPage->GetUppBorder()); 497cdf0e10cSrcweir mpDrawView->GetSdrPageView()->SetPageOrigin(aOrg); 498cdf0e10cSrcweir GetViewFrame()->GetBindings().Invalidate(SID_RULER_NULL_OFFSET); 499cdf0e10cSrcweir } 500cdf0e10cSrcweir else 501cdf0e10cSrcweir { 502cdf0e10cSrcweir mpDrawView->BrkAction(); 503cdf0e10cSrcweir } 504cdf0e10cSrcweir 505cdf0e10cSrcweir GetActiveWindow()->ReleaseMouse(); 506cdf0e10cSrcweir mbIsRulerDrag = sal_False; 507cdf0e10cSrcweir } 508cdf0e10cSrcweir else 509cdf0e10cSrcweir ViewShell::MouseButtonUp(rMEvt, pWin); 5100deba7fbSSteve Yin //Solution: If object is marked , the corresponding entry is set true , 5110deba7fbSSteve Yin //else the corresponding entry is set false . 5120deba7fbSSteve Yin FreshNavigatrTree(); 513cdf0e10cSrcweir } 514cdf0e10cSrcweir } 515cdf0e10cSrcweir 516cdf0e10cSrcweir /************************************************************************* 517cdf0e10cSrcweir |* 518cdf0e10cSrcweir |* Command event 519cdf0e10cSrcweir |* 520cdf0e10cSrcweir \************************************************************************/ 521cdf0e10cSrcweir 522cdf0e10cSrcweir void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin) 523cdf0e10cSrcweir { 524cdf0e10cSrcweir // The command event is send to the window after a possible context 525cdf0e10cSrcweir // menu from an inplace client is closed. Now we have the chance to 526cdf0e10cSrcweir // deactivate the inplace client without any problem regarding parent 527cdf0e10cSrcweir // windows and code on the stack. 528cdf0e10cSrcweir // For more information, see #126086# and #128122# 529cdf0e10cSrcweir SfxInPlaceClient* pIPClient = GetViewShell()->GetIPClient(); 530cdf0e10cSrcweir sal_Bool bIsOleActive = ( pIPClient && pIPClient->IsObjectInPlaceActive() ); 531cdf0e10cSrcweir if ( bIsOleActive && ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )) 532cdf0e10cSrcweir { 533cdf0e10cSrcweir // Deactivate OLE object 534cdf0e10cSrcweir mpDrawView->UnmarkAll(); 535cdf0e10cSrcweir SelectionHasChanged(); 536cdf0e10cSrcweir return; 537cdf0e10cSrcweir } 538cdf0e10cSrcweir 539cdf0e10cSrcweir if ( !IsInputLocked() ) 540cdf0e10cSrcweir { 541cdf0e10cSrcweir if( GetView() &&GetView()->getSmartTags().Command(rCEvt) ) 542cdf0e10cSrcweir return; 543cdf0e10cSrcweir 544cdf0e10cSrcweir const bool bNativeShow (SlideShow::IsRunning(GetViewShellBase())); 545cdf0e10cSrcweir 546cdf0e10cSrcweir if( rCEvt.GetCommand() == COMMAND_PASTESELECTION && !bNativeShow ) 547cdf0e10cSrcweir { 548cdf0e10cSrcweir TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSelection( GetActiveWindow() ) ); 549cdf0e10cSrcweir 550cdf0e10cSrcweir if( aDataHelper.GetTransferable().is() ) 551cdf0e10cSrcweir { 552cdf0e10cSrcweir Point aPos; 553cdf0e10cSrcweir sal_Int8 nDnDAction = DND_ACTION_COPY; 554cdf0e10cSrcweir 555cdf0e10cSrcweir if( GetActiveWindow() ) 556cdf0e10cSrcweir aPos = GetActiveWindow()->PixelToLogic( rCEvt.GetMousePosPixel() ); 557cdf0e10cSrcweir 558cdf0e10cSrcweir if( !mpDrawView->InsertData( aDataHelper, aPos, nDnDAction, sal_False ) ) 559cdf0e10cSrcweir { 560cdf0e10cSrcweir INetBookmark aINetBookmark( aEmptyStr, aEmptyStr ); 561cdf0e10cSrcweir 562cdf0e10cSrcweir if( ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ) && 563cdf0e10cSrcweir aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, aINetBookmark ) ) || 564cdf0e10cSrcweir ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR ) && 565cdf0e10cSrcweir aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, aINetBookmark ) ) || 566cdf0e10cSrcweir ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR ) && 567cdf0e10cSrcweir aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, aINetBookmark ) ) ) 568cdf0e10cSrcweir { 569cdf0e10cSrcweir InsertURLField( aINetBookmark.GetURL(), aINetBookmark.GetDescription(), aEmptyStr, NULL ); 570cdf0e10cSrcweir } 571cdf0e10cSrcweir } 572cdf0e10cSrcweir } 573cdf0e10cSrcweir } 574cdf0e10cSrcweir else if( rCEvt.GetCommand() == COMMAND_CONTEXTMENU && !bNativeShow && 575cdf0e10cSrcweir pWin != NULL && !mpDrawView->IsAction() && !SD_MOD()->GetWaterCan() ) 576cdf0e10cSrcweir { 577cdf0e10cSrcweir sal_uInt16 nSdResId = 0; // ResourceID fuer Popup-Menue 578cdf0e10cSrcweir sal_Bool bGraphicShell = this->ISA(GraphicViewShell); 579cdf0e10cSrcweir 580cdf0e10cSrcweir // Ist ein Fangobjekt unter dem Mauszeiger? 581cdf0e10cSrcweir SdrPageView* pPV; 582cdf0e10cSrcweir Point aMPos = pWin->PixelToLogic( maMousePos ); 583cdf0e10cSrcweir sal_uInt16 nHitLog = (sal_uInt16) GetActiveWindow()->PixelToLogic( 584cdf0e10cSrcweir Size(FuPoor::HITPIX, 0 ) ).Width(); 585cdf0e10cSrcweir sal_uInt16 nHelpLine; 586cdf0e10cSrcweir // fuer Klebepunkt 587cdf0e10cSrcweir SdrObject* pObj = NULL; 588cdf0e10cSrcweir sal_uInt16 nPickId = 0; 589cdf0e10cSrcweir // fuer Feldbefehl 590cdf0e10cSrcweir OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView(); 591cdf0e10cSrcweir const SvxFieldItem* pFldItem = NULL; 592cdf0e10cSrcweir if( pOLV ) 593cdf0e10cSrcweir pFldItem = pOLV->GetFieldAtSelection(); 594cdf0e10cSrcweir //pFldItem = pOLV->GetFieldUnderMousePointer(); 595cdf0e10cSrcweir 596cdf0e10cSrcweir // Hilfslinie 597cdf0e10cSrcweir if ( mpDrawView->PickHelpLine( aMPos, nHitLog, *GetActiveWindow(), nHelpLine, pPV) ) 598cdf0e10cSrcweir { 599cdf0e10cSrcweir nSdResId = RID_DRAW_SNAPOBJECT_POPUP; 600cdf0e10cSrcweir ShowSnapLineContextMenu(*pPV, nHelpLine, rCEvt.GetMousePosPixel()); 601cdf0e10cSrcweir return; 602cdf0e10cSrcweir } 603cdf0e10cSrcweir // Klebepunkt unter dem Mauszeiger markiert? 604cdf0e10cSrcweir else if( mpDrawView->PickGluePoint( aMPos, pObj, nPickId, pPV ) && 605cdf0e10cSrcweir mpDrawView->IsGluePointMarked( pObj, nPickId ) ) 606cdf0e10cSrcweir { 607cdf0e10cSrcweir nSdResId = RID_DRAW_GLUEPOINT_POPUP; 608cdf0e10cSrcweir } 609cdf0e10cSrcweir // Feldbefehl ? 610cdf0e10cSrcweir else if( pFldItem && (pFldItem->GetField()->ISA( SvxDateField ) || 611cdf0e10cSrcweir pFldItem->GetField()->ISA( SvxExtTimeField ) || 612cdf0e10cSrcweir pFldItem->GetField()->ISA( SvxExtFileField ) || 613cdf0e10cSrcweir pFldItem->GetField()->ISA( SvxAuthorField ) ) ) 614cdf0e10cSrcweir { 615cdf0e10cSrcweir LanguageType eLanguage( LANGUAGE_SYSTEM ); 616cdf0e10cSrcweir 617cdf0e10cSrcweir // #101743# Format popup with outliner language, if possible 618cdf0e10cSrcweir if( pOLV->GetOutliner() ) 619cdf0e10cSrcweir { 620cdf0e10cSrcweir ESelection aSelection( pOLV->GetSelection() ); 621cdf0e10cSrcweir eLanguage = pOLV->GetOutliner()->GetLanguage( aSelection.nStartPara, aSelection.nStartPos ); 622cdf0e10cSrcweir } 623cdf0e10cSrcweir 624cdf0e10cSrcweir SdFieldPopup aFieldPopup( pFldItem->GetField(), eLanguage ); 625cdf0e10cSrcweir 626cdf0e10cSrcweir if ( rCEvt.IsMouseEvent() ) 627cdf0e10cSrcweir aMPos = rCEvt.GetMousePosPixel(); 628cdf0e10cSrcweir else 629cdf0e10cSrcweir aMPos = Point( 20, 20 ); 630cdf0e10cSrcweir aFieldPopup.Execute( pWin, aMPos ); 631cdf0e10cSrcweir 632cdf0e10cSrcweir SvxFieldData* pField = aFieldPopup.GetField(); 633cdf0e10cSrcweir if( pField ) 634cdf0e10cSrcweir { 635cdf0e10cSrcweir SvxFieldItem aFieldItem( *pField, EE_FEATURE_FIELD ); 636cdf0e10cSrcweir //pOLV->DeleteSelected(); <-- fehlt leider ! 637cdf0e10cSrcweir // Feld selektieren, so dass es beim Insert geloescht wird 638cdf0e10cSrcweir ESelection aSel = pOLV->GetSelection(); 639cdf0e10cSrcweir sal_Bool bSel = sal_True; 640cdf0e10cSrcweir if( aSel.nStartPos == aSel.nEndPos ) 641cdf0e10cSrcweir { 642cdf0e10cSrcweir bSel = sal_False; 643cdf0e10cSrcweir aSel.nEndPos++; 644cdf0e10cSrcweir } 645cdf0e10cSrcweir pOLV->SetSelection( aSel ); 646cdf0e10cSrcweir 647cdf0e10cSrcweir pOLV->InsertField( aFieldItem ); 648cdf0e10cSrcweir 649cdf0e10cSrcweir // Selektion wird wieder in den Ursprungszustand gebracht 650cdf0e10cSrcweir if( !bSel ) 651cdf0e10cSrcweir aSel.nEndPos--; 652cdf0e10cSrcweir pOLV->SetSelection( aSel ); 653cdf0e10cSrcweir 654cdf0e10cSrcweir delete pField; 655cdf0e10cSrcweir } 656cdf0e10cSrcweir } 657cdf0e10cSrcweir else 658cdf0e10cSrcweir { 659cdf0e10cSrcweir // ist etwas selektiert? 660cdf0e10cSrcweir if (mpDrawView->AreObjectsMarked() && 661cdf0e10cSrcweir mpDrawView->GetMarkedObjectList().GetMarkCount() == 1 ) 662cdf0e10cSrcweir { 663cdf0e10cSrcweir pObj = mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); 664cdf0e10cSrcweir if( HasCurrentFunction(SID_BEZIER_EDIT) && (dynamic_cast< SdrPathObj * >( pObj ) != 0 ) ) 665cdf0e10cSrcweir { 666cdf0e10cSrcweir nSdResId = RID_BEZIER_POPUP; 667cdf0e10cSrcweir } 668cdf0e10cSrcweir else 669cdf0e10cSrcweir { 670cdf0e10cSrcweir if( mpDrawView->GetTextEditObject() ) 671cdf0e10cSrcweir { 672cdf0e10cSrcweir OutlinerView* pOutlinerView = mpDrawView->GetTextEditOutlinerView(); 673cdf0e10cSrcweir Point aPos(rCEvt.GetMousePosPixel()); 674cdf0e10cSrcweir 675cdf0e10cSrcweir if ( pOutlinerView ) 676cdf0e10cSrcweir { 677cdf0e10cSrcweir if( ( rCEvt.IsMouseEvent() && pOutlinerView->IsWrongSpelledWordAtPos(aPos) ) || 678cdf0e10cSrcweir ( !rCEvt.IsMouseEvent() && pOutlinerView->IsCursorAtWrongSpelledWord() ) ) 679cdf0e10cSrcweir { 680cdf0e10cSrcweir // #91457# Popup for Online-Spelling now handled by DrawDocShell 681cdf0e10cSrcweir // Link aLink = LINK(GetDoc(), SdDrawDocument, OnlineSpellCallback); 682cdf0e10cSrcweir Link aLink = LINK(GetDocSh(), DrawDocShell, OnlineSpellCallback); 683cdf0e10cSrcweir 684cdf0e10cSrcweir if( !rCEvt.IsMouseEvent() ) 685cdf0e10cSrcweir { 686cdf0e10cSrcweir aPos = GetActiveWindow()->LogicToPixel( pOutlinerView->GetEditView().GetCursor()->GetPos() ); 687cdf0e10cSrcweir } 688cdf0e10cSrcweir // While showing the spell context menu 689cdf0e10cSrcweir // we lock the input so that another 690cdf0e10cSrcweir // context menu can not be opened during 691cdf0e10cSrcweir // that time (crash #i43235#). In order 692cdf0e10cSrcweir // to not lock the UI completely we 693cdf0e10cSrcweir // first release the mouse. 694cdf0e10cSrcweir GetActiveWindow()->ReleaseMouse(); 695cdf0e10cSrcweir LockInput(); 696cdf0e10cSrcweir pOutlinerView->ExecuteSpellPopup(aPos, &aLink); 697cdf0e10cSrcweir UnlockInput(); 698cdf0e10cSrcweir } 699cdf0e10cSrcweir else 700cdf0e10cSrcweir { 701cdf0e10cSrcweir if( (pObj->GetObjInventor() == SdrInventor) && (pObj->GetObjIdentifier() == OBJ_TABLE) ) 702cdf0e10cSrcweir { 703cdf0e10cSrcweir nSdResId = RID_DRAW_TABLEOBJ_INSIDE_POPUP; 704cdf0e10cSrcweir } 705cdf0e10cSrcweir else 706cdf0e10cSrcweir { 707cdf0e10cSrcweir nSdResId = RID_DRAW_TEXTOBJ_INSIDE_POPUP; 708cdf0e10cSrcweir } 709cdf0e10cSrcweir } 710cdf0e10cSrcweir } 711cdf0e10cSrcweir } 712cdf0e10cSrcweir else 713cdf0e10cSrcweir { 714cdf0e10cSrcweir sal_uInt32 nInv = pObj->GetObjInventor(); 715cdf0e10cSrcweir sal_uInt16 nId = pObj->GetObjIdentifier(); 716cdf0e10cSrcweir 717cdf0e10cSrcweir if (nInv == SdrInventor) 718cdf0e10cSrcweir { 719cdf0e10cSrcweir switch ( nId ) 720cdf0e10cSrcweir { 721cdf0e10cSrcweir case OBJ_CAPTION: 722cdf0e10cSrcweir case OBJ_TITLETEXT: 723cdf0e10cSrcweir case OBJ_OUTLINETEXT: 724cdf0e10cSrcweir case OBJ_TEXT: 725cdf0e10cSrcweir nSdResId = bGraphicShell ? RID_GRAPHIC_TEXTOBJ_POPUP : 726cdf0e10cSrcweir RID_DRAW_TEXTOBJ_POPUP; 727cdf0e10cSrcweir break; 728cdf0e10cSrcweir 729cdf0e10cSrcweir case OBJ_PATHLINE: 730cdf0e10cSrcweir case OBJ_PLIN: 731cdf0e10cSrcweir nSdResId = bGraphicShell ? RID_GRAPHIC_POLYLINEOBJ_POPUP : 732cdf0e10cSrcweir RID_DRAW_POLYLINEOBJ_POPUP; 733cdf0e10cSrcweir break; 734cdf0e10cSrcweir 735cdf0e10cSrcweir case OBJ_FREELINE: 736cdf0e10cSrcweir case OBJ_EDGE: // Connector 737cdf0e10cSrcweir nSdResId = bGraphicShell ? RID_GRAPHIC_EDGEOBJ_POPUP : 738cdf0e10cSrcweir RID_DRAW_EDGEOBJ_POPUP; 739cdf0e10cSrcweir break; 740cdf0e10cSrcweir 741cdf0e10cSrcweir case OBJ_LINE: 742cdf0e10cSrcweir nSdResId = bGraphicShell ? RID_GRAPHIC_LINEOBJ_POPUP : 743cdf0e10cSrcweir RID_DRAW_LINEOBJ_POPUP; 744cdf0e10cSrcweir break; 745cdf0e10cSrcweir 746cdf0e10cSrcweir case OBJ_MEASURE: 747cdf0e10cSrcweir nSdResId = bGraphicShell ? RID_GRAPHIC_MEASUREOBJ_POPUP : 748cdf0e10cSrcweir RID_DRAW_MEASUREOBJ_POPUP; 749cdf0e10cSrcweir break; 750cdf0e10cSrcweir 751cdf0e10cSrcweir case OBJ_RECT: 752cdf0e10cSrcweir case OBJ_CIRC: 753cdf0e10cSrcweir case OBJ_FREEFILL: 754cdf0e10cSrcweir case OBJ_PATHFILL: 755cdf0e10cSrcweir case OBJ_POLY: 756cdf0e10cSrcweir case OBJ_SECT: 757cdf0e10cSrcweir case OBJ_CARC: 758cdf0e10cSrcweir case OBJ_CCUT: 759cdf0e10cSrcweir nSdResId = bGraphicShell ? RID_GRAPHIC_GEOMOBJ_POPUP : 760cdf0e10cSrcweir RID_DRAW_GEOMOBJ_POPUP; 761cdf0e10cSrcweir break; 762cdf0e10cSrcweir 763cdf0e10cSrcweir case OBJ_CUSTOMSHAPE: 764cdf0e10cSrcweir nSdResId = bGraphicShell ? RID_GRAPHIC_CUSTOMSHAPE_POPUP : 765cdf0e10cSrcweir RID_DRAW_CUSTOMSHAPE_POPUP; 766cdf0e10cSrcweir break; 767cdf0e10cSrcweir 768cdf0e10cSrcweir case OBJ_GRUP: 769cdf0e10cSrcweir nSdResId = bGraphicShell ? RID_GRAPHIC_GROUPOBJ_POPUP : 770cdf0e10cSrcweir RID_DRAW_GROUPOBJ_POPUP; 771cdf0e10cSrcweir break; 772cdf0e10cSrcweir 773cdf0e10cSrcweir case OBJ_GRAF: 774cdf0e10cSrcweir nSdResId = bGraphicShell ? RID_GRAPHIC_GRAPHIC_POPUP : 775cdf0e10cSrcweir RID_DRAW_GRAPHIC_POPUP; 776cdf0e10cSrcweir break; 777cdf0e10cSrcweir 778cdf0e10cSrcweir case OBJ_OLE2: 779cdf0e10cSrcweir nSdResId = bGraphicShell ? RID_GRAPHIC_OLE2_POPUP : 780cdf0e10cSrcweir RID_DRAW_OLE2_POPUP; 781cdf0e10cSrcweir break; 782cdf0e10cSrcweir case OBJ_MEDIA: 783cdf0e10cSrcweir nSdResId = bGraphicShell ? RID_GRAPHIC_MEDIA_POPUP : 784cdf0e10cSrcweir RID_DRAW_MEDIA_POPUP; 785cdf0e10cSrcweir break; 786cdf0e10cSrcweir case OBJ_TABLE: 787cdf0e10cSrcweir nSdResId = bGraphicShell ? RID_GRAPHIC_TABLE_POPUP : 788cdf0e10cSrcweir RID_DRAW_TABLE_POPUP; 789cdf0e10cSrcweir break; 790cdf0e10cSrcweir } 791cdf0e10cSrcweir } 792cdf0e10cSrcweir else if( nInv == E3dInventor /*&& nId == E3D_POLYSCENE_ID*/) 793cdf0e10cSrcweir { 794cdf0e10cSrcweir if( nId == E3D_POLYSCENE_ID || nId == E3D_SCENE_ID ) 795cdf0e10cSrcweir { 796cdf0e10cSrcweir if( !mpDrawView->IsGroupEntered() ) 797cdf0e10cSrcweir nSdResId = bGraphicShell ? RID_GRAPHIC_3DSCENE_POPUP : 798cdf0e10cSrcweir RID_DRAW_3DSCENE_POPUP; 799cdf0e10cSrcweir else 800cdf0e10cSrcweir nSdResId = bGraphicShell ? RID_GRAPHIC_3DSCENE2_POPUP : 801cdf0e10cSrcweir RID_DRAW_3DSCENE2_POPUP; 802cdf0e10cSrcweir } 803cdf0e10cSrcweir else 804cdf0e10cSrcweir nSdResId = bGraphicShell ? RID_GRAPHIC_3DOBJ_POPUP : 805cdf0e10cSrcweir RID_DRAW_3DOBJ_POPUP; 806cdf0e10cSrcweir } 807cdf0e10cSrcweir else if( nInv == FmFormInventor ) 808cdf0e10cSrcweir { 809cdf0e10cSrcweir nSdResId = RID_FORM_CONTROL_POPUP; 810cdf0e10cSrcweir } 811cdf0e10cSrcweir } 812cdf0e10cSrcweir } 813cdf0e10cSrcweir } 814cdf0e10cSrcweir 815cdf0e10cSrcweir // Mehrfachselektion 816cdf0e10cSrcweir else if (mpDrawView->AreObjectsMarked() && 817cdf0e10cSrcweir mpDrawView->GetMarkedObjectList().GetMarkCount() > 1 ) 818cdf0e10cSrcweir { 819cdf0e10cSrcweir nSdResId = bGraphicShell ? RID_GRAPHIC_MULTISELECTION_POPUP : 820cdf0e10cSrcweir RID_DRAW_MULTISELECTION_POPUP; 821cdf0e10cSrcweir } 822cdf0e10cSrcweir 823cdf0e10cSrcweir // nichts selektiert 824cdf0e10cSrcweir else 825cdf0e10cSrcweir { 826cdf0e10cSrcweir nSdResId = bGraphicShell ? RID_GRAPHIC_NOSEL_POPUP : 827cdf0e10cSrcweir RID_DRAW_NOSEL_POPUP; 828cdf0e10cSrcweir } 829cdf0e10cSrcweir } 830cdf0e10cSrcweir // Popup-Menue anzeigen 831cdf0e10cSrcweir if (nSdResId) 832cdf0e10cSrcweir { 833cdf0e10cSrcweir GetActiveWindow()->ReleaseMouse(); 834cdf0e10cSrcweir 835cdf0e10cSrcweir if(rCEvt.IsMouseEvent()) 836cdf0e10cSrcweir GetViewFrame()->GetDispatcher()->ExecutePopup(SdResId(nSdResId)); 837cdf0e10cSrcweir else 838cdf0e10cSrcweir { 839cdf0e10cSrcweir //#106326# don't open contextmenu at mouse position if not opened via mouse 840cdf0e10cSrcweir 841cdf0e10cSrcweir //middle of the window if nothing is marked 842cdf0e10cSrcweir Point aMenuPos(GetActiveWindow()->GetSizePixel().Width()/2 843cdf0e10cSrcweir ,GetActiveWindow()->GetSizePixel().Height()/2); 844cdf0e10cSrcweir 845cdf0e10cSrcweir //middle of the bounding rect if something is marked 846cdf0e10cSrcweir if( mpDrawView->AreObjectsMarked() && mpDrawView->GetMarkedObjectList().GetMarkCount() >= 1 ) 847cdf0e10cSrcweir { 848cdf0e10cSrcweir Rectangle aMarkRect; 849cdf0e10cSrcweir mpDrawView->GetMarkedObjectList().TakeBoundRect(NULL,aMarkRect); 850cdf0e10cSrcweir aMenuPos = GetActiveWindow()->LogicToPixel( aMarkRect.Center() ); 851cdf0e10cSrcweir 852cdf0e10cSrcweir //move the point into the visible window area 853cdf0e10cSrcweir if( aMenuPos.X() < 0 ) 854cdf0e10cSrcweir aMenuPos.X() = 0; 855cdf0e10cSrcweir if( aMenuPos.Y() < 0 ) 856cdf0e10cSrcweir aMenuPos.Y() = 0; 857cdf0e10cSrcweir if( aMenuPos.X() > GetActiveWindow()->GetSizePixel().Width() ) 858cdf0e10cSrcweir aMenuPos.X() = GetActiveWindow()->GetSizePixel().Width(); 859cdf0e10cSrcweir if( aMenuPos.Y() > GetActiveWindow()->GetSizePixel().Height() ) 860cdf0e10cSrcweir aMenuPos.Y() = GetActiveWindow()->GetSizePixel().Height(); 861cdf0e10cSrcweir } 862cdf0e10cSrcweir 863cdf0e10cSrcweir //open context menu at that point 864cdf0e10cSrcweir GetViewFrame()->GetDispatcher()->ExecutePopup(SdResId(nSdResId),GetActiveWindow(),&aMenuPos); 865cdf0e10cSrcweir } 866cdf0e10cSrcweir mbMousePosFreezed = sal_False; 867cdf0e10cSrcweir } 868cdf0e10cSrcweir } 869cdf0e10cSrcweir else 870cdf0e10cSrcweir { 871cdf0e10cSrcweir ViewShell::Command(rCEvt, pWin); 872cdf0e10cSrcweir } 873cdf0e10cSrcweir } 874cdf0e10cSrcweir } 875cdf0e10cSrcweir 876cdf0e10cSrcweir /************************************************************************* 877cdf0e10cSrcweir |* 878cdf0e10cSrcweir |* Linealmarkierungen anzeigen 879cdf0e10cSrcweir |* 880cdf0e10cSrcweir \************************************************************************/ 881cdf0e10cSrcweir 882cdf0e10cSrcweir void DrawViewShell::ShowMousePosInfo(const Rectangle& rRect, 883cdf0e10cSrcweir ::sd::Window* pWin) 884cdf0e10cSrcweir { 885cdf0e10cSrcweir if (mbHasRulers && pWin ) 886cdf0e10cSrcweir { 887cdf0e10cSrcweir RulerLine pHLines[2]; 888cdf0e10cSrcweir RulerLine pVLines[2]; 889cdf0e10cSrcweir long nHOffs = 0L; 890cdf0e10cSrcweir long nVOffs = 0L; 891cdf0e10cSrcweir sal_uInt16 nCnt; 892cdf0e10cSrcweir 893cdf0e10cSrcweir if (mpHorizontalRuler.get() != NULL) 894cdf0e10cSrcweir mpHorizontalRuler->SetLines(); 895cdf0e10cSrcweir 896cdf0e10cSrcweir if (mpVerticalRuler.get() != NULL) 897cdf0e10cSrcweir mpVerticalRuler->SetLines(); 898cdf0e10cSrcweir 899cdf0e10cSrcweir if (mpHorizontalRuler.get() != NULL) 900cdf0e10cSrcweir { 901cdf0e10cSrcweir nHOffs = mpHorizontalRuler->GetNullOffset() + 902cdf0e10cSrcweir mpHorizontalRuler->GetPageOffset(); 903cdf0e10cSrcweir } 904cdf0e10cSrcweir 905cdf0e10cSrcweir if (mpVerticalRuler.get() != NULL) 906cdf0e10cSrcweir { 907cdf0e10cSrcweir nVOffs = mpVerticalRuler->GetNullOffset() + 908cdf0e10cSrcweir mpVerticalRuler->GetPageOffset(); 909cdf0e10cSrcweir } 910cdf0e10cSrcweir 911cdf0e10cSrcweir nCnt = 1; 912cdf0e10cSrcweir pHLines[0].nPos = rRect.Left() - nHOffs; 913cdf0e10cSrcweir pVLines[0].nPos = rRect.Top() - nVOffs; 914cdf0e10cSrcweir pHLines[0].nStyle = 0; 915cdf0e10cSrcweir pVLines[0].nStyle = 0; 916cdf0e10cSrcweir 917cdf0e10cSrcweir if ( rRect.Right() != rRect.Left() || rRect.Bottom() != rRect.Top() ) 918cdf0e10cSrcweir { 919cdf0e10cSrcweir pHLines[1].nPos = rRect.Right() - nHOffs; 920cdf0e10cSrcweir pVLines[1].nPos = rRect.Bottom() - nVOffs; 921cdf0e10cSrcweir pHLines[1].nStyle = 0; 922cdf0e10cSrcweir pVLines[1].nStyle = 0; 923cdf0e10cSrcweir nCnt++; 924cdf0e10cSrcweir } 925cdf0e10cSrcweir 926cdf0e10cSrcweir if (mpHorizontalRuler.get() != NULL) 927cdf0e10cSrcweir mpHorizontalRuler->SetLines(nCnt, pHLines); 928cdf0e10cSrcweir if (mpVerticalRuler.get() != NULL) 929cdf0e10cSrcweir mpVerticalRuler->SetLines(nCnt, pVLines); 930cdf0e10cSrcweir } 931cdf0e10cSrcweir 932cdf0e10cSrcweir // StatusBar Koordinatenanzeige 933cdf0e10cSrcweir OSL_ASSERT (GetViewShell()!=NULL); 934cdf0e10cSrcweir if ( !GetViewShell()->GetUIActiveClient() ) 935cdf0e10cSrcweir { 936cdf0e10cSrcweir SfxItemSet aSet(GetPool(), SID_CONTEXT, SID_CONTEXT, 937cdf0e10cSrcweir SID_ATTR_POSITION, SID_ATTR_POSITION, 938cdf0e10cSrcweir SID_ATTR_SIZE, SID_ATTR_SIZE, 939cdf0e10cSrcweir 0L); 940cdf0e10cSrcweir 941cdf0e10cSrcweir // GetStatusBarState(aSet); nicht performant bei gedrueckter Modifiertaste!! 942cdf0e10cSrcweir 943cdf0e10cSrcweir aSet.Put( SfxStringItem( SID_CONTEXT, mpDrawView->GetStatusText() ) ); 944cdf0e10cSrcweir 945cdf0e10cSrcweir SfxBindings& rBindings = GetViewFrame()->GetBindings(); 946cdf0e10cSrcweir rBindings.SetState(aSet); 947cdf0e10cSrcweir rBindings.Invalidate(SID_CONTEXT); 948cdf0e10cSrcweir rBindings.Invalidate(SID_ATTR_POSITION); 949cdf0e10cSrcweir rBindings.Invalidate(SID_ATTR_SIZE); 950cdf0e10cSrcweir } 951cdf0e10cSrcweir } 952cdf0e10cSrcweir 953cdf0e10cSrcweir /************************************************************************* 954cdf0e10cSrcweir |* 955cdf0e10cSrcweir |* 956cdf0e10cSrcweir |* 957cdf0e10cSrcweir \************************************************************************/ 958cdf0e10cSrcweir 959cdf0e10cSrcweir void DrawViewShell::LockInput() 960cdf0e10cSrcweir { 961cdf0e10cSrcweir mnLockCount++; 962cdf0e10cSrcweir } 963cdf0e10cSrcweir 964cdf0e10cSrcweir /************************************************************************* 965cdf0e10cSrcweir |* 966cdf0e10cSrcweir |* 967cdf0e10cSrcweir |* 968cdf0e10cSrcweir \************************************************************************/ 969cdf0e10cSrcweir 970cdf0e10cSrcweir void DrawViewShell::UnlockInput() 971cdf0e10cSrcweir { 972cdf0e10cSrcweir DBG_ASSERT( mnLockCount, "Input for this shell is not locked!" ); 973cdf0e10cSrcweir if ( mnLockCount ) 974cdf0e10cSrcweir mnLockCount--; 975cdf0e10cSrcweir } 976cdf0e10cSrcweir 977cdf0e10cSrcweir 978cdf0e10cSrcweir 979cdf0e10cSrcweir 980cdf0e10cSrcweir void DrawViewShell::ShowSnapLineContextMenu ( 981cdf0e10cSrcweir SdrPageView& rPageView, 982cdf0e10cSrcweir const sal_uInt16 nSnapLineIndex, 983cdf0e10cSrcweir const Point& rMouseLocation) 984cdf0e10cSrcweir { 985cdf0e10cSrcweir const SdrHelpLine& rHelpLine (rPageView.GetHelpLines()[nSnapLineIndex]); 986cdf0e10cSrcweir ::boost::scoped_ptr<PopupMenu> pMenu (new PopupMenu ()); 987cdf0e10cSrcweir 988cdf0e10cSrcweir if (rHelpLine.GetKind() == SDRHELPLINE_POINT) 989cdf0e10cSrcweir { 990cdf0e10cSrcweir pMenu->InsertItem( 991cdf0e10cSrcweir SID_SET_SNAPITEM, 992cdf0e10cSrcweir String(SdResId(STR_POPUP_EDIT_SNAPPOINT))); 993cdf0e10cSrcweir pMenu->InsertSeparator(); 994cdf0e10cSrcweir pMenu->InsertItem( 995cdf0e10cSrcweir SID_DELETE_SNAPITEM, 996cdf0e10cSrcweir String(SdResId(STR_POPUP_DELETE_SNAPPOINT))); 997cdf0e10cSrcweir } 998cdf0e10cSrcweir else 999cdf0e10cSrcweir { 1000cdf0e10cSrcweir pMenu->InsertItem( 1001cdf0e10cSrcweir SID_SET_SNAPITEM, 1002cdf0e10cSrcweir String(SdResId(STR_POPUP_EDIT_SNAPLINE))); 1003cdf0e10cSrcweir pMenu->InsertSeparator(); 1004cdf0e10cSrcweir pMenu->InsertItem( 1005cdf0e10cSrcweir SID_DELETE_SNAPITEM, 1006cdf0e10cSrcweir String(SdResId(STR_POPUP_DELETE_SNAPLINE))); 1007cdf0e10cSrcweir } 1008cdf0e10cSrcweir 1009cdf0e10cSrcweir pMenu->RemoveDisabledEntries(sal_False, sal_False); 1010cdf0e10cSrcweir 1011cdf0e10cSrcweir const sal_uInt16 nResult = pMenu->Execute( 1012cdf0e10cSrcweir GetActiveWindow(), 1013cdf0e10cSrcweir Rectangle(rMouseLocation, Size(10,10)), 1014cdf0e10cSrcweir POPUPMENU_EXECUTE_DOWN); 1015cdf0e10cSrcweir switch (nResult) 1016cdf0e10cSrcweir { 1017cdf0e10cSrcweir case SID_SET_SNAPITEM: 1018cdf0e10cSrcweir { 1019cdf0e10cSrcweir SfxUInt32Item aHelpLineItem (ID_VAL_INDEX, nSnapLineIndex); 1020cdf0e10cSrcweir const SfxPoolItem* aArguments[] = {&aHelpLineItem, NULL}; 1021cdf0e10cSrcweir GetViewFrame()->GetDispatcher()->Execute( 1022cdf0e10cSrcweir SID_SET_SNAPITEM, 1023cdf0e10cSrcweir SFX_CALLMODE_SLOT, 1024cdf0e10cSrcweir aArguments); 1025cdf0e10cSrcweir } 1026cdf0e10cSrcweir break; 1027cdf0e10cSrcweir 1028cdf0e10cSrcweir case SID_DELETE_SNAPITEM: 1029cdf0e10cSrcweir { 1030cdf0e10cSrcweir rPageView.DeleteHelpLine(nSnapLineIndex); 1031cdf0e10cSrcweir } 1032cdf0e10cSrcweir break; 1033cdf0e10cSrcweir 1034cdf0e10cSrcweir default: 1035cdf0e10cSrcweir break; 1036cdf0e10cSrcweir } 1037cdf0e10cSrcweir } 1038cdf0e10cSrcweir 1039cdf0e10cSrcweir 1040cdf0e10cSrcweir 1041cdf0e10cSrcweir 1042cdf0e10cSrcweir #ifdef _MSC_VER 1043cdf0e10cSrcweir #pragma optimize ( "", on ) 1044cdf0e10cSrcweir #endif 1045cdf0e10cSrcweir 1046cdf0e10cSrcweir } // end of namespace sd 1047