1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include "DrawViewShell.hxx"
22 #include "ViewShellImplementation.hxx"
24 #include <svx/svxids.hrc>
25 #include <svx/imapdlg.hxx>
26 #include <sfx2/request.hxx>
27 #include <sfx2/dispatch.hxx>
28 #include <sfx2/viewfrm.hxx>
29 #include <svx/svdograf.hxx>
30 #include <svx/svdoole2.hxx>
35 #include "drawdoc.hxx"
36 #include "slideshow.hxx"
37 #include "imapinfo.hxx"
39 #include "optsitem.hxx"
41 #include "FrameView.hxx"
43 #include "drawview.hxx"
49 void DrawViewShell::ExecIMap( SfxRequest
& rReq
)
51 // during a slide show, nothing is executed!
52 if(HasCurrentFunction(SID_PRESENTATION
) )
55 if ( rReq
.GetSlot() == SID_IMAP_EXEC
)
57 SdrMark
* pMark
= mpDrawView
->GetMarkedObjectList().GetMark(0);
61 SdrObject
* pSdrObj
= pMark
->GetMarkedSdrObj();
62 SvxIMapDlg
* pDlg
= ViewShell::Implementation::GetImageMapDialog();
64 if ( pDlg
->GetEditingObject() == (void*) pSdrObj
)
66 const ImageMap
& rImageMap
= pDlg
->GetImageMap();
67 SdIMapInfo
* pIMapInfo
= GetDoc()->GetIMapInfo( pSdrObj
);
70 pSdrObj
->AppendUserData( new SdIMapInfo( rImageMap
) );
72 pIMapInfo
->SetImageMap( rImageMap
);
74 GetDoc()->SetChanged( sal_True
);
80 void DrawViewShell::GetIMapState( SfxItemSet
& rSet
)
82 sal_Bool bDisable
= sal_True
;
84 if( GetViewFrame()->HasChildWindow( SvxIMapDlgChildWindow::GetChildWindowId() ) )
86 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
87 sal_uLong nMarkCount
= rMarkList
.GetMarkCount();
89 if ( nMarkCount
== 1 )
91 const SdrObject
* pObj
= rMarkList
.GetMark( 0 )->GetMarkedSdrObj();
93 SvxIMapDlg
* pImageMapDialog
= ViewShell::Implementation::GetImageMapDialog();
94 if ( ( pObj
->ISA( SdrGrafObj
) /*|| pObj->ISA( SdrOle2Obj )*/ )
95 && pImageMapDialog
!=NULL
96 && ( pImageMapDialog
->GetEditingObject() == (void*) pObj
) )
103 rSet
.Put( SfxBoolItem( SID_IMAP_EXEC
, bDisable
) );
107 void DrawViewShell::ExecOptionsBar( SfxRequest
& rReq
)
109 // during a slide show, nothing is executed!
110 if(HasCurrentFunction(SID_PRESENTATION
))
113 sal_Bool bDefault
= sal_False
;
114 sal_uInt16 nSlot
= rReq
.GetSlot();
116 SdOptions
* pOptions
= SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType());
120 case SID_SOLID_CREATE
:
121 pOptions
->SetSolidDragging( !mpDrawView
->IsSolidDragging() );
125 // Grid- / Help lines option
126 case SID_GRID_VISIBLE
: // not here yet!
128 pOptions
->SetGridVisible( !mpDrawView
->IsGridVisible() );
134 pOptions
->SetUseGridSnap( !mpDrawView
->IsGridSnap() );
138 case SID_HELPLINES_VISIBLE
: // not here yet!
140 pOptions
->SetHelplines( !mpDrawView
->IsHlplVisible() );
144 case SID_HELPLINES_USE
:
146 pOptions
->SetSnapHelplines( !mpDrawView
->IsHlplSnap() );
150 case SID_HELPLINES_MOVE
:
152 pOptions
->SetDragStripes( !mpDrawView
->IsDragStripes() );
157 case SID_SNAP_BORDER
:
159 pOptions
->SetSnapBorder( !mpDrawView
->IsBordSnap() );
165 pOptions
->SetSnapFrame( !mpDrawView
->IsOFrmSnap() );
169 case SID_SNAP_POINTS
:
171 pOptions
->SetSnapPoints( !mpDrawView
->IsOPntSnap() );
178 pOptions
->SetQuickEdit( !mpDrawView
->IsQuickTextEditMode() );
182 case SID_PICK_THROUGH
:
184 pOptions
->SetPickThrough(
185 !mpDrawView
->GetModel()->IsPickThroughTransparentTextFrames() );
189 case SID_DOUBLECLICK_TEXTEDIT
:
191 pOptions
->SetDoubleClickTextEdit( !mpFrameView
->IsDoubleClickTextEdit() );
195 case SID_CLICK_CHANGE_ROTATION
:
197 pOptions
->SetClickChangeRotation( !mpFrameView
->IsClickChangeRotation() );
208 pOptions
->StoreConfig();
210 // Saves the configuration IMMEDIATELY
211 // SFX_APP()->SaveConfiguration();
212 WriteFrameViewData();
214 mpFrameView
->Update( pOptions
);
215 ReadFrameViewData( mpFrameView
);
225 void DrawViewShell::GetOptionsBarState( SfxItemSet
& rSet
)
227 rSet
.Put( SfxBoolItem( SID_SOLID_CREATE
, mpDrawView
->IsSolidDragging() ) );
228 rSet
.Put( SfxBoolItem( SID_GRID_VISIBLE
, mpDrawView
->IsGridVisible() ) );
229 rSet
.Put( SfxBoolItem( SID_GRID_USE
, mpDrawView
->IsGridSnap() ) );
230 rSet
.Put( SfxBoolItem( SID_HELPLINES_VISIBLE
, mpDrawView
->IsHlplVisible() ) );
231 rSet
.Put( SfxBoolItem( SID_HELPLINES_USE
, mpDrawView
->IsHlplSnap() ) );
232 rSet
.Put( SfxBoolItem( SID_HELPLINES_MOVE
, mpDrawView
->IsDragStripes() ) );
234 rSet
.Put( SfxBoolItem( SID_SNAP_BORDER
, mpDrawView
->IsBordSnap() ) );
235 rSet
.Put( SfxBoolItem( SID_SNAP_FRAME
, mpDrawView
->IsOFrmSnap() ) );
236 rSet
.Put( SfxBoolItem( SID_SNAP_POINTS
, mpDrawView
->IsOPntSnap() ) );
238 rSet
.Put( SfxBoolItem( SID_QUICKEDIT
, mpDrawView
->IsQuickTextEditMode() ) );
239 rSet
.Put( SfxBoolItem( SID_PICK_THROUGH
, (sal_Bool
)
240 mpDrawView
->GetModel()->IsPickThroughTransparentTextFrames() ) );
242 rSet
.Put( SfxBoolItem( SID_DOUBLECLICK_TEXTEDIT
, mpFrameView
->IsDoubleClickTextEdit() ) );
243 rSet
.Put( SfxBoolItem( SID_CLICK_CHANGE_ROTATION
, mpFrameView
->IsClickChangeRotation() ) );
246 } // end of namespace sd
248 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */