bump product version to 5.0.4.1
[LibreOffice.git] / sd / source / ui / view / drviewsg.cxx
blobad5283574b9bf6d41589145ae9cac54fe5fc863d
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 .
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>
31 #include "app.hrc"
33 #include "drawdoc.hxx"
34 #include "slideshow.hxx"
35 #include "imapinfo.hxx"
36 #include "sdmod.hxx"
37 #include "optsitem.hxx"
38 #include "FrameView.hxx"
39 #include "drawview.hxx"
40 #include "fupoor.hxx"
42 namespace sd {
44 void DrawViewShell::ExecIMap( SfxRequest& rReq )
46 // during a slide show, nothing is executed!
47 if(HasCurrentFunction(SID_PRESENTATION) )
48 return;
50 if ( rReq.GetSlot() == SID_IMAP_EXEC )
52 SdrMark* pMark = mpDrawView->GetMarkedObjectList().GetMark(0);
54 if ( pMark )
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 );
64 if ( !pIMapInfo )
65 pSdrObj->AppendUserData( new SdIMapInfo( rImageMap ) );
66 else
67 pIMapInfo->SetImageMap( rImageMap );
69 GetDoc()->SetChanged( true );
75 void DrawViewShell::GetIMapState( SfxItemSet& rSet )
77 bool bDisable = true;
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 ) )
92 bDisable = false;
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))
104 return;
106 bool bDefault = false;
107 sal_uInt16 nSlot = rReq.GetSlot();
109 SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType());
111 switch( nSlot )
113 case SID_SOLID_CREATE:
114 pOptions->SetSolidDragging( !mpDrawView->IsSolidDragging() );
115 break;
117 // Grid- / Help lines option
118 case SID_GRID_VISIBLE: // not here yet!
120 pOptions->SetGridVisible( !mpDrawView->IsGridVisible() );
122 break;
124 case SID_GRID_USE:
126 pOptions->SetUseGridSnap( !mpDrawView->IsGridSnap() );
128 break;
130 case SID_HELPLINES_VISIBLE: // not here yet!
132 pOptions->SetHelplines( !mpDrawView->IsHlplVisible() );
134 break;
136 case SID_HELPLINES_USE:
138 pOptions->SetSnapHelplines( !mpDrawView->IsHlplSnap() );
140 break;
142 case SID_HELPLINES_MOVE:
144 pOptions->SetDragStripes( !mpDrawView->IsDragStripes() );
146 break;
148 case SID_SNAP_BORDER:
150 pOptions->SetSnapBorder( !mpDrawView->IsBordSnap() );
152 break;
154 case SID_SNAP_FRAME:
156 pOptions->SetSnapFrame( !mpDrawView->IsOFrmSnap() );
158 break;
160 case SID_SNAP_POINTS:
162 pOptions->SetSnapPoints( !mpDrawView->IsOPntSnap() );
164 break;
166 case SID_QUICKEDIT:
168 pOptions->SetQuickEdit( !mpDrawView->IsQuickTextEditMode() );
170 break;
172 case SID_PICK_THROUGH:
174 pOptions->SetPickThrough(
175 !mpDrawView->GetModel()->IsPickThroughTransparentTextFrames() );
177 break;
179 case SID_DOUBLECLICK_TEXTEDIT:
181 pOptions->SetDoubleClickTextEdit( !mpFrameView->IsDoubleClickTextEdit() );
183 break;
185 case SID_CLICK_CHANGE_ROTATION:
187 pOptions->SetClickChangeRotation( !mpFrameView->IsClickChangeRotation() );
189 break;
191 default:
192 bDefault = true;
193 break;
196 if( !bDefault )
198 pOptions->StoreConfig();
200 // Saves the configuration IMMEDIATELY
201 // SfxGetpApp()->SaveConfiguration();
202 WriteFrameViewData();
204 mpFrameView->Update( pOptions );
205 ReadFrameViewData( mpFrameView );
207 Invalidate( nSlot );
208 rReq.Done();
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: */