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/dispatch.hxx>
27 #include <sfx2/viewfrm.hxx>
28 #include <svx/svdograf.hxx>
29 #include <svx/svdoole2.hxx>
33 #include "drawdoc.hxx"
34 #include "slideshow.hxx"
35 #include "imapinfo.hxx"
37 #include "optsitem.hxx"
38 #include "FrameView.hxx"
39 #include "drawview.hxx"
44 void DrawViewShell::ExecIMap( SfxRequest
& rReq
)
46 // during a slide show, nothing is executed!
47 if(HasCurrentFunction(SID_PRESENTATION
) )
50 if ( rReq
.GetSlot() == SID_IMAP_EXEC
)
52 SdrMark
* pMark
= mpDrawView
->GetMarkedObjectList().GetMark(0);
56 SdrObject
* pSdrObj
= pMark
->GetMarkedSdrObj();
57 SvxIMapDlg
* pDlg
= ViewShell::Implementation::GetImageMapDialog();
59 if ( pDlg
->GetEditingObject() == (void*) pSdrObj
)
61 const ImageMap
& rImageMap
= pDlg
->GetImageMap();
62 SdIMapInfo
* pIMapInfo
= GetDoc()->GetIMapInfo( pSdrObj
);
65 pSdrObj
->AppendUserData( new SdIMapInfo( rImageMap
) );
67 pIMapInfo
->SetImageMap( rImageMap
);
69 GetDoc()->SetChanged( true );
75 void DrawViewShell::GetIMapState( SfxItemSet
& rSet
)
79 if( GetViewFrame()->HasChildWindow( SvxIMapDlgChildWindow::GetChildWindowId() ) )
81 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
83 if ( rMarkList
.GetMarkCount() == 1 )
85 const SdrObject
* pObj
= rMarkList
.GetMark( 0 )->GetMarkedSdrObj();
87 SvxIMapDlg
* pImageMapDialog
= ViewShell::Implementation::GetImageMapDialog();
88 if ( ( pObj
->ISA( SdrGrafObj
) /*|| pObj->ISA( SdrOle2Obj )*/ )
89 && pImageMapDialog
!=NULL
90 && ( pImageMapDialog
->GetEditingObject() == (void*) pObj
) )
97 rSet
.Put( SfxBoolItem( SID_IMAP_EXEC
, bDisable
) );
100 void DrawViewShell::ExecOptionsBar( SfxRequest
& rReq
)
102 // during a slide show, nothing is executed!
103 if(HasCurrentFunction(SID_PRESENTATION
))
106 bool bDefault
= false;
107 sal_uInt16 nSlot
= rReq
.GetSlot();
109 SdOptions
* pOptions
= SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType());
113 case SID_SOLID_CREATE
:
114 pOptions
->SetSolidDragging( !mpDrawView
->IsSolidDragging() );
117 // Grid- / Help lines option
118 case SID_GRID_VISIBLE
: // not here yet!
120 pOptions
->SetGridVisible( !mpDrawView
->IsGridVisible() );
126 pOptions
->SetUseGridSnap( !mpDrawView
->IsGridSnap() );
130 case SID_HELPLINES_VISIBLE
: // not here yet!
132 pOptions
->SetHelplines( !mpDrawView
->IsHlplVisible() );
136 case SID_HELPLINES_USE
:
138 pOptions
->SetSnapHelplines( !mpDrawView
->IsHlplSnap() );
142 case SID_HELPLINES_MOVE
:
144 pOptions
->SetDragStripes( !mpDrawView
->IsDragStripes() );
148 case SID_SNAP_BORDER
:
150 pOptions
->SetSnapBorder( !mpDrawView
->IsBordSnap() );
156 pOptions
->SetSnapFrame( !mpDrawView
->IsOFrmSnap() );
160 case SID_SNAP_POINTS
:
162 pOptions
->SetSnapPoints( !mpDrawView
->IsOPntSnap() );
168 pOptions
->SetQuickEdit( !mpDrawView
->IsQuickTextEditMode() );
172 case SID_PICK_THROUGH
:
174 pOptions
->SetPickThrough(
175 !mpDrawView
->GetModel()->IsPickThroughTransparentTextFrames() );
179 case SID_DOUBLECLICK_TEXTEDIT
:
181 pOptions
->SetDoubleClickTextEdit( !mpFrameView
->IsDoubleClickTextEdit() );
185 case SID_CLICK_CHANGE_ROTATION
:
187 pOptions
->SetClickChangeRotation( !mpFrameView
->IsClickChangeRotation() );
198 pOptions
->StoreConfig();
200 // Saves the configuration IMMEDIATELY
201 // SfxGetpApp()->SaveConfiguration();
202 WriteFrameViewData();
204 mpFrameView
->Update( pOptions
);
205 ReadFrameViewData( mpFrameView
);
213 void DrawViewShell::GetOptionsBarState( SfxItemSet
& rSet
)
215 rSet
.Put( SfxBoolItem( SID_SOLID_CREATE
, mpDrawView
->IsSolidDragging() ) );
216 rSet
.Put( SfxBoolItem( SID_GRID_VISIBLE
, mpDrawView
->IsGridVisible() ) );
217 rSet
.Put( SfxBoolItem( SID_GRID_USE
, mpDrawView
->IsGridSnap() ) );
218 rSet
.Put( SfxBoolItem( SID_HELPLINES_VISIBLE
, mpDrawView
->IsHlplVisible() ) );
219 rSet
.Put( SfxBoolItem( SID_HELPLINES_USE
, mpDrawView
->IsHlplSnap() ) );
220 rSet
.Put( SfxBoolItem( SID_HELPLINES_MOVE
, mpDrawView
->IsDragStripes() ) );
222 rSet
.Put( SfxBoolItem( SID_SNAP_BORDER
, mpDrawView
->IsBordSnap() ) );
223 rSet
.Put( SfxBoolItem( SID_SNAP_FRAME
, mpDrawView
->IsOFrmSnap() ) );
224 rSet
.Put( SfxBoolItem( SID_SNAP_POINTS
, mpDrawView
->IsOPntSnap() ) );
226 rSet
.Put( SfxBoolItem( SID_QUICKEDIT
, mpDrawView
->IsQuickTextEditMode() ) );
227 rSet
.Put( SfxBoolItem( SID_PICK_THROUGH
,
228 mpDrawView
->GetModel()->IsPickThroughTransparentTextFrames() ) );
230 rSet
.Put( SfxBoolItem( SID_DOUBLECLICK_TEXTEDIT
, mpFrameView
->IsDoubleClickTextEdit() ) );
231 rSet
.Put( SfxBoolItem( SID_CLICK_CHANGE_ROTATION
, mpFrameView
->IsClickChangeRotation() ) );
234 } // end of namespace sd
236 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */