fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / sd / source / ui / view / drviewsg.cxx
blob3de6c84f636a736fb4eb380053bbf4641e33ddc2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
33 #include "app.hrc"
35 #include "drawdoc.hxx"
36 #include "slideshow.hxx"
37 #include "imapinfo.hxx"
38 #include "sdmod.hxx"
39 #include "optsitem.hxx"
40 #ifndef SD_FRAME_VIEW
41 #include "FrameView.hxx"
42 #endif
43 #include "drawview.hxx"
45 #include "fupoor.hxx"
47 namespace sd {
49 void DrawViewShell::ExecIMap( SfxRequest& rReq )
51 // during a slide show, nothing is executed!
52 if(HasCurrentFunction(SID_PRESENTATION) )
53 return;
55 if ( rReq.GetSlot() == SID_IMAP_EXEC )
57 SdrMark* pMark = mpDrawView->GetMarkedObjectList().GetMark(0);
59 if ( pMark )
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 );
69 if ( !pIMapInfo )
70 pSdrObj->AppendUserData( new SdIMapInfo( rImageMap ) );
71 else
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 ) )
98 bDisable = sal_False;
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))
111 return;
113 sal_Bool bDefault = sal_False;
114 sal_uInt16 nSlot = rReq.GetSlot();
116 SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType());
118 switch( nSlot )
120 case SID_SOLID_CREATE:
121 pOptions->SetSolidDragging( !mpDrawView->IsSolidDragging() );
122 break;
125 // Grid- / Help lines option
126 case SID_GRID_VISIBLE: // not here yet!
128 pOptions->SetGridVisible( !mpDrawView->IsGridVisible() );
130 break;
132 case SID_GRID_USE:
134 pOptions->SetUseGridSnap( !mpDrawView->IsGridSnap() );
136 break;
138 case SID_HELPLINES_VISIBLE: // not here yet!
140 pOptions->SetHelplines( !mpDrawView->IsHlplVisible() );
142 break;
144 case SID_HELPLINES_USE:
146 pOptions->SetSnapHelplines( !mpDrawView->IsHlplSnap() );
148 break;
150 case SID_HELPLINES_MOVE:
152 pOptions->SetDragStripes( !mpDrawView->IsDragStripes() );
154 break;
157 case SID_SNAP_BORDER:
159 pOptions->SetSnapBorder( !mpDrawView->IsBordSnap() );
161 break;
163 case SID_SNAP_FRAME:
165 pOptions->SetSnapFrame( !mpDrawView->IsOFrmSnap() );
167 break;
169 case SID_SNAP_POINTS:
171 pOptions->SetSnapPoints( !mpDrawView->IsOPntSnap() );
173 break;
176 case SID_QUICKEDIT:
178 pOptions->SetQuickEdit( !mpDrawView->IsQuickTextEditMode() );
180 break;
182 case SID_PICK_THROUGH:
184 pOptions->SetPickThrough(
185 !mpDrawView->GetModel()->IsPickThroughTransparentTextFrames() );
187 break;
189 case SID_DOUBLECLICK_TEXTEDIT:
191 pOptions->SetDoubleClickTextEdit( !mpFrameView->IsDoubleClickTextEdit() );
193 break;
195 case SID_CLICK_CHANGE_ROTATION:
197 pOptions->SetClickChangeRotation( !mpFrameView->IsClickChangeRotation() );
199 break;
201 default:
202 bDefault = sal_True;
203 break;
206 if( !bDefault )
208 pOptions->StoreConfig();
210 // Saves the configuration IMMEDIATELY
211 // SFX_APP()->SaveConfiguration();
212 WriteFrameViewData();
214 mpFrameView->Update( pOptions );
215 ReadFrameViewData( mpFrameView );
217 Invalidate( nSlot );
218 rReq.Done();
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: */