1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sd.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "DrawViewShell.hxx" 32*cdf0e10cSrcweir #include "ViewShellImplementation.hxx" 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir #ifndef _SVXIDS_HRC 35*cdf0e10cSrcweir #include <svx/svxids.hrc> 36*cdf0e10cSrcweir #endif 37*cdf0e10cSrcweir #ifndef _IMAPDLG_HXX 38*cdf0e10cSrcweir #include <svx/imapdlg.hxx> 39*cdf0e10cSrcweir #endif 40*cdf0e10cSrcweir #include <sfx2/request.hxx> 41*cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 42*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 43*cdf0e10cSrcweir #include <svx/svdograf.hxx> 44*cdf0e10cSrcweir #include <svx/svdoole2.hxx> 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir #include "app.hrc" 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir #include "drawdoc.hxx" 50*cdf0e10cSrcweir #include "slideshow.hxx" 51*cdf0e10cSrcweir #include "imapinfo.hxx" 52*cdf0e10cSrcweir #include "sdmod.hxx" 53*cdf0e10cSrcweir #include "optsitem.hxx" 54*cdf0e10cSrcweir #ifndef SD_FRAME_VIEW 55*cdf0e10cSrcweir #include "FrameView.hxx" 56*cdf0e10cSrcweir #endif 57*cdf0e10cSrcweir #include "drawview.hxx" 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir #include "fupoor.hxx" 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir namespace sd { 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir /************************************************************************* 64*cdf0e10cSrcweir |* 65*cdf0e10cSrcweir |* 66*cdf0e10cSrcweir |* 67*cdf0e10cSrcweir \************************************************************************/ 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir void DrawViewShell::ExecIMap( SfxRequest& rReq ) 70*cdf0e10cSrcweir { 71*cdf0e10cSrcweir // waehrend einer Diashow wird nichts ausgefuehrt! 72*cdf0e10cSrcweir if(HasCurrentFunction(SID_PRESENTATION) ) 73*cdf0e10cSrcweir return; 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir if ( rReq.GetSlot() == SID_IMAP_EXEC ) 76*cdf0e10cSrcweir { 77*cdf0e10cSrcweir SdrMark* pMark = mpDrawView->GetMarkedObjectList().GetMark(0); 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir if ( pMark ) 80*cdf0e10cSrcweir { 81*cdf0e10cSrcweir SdrObject* pSdrObj = pMark->GetMarkedSdrObj(); 82*cdf0e10cSrcweir SvxIMapDlg* pDlg = ViewShell::Implementation::GetImageMapDialog(); 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir if ( pDlg->GetEditingObject() == (void*) pSdrObj ) 85*cdf0e10cSrcweir { 86*cdf0e10cSrcweir const ImageMap& rImageMap = pDlg->GetImageMap(); 87*cdf0e10cSrcweir SdIMapInfo* pIMapInfo = GetDoc()->GetIMapInfo( pSdrObj ); 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir if ( !pIMapInfo ) 90*cdf0e10cSrcweir pSdrObj->InsertUserData( new SdIMapInfo( rImageMap ) ); 91*cdf0e10cSrcweir else 92*cdf0e10cSrcweir pIMapInfo->SetImageMap( rImageMap ); 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir GetDoc()->SetChanged( sal_True ); 95*cdf0e10cSrcweir } 96*cdf0e10cSrcweir } 97*cdf0e10cSrcweir } 98*cdf0e10cSrcweir } 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir /************************************************************************* 102*cdf0e10cSrcweir |* 103*cdf0e10cSrcweir |* 104*cdf0e10cSrcweir |* 105*cdf0e10cSrcweir \************************************************************************/ 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir void DrawViewShell::GetIMapState( SfxItemSet& rSet ) 108*cdf0e10cSrcweir { 109*cdf0e10cSrcweir sal_Bool bDisable = sal_True; 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir if( GetViewFrame()->HasChildWindow( SvxIMapDlgChildWindow::GetChildWindowId() ) ) 112*cdf0e10cSrcweir { 113*cdf0e10cSrcweir const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); 114*cdf0e10cSrcweir const SdrObject* pObj = NULL; 115*cdf0e10cSrcweir sal_uLong nMarkCount = rMarkList.GetMarkCount(); 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir if ( nMarkCount == 1 ) 118*cdf0e10cSrcweir { 119*cdf0e10cSrcweir pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj(); 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir SvxIMapDlg* pImageMapDialog = ViewShell::Implementation::GetImageMapDialog(); 122*cdf0e10cSrcweir if ( ( pObj->ISA( SdrGrafObj ) /*|| pObj->ISA( SdrOle2Obj )*/ ) 123*cdf0e10cSrcweir && pImageMapDialog!=NULL 124*cdf0e10cSrcweir && ( pImageMapDialog->GetEditingObject() == (void*) pObj ) ) 125*cdf0e10cSrcweir { 126*cdf0e10cSrcweir bDisable = sal_False; 127*cdf0e10cSrcweir } 128*cdf0e10cSrcweir } 129*cdf0e10cSrcweir } 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_IMAP_EXEC, bDisable ) ); 132*cdf0e10cSrcweir } 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir /************************************************************************* 135*cdf0e10cSrcweir |* 136*cdf0e10cSrcweir |* Execute-Methode der Optionsleiste 137*cdf0e10cSrcweir |* 138*cdf0e10cSrcweir \************************************************************************/ 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir void DrawViewShell::ExecOptionsBar( SfxRequest& rReq ) 141*cdf0e10cSrcweir { 142*cdf0e10cSrcweir // waehrend einer Diashow wird nichts ausgefuehrt! 143*cdf0e10cSrcweir if(HasCurrentFunction(SID_PRESENTATION)) 144*cdf0e10cSrcweir return; 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir sal_Bool bDefault = sal_False; 147*cdf0e10cSrcweir sal_uInt16 nSlot = rReq.GetSlot(); 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType()); 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir switch( nSlot ) 152*cdf0e10cSrcweir { 153*cdf0e10cSrcweir case SID_HANDLES_DRAFT: 154*cdf0e10cSrcweir pOptions->SetSolidMarkHdl( !mpDrawView->IsSolidMarkHdl() ); 155*cdf0e10cSrcweir break; 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir case SID_SOLID_CREATE: 158*cdf0e10cSrcweir pOptions->SetSolidDragging( !mpDrawView->IsSolidDragging() ); 159*cdf0e10cSrcweir break; 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir // Raster- / Hilfslinien-Optionen 163*cdf0e10cSrcweir case SID_GRID_VISIBLE: // noch nicht hier ! 164*cdf0e10cSrcweir { 165*cdf0e10cSrcweir pOptions->SetGridVisible( !mpDrawView->IsGridVisible() ); 166*cdf0e10cSrcweir } 167*cdf0e10cSrcweir break; 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir case SID_GRID_USE: 170*cdf0e10cSrcweir { 171*cdf0e10cSrcweir pOptions->SetUseGridSnap( !mpDrawView->IsGridSnap() ); 172*cdf0e10cSrcweir } 173*cdf0e10cSrcweir break; 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir case SID_HELPLINES_VISIBLE: // noch nicht hier ! 176*cdf0e10cSrcweir { 177*cdf0e10cSrcweir pOptions->SetHelplines( !mpDrawView->IsHlplVisible() ); 178*cdf0e10cSrcweir } 179*cdf0e10cSrcweir break; 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir case SID_HELPLINES_USE: 182*cdf0e10cSrcweir { 183*cdf0e10cSrcweir pOptions->SetSnapHelplines( !mpDrawView->IsHlplSnap() ); 184*cdf0e10cSrcweir } 185*cdf0e10cSrcweir break; 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir case SID_HELPLINES_MOVE: 188*cdf0e10cSrcweir { 189*cdf0e10cSrcweir pOptions->SetDragStripes( !mpDrawView->IsDragStripes() ); 190*cdf0e10cSrcweir } 191*cdf0e10cSrcweir break; 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir case SID_SNAP_BORDER: 195*cdf0e10cSrcweir { 196*cdf0e10cSrcweir pOptions->SetSnapBorder( !mpDrawView->IsBordSnap() ); 197*cdf0e10cSrcweir } 198*cdf0e10cSrcweir break; 199*cdf0e10cSrcweir 200*cdf0e10cSrcweir case SID_SNAP_FRAME: 201*cdf0e10cSrcweir { 202*cdf0e10cSrcweir pOptions->SetSnapFrame( !mpDrawView->IsOFrmSnap() ); 203*cdf0e10cSrcweir } 204*cdf0e10cSrcweir break; 205*cdf0e10cSrcweir 206*cdf0e10cSrcweir case SID_SNAP_POINTS: 207*cdf0e10cSrcweir { 208*cdf0e10cSrcweir pOptions->SetSnapPoints( !mpDrawView->IsOPntSnap() ); 209*cdf0e10cSrcweir } 210*cdf0e10cSrcweir break; 211*cdf0e10cSrcweir 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir case SID_QUICKEDIT: 214*cdf0e10cSrcweir { 215*cdf0e10cSrcweir pOptions->SetQuickEdit( !mpDrawView->IsQuickTextEditMode() ); 216*cdf0e10cSrcweir } 217*cdf0e10cSrcweir break; 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir case SID_PICK_THROUGH: 220*cdf0e10cSrcweir { 221*cdf0e10cSrcweir pOptions->SetPickThrough( 222*cdf0e10cSrcweir !mpDrawView->GetModel()->IsPickThroughTransparentTextFrames() ); 223*cdf0e10cSrcweir } 224*cdf0e10cSrcweir break; 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir case SID_BIG_HANDLES: 227*cdf0e10cSrcweir { 228*cdf0e10cSrcweir pOptions->SetBigHandles( !mpFrameView->IsBigHandles() ); 229*cdf0e10cSrcweir } 230*cdf0e10cSrcweir break; 231*cdf0e10cSrcweir 232*cdf0e10cSrcweir case SID_DOUBLECLICK_TEXTEDIT: 233*cdf0e10cSrcweir { 234*cdf0e10cSrcweir pOptions->SetDoubleClickTextEdit( !mpFrameView->IsDoubleClickTextEdit() ); 235*cdf0e10cSrcweir } 236*cdf0e10cSrcweir break; 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir case SID_CLICK_CHANGE_ROTATION: 239*cdf0e10cSrcweir { 240*cdf0e10cSrcweir pOptions->SetClickChangeRotation( !mpFrameView->IsClickChangeRotation() ); 241*cdf0e10cSrcweir } 242*cdf0e10cSrcweir break; 243*cdf0e10cSrcweir 244*cdf0e10cSrcweir default: 245*cdf0e10cSrcweir bDefault = sal_True; 246*cdf0e10cSrcweir break; 247*cdf0e10cSrcweir } 248*cdf0e10cSrcweir 249*cdf0e10cSrcweir if( !bDefault ) 250*cdf0e10cSrcweir { 251*cdf0e10cSrcweir pOptions->StoreConfig(); 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir // Speichert die Konfiguration SOFORT 254*cdf0e10cSrcweir // SFX_APP()->SaveConfiguration(); 255*cdf0e10cSrcweir WriteFrameViewData(); 256*cdf0e10cSrcweir 257*cdf0e10cSrcweir mpFrameView->Update( pOptions ); 258*cdf0e10cSrcweir ReadFrameViewData( mpFrameView ); 259*cdf0e10cSrcweir 260*cdf0e10cSrcweir Invalidate( nSlot ); 261*cdf0e10cSrcweir rReq.Done(); 262*cdf0e10cSrcweir } 263*cdf0e10cSrcweir 264*cdf0e10cSrcweir } 265*cdf0e10cSrcweir 266*cdf0e10cSrcweir 267*cdf0e10cSrcweir /************************************************************************* 268*cdf0e10cSrcweir |* 269*cdf0e10cSrcweir |* State-Methode der Optionsleiste 270*cdf0e10cSrcweir |* 271*cdf0e10cSrcweir \************************************************************************/ 272*cdf0e10cSrcweir 273*cdf0e10cSrcweir void DrawViewShell::GetOptionsBarState( SfxItemSet& rSet ) 274*cdf0e10cSrcweir { 275*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_HANDLES_DRAFT, !mpDrawView->IsSolidMarkHdl() ) ); 276*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_SOLID_CREATE, mpDrawView->IsSolidDragging() ) ); 277*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_GRID_VISIBLE, mpDrawView->IsGridVisible() ) ); 278*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_GRID_USE, mpDrawView->IsGridSnap() ) ); 279*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_HELPLINES_VISIBLE, mpDrawView->IsHlplVisible() ) ); 280*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_HELPLINES_USE, mpDrawView->IsHlplSnap() ) ); 281*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_HELPLINES_MOVE, mpDrawView->IsDragStripes() ) ); 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_SNAP_BORDER, mpDrawView->IsBordSnap() ) ); 284*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_SNAP_FRAME, mpDrawView->IsOFrmSnap() ) ); 285*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_SNAP_POINTS, mpDrawView->IsOPntSnap() ) ); 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_QUICKEDIT, mpDrawView->IsQuickTextEditMode() ) ); 288*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_PICK_THROUGH, (sal_Bool) 289*cdf0e10cSrcweir mpDrawView->GetModel()->IsPickThroughTransparentTextFrames() ) ); 290*cdf0e10cSrcweir 291*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_BIG_HANDLES, mpFrameView->IsBigHandles() ) ); 292*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_DOUBLECLICK_TEXTEDIT, mpFrameView->IsDoubleClickTextEdit() ) ); 293*cdf0e10cSrcweir rSet.Put( SfxBoolItem( SID_CLICK_CHANGE_ROTATION, mpFrameView->IsClickChangeRotation() ) ); 294*cdf0e10cSrcweir } 295*cdf0e10cSrcweir 296*cdf0e10cSrcweir } // end of namespace sd 297