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