update dev300-m58
[ooovba.git] / sd / source / ui / view / drviewsg.cxx
blobaffe07cd980dcb2574d5e71107ac3bd16131bef7
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: drviewsg.cxx,v $
10 * $Revision: 1.16 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
34 #include "DrawViewShell.hxx"
35 #include "ViewShellImplementation.hxx"
37 #ifndef _SVXIDS_HRC
38 #include <svx/svxids.hrc>
39 #endif
40 #ifndef _IMAPDLG_HXX
41 #include <svx/imapdlg.hxx>
42 #endif
43 #include <sfx2/request.hxx>
44 #include <sfx2/dispatch.hxx>
45 #include <sfx2/viewfrm.hxx>
46 #include <svx/svdograf.hxx>
47 #include <svx/svdoole2.hxx>
50 #include "app.hrc"
52 #include "drawdoc.hxx"
53 #include "slideshow.hxx"
54 #include "imapinfo.hxx"
55 #include "sdmod.hxx"
56 #include "optsitem.hxx"
57 #ifndef SD_FRAME_VIEW
58 #include "FrameView.hxx"
59 #endif
60 #include "drawview.hxx"
62 #include "fupoor.hxx"
64 namespace sd {
66 /*************************************************************************
70 \************************************************************************/
72 void DrawViewShell::ExecIMap( SfxRequest& rReq )
74 // waehrend einer Diashow wird nichts ausgefuehrt!
75 if(HasCurrentFunction(SID_PRESENTATION) )
76 return;
78 if ( rReq.GetSlot() == SID_IMAP_EXEC )
80 SdrMark* pMark = mpDrawView->GetMarkedObjectList().GetMark(0);
82 if ( pMark )
84 SdrObject* pSdrObj = pMark->GetMarkedSdrObj();
85 SvxIMapDlg* pDlg = ViewShell::Implementation::GetImageMapDialog();
87 if ( pDlg->GetEditingObject() == (void*) pSdrObj )
89 const ImageMap& rImageMap = pDlg->GetImageMap();
90 SdIMapInfo* pIMapInfo = GetDoc()->GetIMapInfo( pSdrObj );
92 if ( !pIMapInfo )
93 pSdrObj->InsertUserData( new SdIMapInfo( rImageMap ) );
94 else
95 pIMapInfo->SetImageMap( rImageMap );
97 GetDoc()->SetChanged( sal_True );
104 /*************************************************************************
108 \************************************************************************/
110 void DrawViewShell::GetIMapState( SfxItemSet& rSet )
112 BOOL bDisable = TRUE;
114 if( GetViewFrame()->HasChildWindow( SvxIMapDlgChildWindow::GetChildWindowId() ) )
116 const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
117 const SdrObject* pObj = NULL;
118 ULONG nMarkCount = rMarkList.GetMarkCount();
120 if ( nMarkCount == 1 )
122 pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
124 SvxIMapDlg* pImageMapDialog = ViewShell::Implementation::GetImageMapDialog();
125 if ( ( pObj->ISA( SdrGrafObj ) /*|| pObj->ISA( SdrOle2Obj )*/ )
126 && pImageMapDialog!=NULL
127 && ( pImageMapDialog->GetEditingObject() == (void*) pObj ) )
129 bDisable = FALSE;
134 rSet.Put( SfxBoolItem( SID_IMAP_EXEC, bDisable ) );
137 /*************************************************************************
139 |* Execute-Methode der Optionsleiste
141 \************************************************************************/
143 void DrawViewShell::ExecOptionsBar( SfxRequest& rReq )
145 // waehrend einer Diashow wird nichts ausgefuehrt!
146 if(HasCurrentFunction(SID_PRESENTATION))
147 return;
149 BOOL bDefault = FALSE;
150 USHORT nSlot = rReq.GetSlot();
152 SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType());
154 switch( nSlot )
156 case SID_HANDLES_DRAFT:
157 pOptions->SetSolidMarkHdl( !mpDrawView->IsSolidMarkHdl() );
158 break;
160 case SID_SOLID_CREATE:
161 pOptions->SetSolidDragging( !mpDrawView->IsSolidDragging() );
162 break;
165 // Raster- / Hilfslinien-Optionen
166 case SID_GRID_VISIBLE: // noch nicht hier !
168 pOptions->SetGridVisible( !mpDrawView->IsGridVisible() );
170 break;
172 case SID_GRID_USE:
174 pOptions->SetUseGridSnap( !mpDrawView->IsGridSnap() );
176 break;
178 case SID_HELPLINES_VISIBLE: // noch nicht hier !
180 pOptions->SetHelplines( !mpDrawView->IsHlplVisible() );
182 break;
184 case SID_HELPLINES_USE:
186 pOptions->SetSnapHelplines( !mpDrawView->IsHlplSnap() );
188 break;
190 case SID_HELPLINES_MOVE:
192 pOptions->SetDragStripes( !mpDrawView->IsDragStripes() );
194 break;
197 case SID_SNAP_BORDER:
199 pOptions->SetSnapBorder( !mpDrawView->IsBordSnap() );
201 break;
203 case SID_SNAP_FRAME:
205 pOptions->SetSnapFrame( !mpDrawView->IsOFrmSnap() );
207 break;
209 case SID_SNAP_POINTS:
211 pOptions->SetSnapPoints( !mpDrawView->IsOPntSnap() );
213 break;
216 case SID_QUICKEDIT:
218 pOptions->SetQuickEdit( !mpDrawView->IsQuickTextEditMode() );
220 break;
222 case SID_PICK_THROUGH:
224 pOptions->SetPickThrough(
225 !mpDrawView->GetModel()->IsPickThroughTransparentTextFrames() );
227 break;
229 case SID_BIG_HANDLES:
231 pOptions->SetBigHandles( !mpFrameView->IsBigHandles() );
233 break;
235 case SID_DOUBLECLICK_TEXTEDIT:
237 pOptions->SetDoubleClickTextEdit( !mpFrameView->IsDoubleClickTextEdit() );
239 break;
241 case SID_CLICK_CHANGE_ROTATION:
243 pOptions->SetClickChangeRotation( !mpFrameView->IsClickChangeRotation() );
245 break;
247 default:
248 bDefault = TRUE;
249 break;
252 if( !bDefault )
254 pOptions->StoreConfig();
256 // Speichert die Konfiguration SOFORT
257 // SFX_APP()->SaveConfiguration();
258 WriteFrameViewData();
260 mpFrameView->Update( pOptions );
261 ReadFrameViewData( mpFrameView );
263 Invalidate( nSlot );
264 rReq.Done();
270 /*************************************************************************
272 |* State-Methode der Optionsleiste
274 \************************************************************************/
276 void DrawViewShell::GetOptionsBarState( SfxItemSet& rSet )
278 rSet.Put( SfxBoolItem( SID_HANDLES_DRAFT, !mpDrawView->IsSolidMarkHdl() ) );
279 rSet.Put( SfxBoolItem( SID_SOLID_CREATE, mpDrawView->IsSolidDragging() ) );
280 rSet.Put( SfxBoolItem( SID_GRID_VISIBLE, mpDrawView->IsGridVisible() ) );
281 rSet.Put( SfxBoolItem( SID_GRID_USE, mpDrawView->IsGridSnap() ) );
282 rSet.Put( SfxBoolItem( SID_HELPLINES_VISIBLE, mpDrawView->IsHlplVisible() ) );
283 rSet.Put( SfxBoolItem( SID_HELPLINES_USE, mpDrawView->IsHlplSnap() ) );
284 rSet.Put( SfxBoolItem( SID_HELPLINES_MOVE, mpDrawView->IsDragStripes() ) );
286 rSet.Put( SfxBoolItem( SID_SNAP_BORDER, mpDrawView->IsBordSnap() ) );
287 rSet.Put( SfxBoolItem( SID_SNAP_FRAME, mpDrawView->IsOFrmSnap() ) );
288 rSet.Put( SfxBoolItem( SID_SNAP_POINTS, mpDrawView->IsOPntSnap() ) );
290 rSet.Put( SfxBoolItem( SID_QUICKEDIT, mpDrawView->IsQuickTextEditMode() ) );
291 rSet.Put( SfxBoolItem( SID_PICK_THROUGH, (BOOL)
292 mpDrawView->GetModel()->IsPickThroughTransparentTextFrames() ) );
294 rSet.Put( SfxBoolItem( SID_BIG_HANDLES, mpFrameView->IsBigHandles() ) );
295 rSet.Put( SfxBoolItem( SID_DOUBLECLICK_TEXTEDIT, mpFrameView->IsDoubleClickTextEdit() ) );
296 rSet.Put( SfxBoolItem( SID_CLICK_CHANGE_ROTATION, mpFrameView->IsClickChangeRotation() ) );
299 } // end of namespace sd