1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: drviewsg.cxx,v $
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"
38 #include <svx/svxids.hrc>
41 #include <svx/imapdlg.hxx>
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>
52 #include "drawdoc.hxx"
53 #include "slideshow.hxx"
54 #include "imapinfo.hxx"
56 #include "optsitem.hxx"
58 #include "FrameView.hxx"
60 #include "drawview.hxx"
66 /*************************************************************************
70 \************************************************************************/
72 void DrawViewShell::ExecIMap( SfxRequest
& rReq
)
74 // waehrend einer Diashow wird nichts ausgefuehrt!
75 if(HasCurrentFunction(SID_PRESENTATION
) )
78 if ( rReq
.GetSlot() == SID_IMAP_EXEC
)
80 SdrMark
* pMark
= mpDrawView
->GetMarkedObjectList().GetMark(0);
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
);
93 pSdrObj
->InsertUserData( new SdIMapInfo( rImageMap
) );
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
) )
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
))
149 BOOL bDefault
= FALSE
;
150 USHORT nSlot
= rReq
.GetSlot();
152 SdOptions
* pOptions
= SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType());
156 case SID_HANDLES_DRAFT
:
157 pOptions
->SetSolidMarkHdl( !mpDrawView
->IsSolidMarkHdl() );
160 case SID_SOLID_CREATE
:
161 pOptions
->SetSolidDragging( !mpDrawView
->IsSolidDragging() );
165 // Raster- / Hilfslinien-Optionen
166 case SID_GRID_VISIBLE
: // noch nicht hier !
168 pOptions
->SetGridVisible( !mpDrawView
->IsGridVisible() );
174 pOptions
->SetUseGridSnap( !mpDrawView
->IsGridSnap() );
178 case SID_HELPLINES_VISIBLE
: // noch nicht hier !
180 pOptions
->SetHelplines( !mpDrawView
->IsHlplVisible() );
184 case SID_HELPLINES_USE
:
186 pOptions
->SetSnapHelplines( !mpDrawView
->IsHlplSnap() );
190 case SID_HELPLINES_MOVE
:
192 pOptions
->SetDragStripes( !mpDrawView
->IsDragStripes() );
197 case SID_SNAP_BORDER
:
199 pOptions
->SetSnapBorder( !mpDrawView
->IsBordSnap() );
205 pOptions
->SetSnapFrame( !mpDrawView
->IsOFrmSnap() );
209 case SID_SNAP_POINTS
:
211 pOptions
->SetSnapPoints( !mpDrawView
->IsOPntSnap() );
218 pOptions
->SetQuickEdit( !mpDrawView
->IsQuickTextEditMode() );
222 case SID_PICK_THROUGH
:
224 pOptions
->SetPickThrough(
225 !mpDrawView
->GetModel()->IsPickThroughTransparentTextFrames() );
229 case SID_BIG_HANDLES
:
231 pOptions
->SetBigHandles( !mpFrameView
->IsBigHandles() );
235 case SID_DOUBLECLICK_TEXTEDIT
:
237 pOptions
->SetDoubleClickTextEdit( !mpFrameView
->IsDoubleClickTextEdit() );
241 case SID_CLICK_CHANGE_ROTATION
:
243 pOptions
->SetClickChangeRotation( !mpFrameView
->IsClickChangeRotation() );
254 pOptions
->StoreConfig();
256 // Speichert die Konfiguration SOFORT
257 // SFX_APP()->SaveConfiguration();
258 WriteFrameViewData();
260 mpFrameView
->Update( pOptions
);
261 ReadFrameViewData( mpFrameView
);
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