Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 :
21 : #include "DrawViewShell.hxx"
22 : #include "ViewShellImplementation.hxx"
23 :
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>
31 :
32 :
33 : #include "app.hrc"
34 :
35 : #include "drawdoc.hxx"
36 : #include "slideshow.hxx"
37 : #include "imapinfo.hxx"
38 : #include "sdmod.hxx"
39 : #include "optsitem.hxx"
40 : #include "FrameView.hxx"
41 : #include "drawview.hxx"
42 : #include "fupoor.hxx"
43 :
44 : namespace sd {
45 :
46 0 : void DrawViewShell::ExecIMap( SfxRequest& rReq )
47 : {
48 : // during a slide show, nothing is executed!
49 0 : if(HasCurrentFunction(SID_PRESENTATION) )
50 0 : return;
51 :
52 0 : if ( rReq.GetSlot() == SID_IMAP_EXEC )
53 : {
54 0 : SdrMark* pMark = mpDrawView->GetMarkedObjectList().GetMark(0);
55 :
56 0 : if ( pMark )
57 : {
58 0 : SdrObject* pSdrObj = pMark->GetMarkedSdrObj();
59 0 : SvxIMapDlg* pDlg = ViewShell::Implementation::GetImageMapDialog();
60 :
61 0 : if ( pDlg->GetEditingObject() == (void*) pSdrObj )
62 : {
63 0 : const ImageMap& rImageMap = pDlg->GetImageMap();
64 0 : SdIMapInfo* pIMapInfo = GetDoc()->GetIMapInfo( pSdrObj );
65 :
66 0 : if ( !pIMapInfo )
67 0 : pSdrObj->AppendUserData( new SdIMapInfo( rImageMap ) );
68 : else
69 0 : pIMapInfo->SetImageMap( rImageMap );
70 :
71 0 : GetDoc()->SetChanged( true );
72 : }
73 : }
74 : }
75 : }
76 :
77 0 : void DrawViewShell::GetIMapState( SfxItemSet& rSet )
78 : {
79 0 : sal_Bool bDisable = sal_True;
80 :
81 0 : if( GetViewFrame()->HasChildWindow( SvxIMapDlgChildWindow::GetChildWindowId() ) )
82 : {
83 0 : const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
84 0 : sal_uLong nMarkCount = rMarkList.GetMarkCount();
85 :
86 0 : if ( nMarkCount == 1 )
87 : {
88 0 : const SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
89 :
90 0 : SvxIMapDlg* pImageMapDialog = ViewShell::Implementation::GetImageMapDialog();
91 0 : if ( ( pObj->ISA( SdrGrafObj ) /*|| pObj->ISA( SdrOle2Obj )*/ )
92 0 : && pImageMapDialog!=NULL
93 0 : && ( pImageMapDialog->GetEditingObject() == (void*) pObj ) )
94 : {
95 0 : bDisable = sal_False;
96 : }
97 : }
98 : }
99 :
100 0 : rSet.Put( SfxBoolItem( SID_IMAP_EXEC, bDisable ) );
101 0 : }
102 :
103 :
104 0 : void DrawViewShell::ExecOptionsBar( SfxRequest& rReq )
105 : {
106 : // during a slide show, nothing is executed!
107 0 : if(HasCurrentFunction(SID_PRESENTATION))
108 0 : return;
109 :
110 0 : sal_Bool bDefault = sal_False;
111 0 : sal_uInt16 nSlot = rReq.GetSlot();
112 :
113 0 : SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType());
114 :
115 0 : switch( nSlot )
116 : {
117 : case SID_SOLID_CREATE:
118 0 : pOptions->SetSolidDragging( !mpDrawView->IsSolidDragging() );
119 0 : break;
120 :
121 :
122 : // Grid- / Help lines option
123 : case SID_GRID_VISIBLE: // not here yet!
124 : {
125 0 : pOptions->SetGridVisible( !mpDrawView->IsGridVisible() );
126 : }
127 0 : break;
128 :
129 : case SID_GRID_USE:
130 : {
131 0 : pOptions->SetUseGridSnap( !mpDrawView->IsGridSnap() );
132 : }
133 0 : break;
134 :
135 : case SID_HELPLINES_VISIBLE: // not here yet!
136 : {
137 0 : pOptions->SetHelplines( !mpDrawView->IsHlplVisible() );
138 : }
139 0 : break;
140 :
141 : case SID_HELPLINES_USE:
142 : {
143 0 : pOptions->SetSnapHelplines( !mpDrawView->IsHlplSnap() );
144 : }
145 0 : break;
146 :
147 : case SID_HELPLINES_MOVE:
148 : {
149 0 : pOptions->SetDragStripes( !mpDrawView->IsDragStripes() );
150 : }
151 0 : break;
152 :
153 :
154 : case SID_SNAP_BORDER:
155 : {
156 0 : pOptions->SetSnapBorder( !mpDrawView->IsBordSnap() );
157 : }
158 0 : break;
159 :
160 : case SID_SNAP_FRAME:
161 : {
162 0 : pOptions->SetSnapFrame( !mpDrawView->IsOFrmSnap() );
163 : }
164 0 : break;
165 :
166 : case SID_SNAP_POINTS:
167 : {
168 0 : pOptions->SetSnapPoints( !mpDrawView->IsOPntSnap() );
169 : }
170 0 : break;
171 :
172 :
173 : case SID_QUICKEDIT:
174 : {
175 0 : pOptions->SetQuickEdit( !mpDrawView->IsQuickTextEditMode() );
176 : }
177 0 : break;
178 :
179 : case SID_PICK_THROUGH:
180 : {
181 : pOptions->SetPickThrough(
182 0 : !mpDrawView->GetModel()->IsPickThroughTransparentTextFrames() );
183 : }
184 0 : break;
185 :
186 : case SID_DOUBLECLICK_TEXTEDIT:
187 : {
188 0 : pOptions->SetDoubleClickTextEdit( !mpFrameView->IsDoubleClickTextEdit() );
189 : }
190 0 : break;
191 :
192 : case SID_CLICK_CHANGE_ROTATION:
193 : {
194 0 : pOptions->SetClickChangeRotation( !mpFrameView->IsClickChangeRotation() );
195 : }
196 0 : break;
197 :
198 : default:
199 0 : bDefault = sal_True;
200 0 : break;
201 : }
202 :
203 0 : if( !bDefault )
204 : {
205 0 : pOptions->StoreConfig();
206 :
207 : // Saves the configuration IMMEDIATELY
208 : // SFX_APP()->SaveConfiguration();
209 0 : WriteFrameViewData();
210 :
211 0 : mpFrameView->Update( pOptions );
212 0 : ReadFrameViewData( mpFrameView );
213 :
214 0 : Invalidate( nSlot );
215 0 : rReq.Done();
216 : }
217 :
218 : }
219 :
220 :
221 :
222 0 : void DrawViewShell::GetOptionsBarState( SfxItemSet& rSet )
223 : {
224 0 : rSet.Put( SfxBoolItem( SID_SOLID_CREATE, mpDrawView->IsSolidDragging() ) );
225 0 : rSet.Put( SfxBoolItem( SID_GRID_VISIBLE, mpDrawView->IsGridVisible() ) );
226 0 : rSet.Put( SfxBoolItem( SID_GRID_USE, mpDrawView->IsGridSnap() ) );
227 0 : rSet.Put( SfxBoolItem( SID_HELPLINES_VISIBLE, mpDrawView->IsHlplVisible() ) );
228 0 : rSet.Put( SfxBoolItem( SID_HELPLINES_USE, mpDrawView->IsHlplSnap() ) );
229 0 : rSet.Put( SfxBoolItem( SID_HELPLINES_MOVE, mpDrawView->IsDragStripes() ) );
230 :
231 0 : rSet.Put( SfxBoolItem( SID_SNAP_BORDER, mpDrawView->IsBordSnap() ) );
232 0 : rSet.Put( SfxBoolItem( SID_SNAP_FRAME, mpDrawView->IsOFrmSnap() ) );
233 0 : rSet.Put( SfxBoolItem( SID_SNAP_POINTS, mpDrawView->IsOPntSnap() ) );
234 :
235 0 : rSet.Put( SfxBoolItem( SID_QUICKEDIT, mpDrawView->IsQuickTextEditMode() ) );
236 : rSet.Put( SfxBoolItem( SID_PICK_THROUGH,
237 0 : mpDrawView->GetModel()->IsPickThroughTransparentTextFrames() ) );
238 :
239 0 : rSet.Put( SfxBoolItem( SID_DOUBLECLICK_TEXTEDIT, mpFrameView->IsDoubleClickTextEdit() ) );
240 0 : rSet.Put( SfxBoolItem( SID_CLICK_CHANGE_ROTATION, mpFrameView->IsClickChangeRotation() ) );
241 0 : }
242 :
243 0 : } // end of namespace sd
244 :
245 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|