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 .
20 #include <DrawViewShell.hxx>
21 #include <ViewShellImplementation.hxx>
23 #include <svx/svxids.hrc>
24 #include <svx/imapdlg.hxx>
25 #include <sfx2/request.hxx>
26 #include <sfx2/viewfrm.hxx>
27 #include <svx/svdograf.hxx>
28 #include <svx/ImageMapInfo.hxx>
32 #include <drawdoc.hxx>
34 #include <optsitem.hxx>
35 #include <FrameView.hxx>
36 #include <drawview.hxx>
40 void DrawViewShell::ExecIMap( SfxRequest
const & rReq
)
42 // during a slide show, nothing is executed!
43 if(HasCurrentFunction(SID_PRESENTATION
) )
46 if ( rReq
.GetSlot() != SID_IMAP_EXEC
)
49 SdrMark
* pMark
= mpDrawView
->GetMarkedObjectList().GetMark(0);
54 SdrObject
* pSdrObj
= pMark
->GetMarkedSdrObj();
55 SvxIMapDlg
* pDlg
= ViewShell::Implementation::GetImageMapDialog();
57 if ( pDlg
->GetEditingObject() == static_cast<void*>(pSdrObj
) )
59 const ImageMap
& rImageMap
= pDlg
->GetImageMap();
60 SvxIMapInfo
* pIMapInfo
= SvxIMapInfo::GetIMapInfo( pSdrObj
);
63 pSdrObj
->AppendUserData( std::unique_ptr
<SdrObjUserData
>(new SvxIMapInfo( rImageMap
)) );
65 pIMapInfo
->SetImageMap( rImageMap
);
67 GetDoc()->SetChanged();
71 void DrawViewShell::GetIMapState( SfxItemSet
& rSet
)
75 if( GetViewFrame()->HasChildWindow( SvxIMapDlgChildWindow::GetChildWindowId() ) )
77 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
79 if ( rMarkList
.GetMarkCount() == 1 )
81 const SdrObject
* pObj
= rMarkList
.GetMark( 0 )->GetMarkedSdrObj();
83 SvxIMapDlg
* pImageMapDialog
= ViewShell::Implementation::GetImageMapDialog();
84 if ( ( dynamic_cast< const SdrGrafObj
*>( pObj
) != nullptr /*|| pObj->ISA( SdrOle2Obj )*/ )
85 && pImageMapDialog
!=nullptr
86 && ( pImageMapDialog
->GetEditingObject() == static_cast<void const *>(pObj
) ) )
93 rSet
.Put( SfxBoolItem( SID_IMAP_EXEC
, bDisable
) );
96 void DrawViewShell::ExecOptionsBar( SfxRequest
& rReq
)
98 // during a slide show, nothing is executed!
99 if(HasCurrentFunction(SID_PRESENTATION
))
102 bool bDefault
= false;
103 sal_uInt16 nSlot
= rReq
.GetSlot();
105 SdOptions
* pOptions
= SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType());
109 case SID_SOLID_CREATE
:
110 pOptions
->SetSolidDragging( !mpDrawView
->IsSolidDragging() );
113 // Grid- / Help lines option
114 case SID_GRID_VISIBLE
: // not here yet!
116 pOptions
->SetGridVisible( !mpDrawView
->IsGridVisible() );
122 pOptions
->SetUseGridSnap( !mpDrawView
->IsGridSnap() );
126 case SID_HELPLINES_VISIBLE
: // not here yet!
128 pOptions
->SetHelplines( !mpDrawView
->IsHlplVisible() );
132 case SID_HELPLINES_USE
:
134 pOptions
->SetSnapHelplines( !mpDrawView
->IsHlplSnap() );
138 case SID_HELPLINES_MOVE
:
140 pOptions
->SetDragStripes( !mpDrawView
->IsDragStripes() );
144 case SID_SNAP_BORDER
:
146 pOptions
->SetSnapBorder( !mpDrawView
->IsBordSnap() );
152 pOptions
->SetSnapFrame( !mpDrawView
->IsOFrmSnap() );
156 case SID_SNAP_POINTS
:
158 pOptions
->SetSnapPoints( !mpDrawView
->IsOPntSnap() );
164 pOptions
->SetQuickEdit( !mpDrawView
->IsQuickTextEditMode() );
168 case SID_PICK_THROUGH
:
170 pOptions
->SetPickThrough(
171 !mpDrawView
->GetModel().IsPickThroughTransparentTextFrames() );
175 case SID_DOUBLECLICK_TEXTEDIT
:
177 pOptions
->SetDoubleClickTextEdit( !mpFrameView
->IsDoubleClickTextEdit() );
181 case SID_CLICK_CHANGE_ROTATION
:
183 pOptions
->SetClickChangeRotation( !mpFrameView
->IsClickChangeRotation() );
195 pOptions
->StoreConfig();
197 // Saves the configuration IMMEDIATELY
198 // SfxGetpApp()->SaveConfiguration();
199 WriteFrameViewData();
201 mpFrameView
->Update( pOptions
);
202 ReadFrameViewData( mpFrameView
);
209 void DrawViewShell::GetOptionsBarState( SfxItemSet
& rSet
)
211 rSet
.Put( SfxBoolItem( SID_SOLID_CREATE
, mpDrawView
->IsSolidDragging() ) );
212 rSet
.Put( SfxBoolItem( SID_GRID_VISIBLE
, mpDrawView
->IsGridVisible() ) );
213 rSet
.Put( SfxBoolItem( SID_GRID_USE
, mpDrawView
->IsGridSnap() ) );
214 rSet
.Put( SfxBoolItem( SID_HELPLINES_VISIBLE
, mpDrawView
->IsHlplVisible() ) );
215 rSet
.Put( SfxBoolItem( SID_HELPLINES_USE
, mpDrawView
->IsHlplSnap() ) );
216 rSet
.Put( SfxBoolItem( SID_HELPLINES_MOVE
, mpDrawView
->IsDragStripes() ) );
218 rSet
.Put( SfxBoolItem( SID_SNAP_BORDER
, mpDrawView
->IsBordSnap() ) );
219 rSet
.Put( SfxBoolItem( SID_SNAP_FRAME
, mpDrawView
->IsOFrmSnap() ) );
220 rSet
.Put( SfxBoolItem( SID_SNAP_POINTS
, mpDrawView
->IsOPntSnap() ) );
222 rSet
.Put( SfxBoolItem( SID_QUICKEDIT
, mpDrawView
->IsQuickTextEditMode() ) );
223 rSet
.Put( SfxBoolItem( SID_PICK_THROUGH
,
224 mpDrawView
->GetModel().IsPickThroughTransparentTextFrames() ) );
226 rSet
.Put( SfxBoolItem( SID_DOUBLECLICK_TEXTEDIT
, mpFrameView
->IsDoubleClickTextEdit() ) );
227 rSet
.Put( SfxBoolItem( SID_CLICK_CHANGE_ROTATION
, mpFrameView
->IsClickChangeRotation() ) );
230 } // end of namespace sd
232 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */