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