xref: /AOO41X/main/sd/source/ui/view/drviews8.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_sd.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "DrawViewShell.hxx"
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir #include "ViewShellHint.hxx"
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir #ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
36*cdf0e10cSrcweir #include <toolkit/unohlp.hxx>
37*cdf0e10cSrcweir #endif
38*cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
39*cdf0e10cSrcweir #ifndef _SVXIDS_HXX
40*cdf0e10cSrcweir #include <svx/svxids.hrc>
41*cdf0e10cSrcweir #endif
42*cdf0e10cSrcweir #include <vcl/msgbox.hxx>
43*cdf0e10cSrcweir #include <svx/svddef.hxx>
44*cdf0e10cSrcweir #include <sfx2/bindings.hxx>
45*cdf0e10cSrcweir #include <sfx2/request.hxx>
46*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
47*cdf0e10cSrcweir #include <svx/svdograf.hxx>
48*cdf0e10cSrcweir #include <svx/svdpagv.hxx>
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir #include "app.hrc"
51*cdf0e10cSrcweir #include "strings.hrc"
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir #include "misc.hxx"
54*cdf0e10cSrcweir #include "fuzoom.hxx"
55*cdf0e10cSrcweir #include "fudspord.hxx"
56*cdf0e10cSrcweir #include "futransf.hxx"
57*cdf0e10cSrcweir #include "fuline.hxx"
58*cdf0e10cSrcweir #include "fuarea.hxx"
59*cdf0e10cSrcweir #include "fuchar.hxx"
60*cdf0e10cSrcweir #include "fuparagr.hxx"
61*cdf0e10cSrcweir #include "fubullet.hxx"
62*cdf0e10cSrcweir #include "futempl.hxx"
63*cdf0e10cSrcweir #include "fuinsert.hxx"
64*cdf0e10cSrcweir #include "fuprlout.hxx"
65*cdf0e10cSrcweir #include "fupage.hxx"
66*cdf0e10cSrcweir #ifndef SD_FU_OBJECT_ANIMATION_PARAMETERS_HXX
67*cdf0e10cSrcweir #include "fuoaprms.hxx"
68*cdf0e10cSrcweir #endif
69*cdf0e10cSrcweir #include "fucopy.hxx"
70*cdf0e10cSrcweir #ifndef SD_FU_LINE_END_HXX
71*cdf0e10cSrcweir #include "fulinend.hxx"
72*cdf0e10cSrcweir #endif
73*cdf0e10cSrcweir #include "fusnapln.hxx"
74*cdf0e10cSrcweir #include "fuolbull.hxx"
75*cdf0e10cSrcweir #include "fuinsfil.hxx"
76*cdf0e10cSrcweir #include "fulink.hxx"
77*cdf0e10cSrcweir #include "futhes.hxx"
78*cdf0e10cSrcweir #include "futxtatt.hxx"
79*cdf0e10cSrcweir #include "fumeasur.hxx"
80*cdf0e10cSrcweir #include "fuconnct.hxx"
81*cdf0e10cSrcweir #include "fumorph.hxx"
82*cdf0e10cSrcweir #include "fuvect.hxx"
83*cdf0e10cSrcweir #include "sdresid.hxx"
84*cdf0e10cSrcweir #include "Window.hxx"
85*cdf0e10cSrcweir #include "drawview.hxx"
86*cdf0e10cSrcweir #include "zoomlist.hxx"
87*cdf0e10cSrcweir #include <vos/mutex.hxx>
88*cdf0e10cSrcweir #include <vcl/salbtype.hxx>		// FRound
89*cdf0e10cSrcweir #include <vcl/svapp.hxx>
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir namespace sd {
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir /*************************************************************************
94*cdf0e10cSrcweir |*
95*cdf0e10cSrcweir |* SfxRequests fuer temporaere Funktionen
96*cdf0e10cSrcweir |*
97*cdf0e10cSrcweir \************************************************************************/
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir void DrawViewShell::FuTemp01(SfxRequest& rReq)
100*cdf0e10cSrcweir {
101*cdf0e10cSrcweir 	switch(rReq.GetSlot())
102*cdf0e10cSrcweir 	{
103*cdf0e10cSrcweir 		case SID_ATTRIBUTES_LINE:  // BASIC
104*cdf0e10cSrcweir 		{
105*cdf0e10cSrcweir 			SetCurrentFunction( FuLine::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
106*cdf0e10cSrcweir 			Cancel();
107*cdf0e10cSrcweir 		}
108*cdf0e10cSrcweir 		break;
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir 		case SID_ATTRIBUTES_AREA:  // BASIC
111*cdf0e10cSrcweir 		{
112*cdf0e10cSrcweir 			SetCurrentFunction( FuArea::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
113*cdf0e10cSrcweir 			Cancel();
114*cdf0e10cSrcweir 		}
115*cdf0e10cSrcweir 		break;
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir 		case SID_ATTR_TRANSFORM:
118*cdf0e10cSrcweir 		{
119*cdf0e10cSrcweir 			SetCurrentFunction( FuTransform::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
120*cdf0e10cSrcweir 			Invalidate(SID_RULER_OBJECT);
121*cdf0e10cSrcweir 			Cancel();
122*cdf0e10cSrcweir 		}
123*cdf0e10cSrcweir 		break;
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir 		case SID_CHAR_DLG:	// BASIC
126*cdf0e10cSrcweir 		{
127*cdf0e10cSrcweir 			SetCurrentFunction( FuChar::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
128*cdf0e10cSrcweir 			Cancel();
129*cdf0e10cSrcweir 		}
130*cdf0e10cSrcweir 		break;
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir 		case SID_PARA_DLG:
133*cdf0e10cSrcweir 		{
134*cdf0e10cSrcweir 			SetCurrentFunction( FuParagraph::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
135*cdf0e10cSrcweir 			Cancel();
136*cdf0e10cSrcweir 		}
137*cdf0e10cSrcweir 		break;
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir 		case SID_OUTLINE_BULLET:
140*cdf0e10cSrcweir 		{
141*cdf0e10cSrcweir 			SetCurrentFunction( FuOutlineBullet::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
142*cdf0e10cSrcweir 			Cancel();
143*cdf0e10cSrcweir 		}
144*cdf0e10cSrcweir 		break;
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir 		case FN_INSERT_SOFT_HYPHEN:
147*cdf0e10cSrcweir 		case FN_INSERT_HARDHYPHEN:
148*cdf0e10cSrcweir 		case FN_INSERT_HARD_SPACE:
149*cdf0e10cSrcweir 		case SID_INSERT_RLM :
150*cdf0e10cSrcweir 		case SID_INSERT_LRM :
151*cdf0e10cSrcweir 		case SID_INSERT_ZWNBSP :
152*cdf0e10cSrcweir 		case SID_INSERT_ZWSP:
153*cdf0e10cSrcweir 		case SID_CHARMAP:
154*cdf0e10cSrcweir 		{
155*cdf0e10cSrcweir 			SetCurrentFunction( FuBullet::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
156*cdf0e10cSrcweir 			Cancel();
157*cdf0e10cSrcweir 		}
158*cdf0e10cSrcweir 		break;
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir 		case SID_PRESENTATION_LAYOUT:
161*cdf0e10cSrcweir 		{
162*cdf0e10cSrcweir 			SetCurrentFunction( FuPresentationLayout::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
163*cdf0e10cSrcweir 			Cancel();
164*cdf0e10cSrcweir 		}
165*cdf0e10cSrcweir 		break;
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir         case SID_PASTE_SPECIAL:
168*cdf0e10cSrcweir 		{
169*cdf0e10cSrcweir 			SetCurrentFunction( FuInsertClipboard::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
170*cdf0e10cSrcweir 			Cancel();
171*cdf0e10cSrcweir 			rReq.Ignore ();
172*cdf0e10cSrcweir 		}
173*cdf0e10cSrcweir 		break;
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir 		case SID_INSERT_GRAPHIC:
176*cdf0e10cSrcweir 		{
177*cdf0e10cSrcweir 			SetCurrentFunction( FuInsertGraphic::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
178*cdf0e10cSrcweir 			Cancel();
179*cdf0e10cSrcweir 			rReq.Ignore ();
180*cdf0e10cSrcweir 			Invalidate(SID_DRAWTBX_INSERT);
181*cdf0e10cSrcweir 		}
182*cdf0e10cSrcweir 		break;
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir 		case SID_INSERT_AVMEDIA:
185*cdf0e10cSrcweir 		{
186*cdf0e10cSrcweir 			SetCurrentFunction( FuInsertAVMedia::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir 			Cancel();
189*cdf0e10cSrcweir 			rReq.Ignore ();
190*cdf0e10cSrcweir 
191*cdf0e10cSrcweir 			Invalidate(SID_DRAWTBX_INSERT);
192*cdf0e10cSrcweir 		}
193*cdf0e10cSrcweir 		break;
194*cdf0e10cSrcweir 
195*cdf0e10cSrcweir 		case SID_INSERT_OBJECT:
196*cdf0e10cSrcweir 		case SID_INSERT_PLUGIN:
197*cdf0e10cSrcweir 		case SID_INSERT_SOUND:
198*cdf0e10cSrcweir 		case SID_INSERT_VIDEO:
199*cdf0e10cSrcweir 		case SID_INSERT_FLOATINGFRAME:
200*cdf0e10cSrcweir 		case SID_INSERT_MATH:
201*cdf0e10cSrcweir 		case SID_INSERT_DIAGRAM:
202*cdf0e10cSrcweir 		case SID_ATTR_TABLE:
203*cdf0e10cSrcweir 		{
204*cdf0e10cSrcweir 			SetCurrentFunction( FuInsertOLE::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
205*cdf0e10cSrcweir 
206*cdf0e10cSrcweir 			Cancel();
207*cdf0e10cSrcweir 			rReq.Ignore ();
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir 			Invalidate(SID_DRAWTBX_INSERT);
210*cdf0e10cSrcweir 		}
211*cdf0e10cSrcweir 		break;
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir 		case SID_COPYOBJECTS:
214*cdf0e10cSrcweir 		{
215*cdf0e10cSrcweir 			if ( mpDrawView->IsPresObjSelected(sal_False, sal_True) )
216*cdf0e10cSrcweir 			{
217*cdf0e10cSrcweir                 ::sd::Window* pWindow = GetActiveWindow();
218*cdf0e10cSrcweir 				InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
219*cdf0e10cSrcweir 			}
220*cdf0e10cSrcweir 			else
221*cdf0e10cSrcweir 			{
222*cdf0e10cSrcweir 				if ( mpDrawView->IsTextEdit() )
223*cdf0e10cSrcweir 				{
224*cdf0e10cSrcweir 					mpDrawView->SdrEndTextEdit();
225*cdf0e10cSrcweir 				}
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir 				SetCurrentFunction( FuCopy::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
228*cdf0e10cSrcweir 			}
229*cdf0e10cSrcweir 			Cancel();
230*cdf0e10cSrcweir 			rReq.Ignore ();
231*cdf0e10cSrcweir 		}
232*cdf0e10cSrcweir 		break;
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir 		case SID_INSERTFILE:  // BASIC
235*cdf0e10cSrcweir 		{
236*cdf0e10cSrcweir             Broadcast (ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_START));
237*cdf0e10cSrcweir 			SetCurrentFunction( FuInsertFile::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
238*cdf0e10cSrcweir             Broadcast (ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_END));
239*cdf0e10cSrcweir 			Cancel();
240*cdf0e10cSrcweir 			rReq.Done ();
241*cdf0e10cSrcweir 
242*cdf0e10cSrcweir 			Invalidate(SID_DRAWTBX_INSERT);
243*cdf0e10cSrcweir 		}
244*cdf0e10cSrcweir 		break;
245*cdf0e10cSrcweir 
246*cdf0e10cSrcweir 		case SID_SELECT_BACKGROUND:
247*cdf0e10cSrcweir 		case SID_PAGESETUP:  // BASIC ??
248*cdf0e10cSrcweir 		{
249*cdf0e10cSrcweir 			SetCurrentFunction( FuPage::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
250*cdf0e10cSrcweir 			Cancel();
251*cdf0e10cSrcweir 			rReq.Ignore (); // es werden eigenstaendige macros generiert !!
252*cdf0e10cSrcweir 		}
253*cdf0e10cSrcweir 		break;
254*cdf0e10cSrcweir 
255*cdf0e10cSrcweir 		case SID_ZOOM_OUT:
256*cdf0e10cSrcweir 		case SID_ZOOM_PANNING:
257*cdf0e10cSrcweir 		{
258*cdf0e10cSrcweir 			mbZoomOnPage = sal_False;
259*cdf0e10cSrcweir 			SetCurrentFunction( FuZoom::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
260*cdf0e10cSrcweir 			// Beendet sich selbst, kein Cancel() notwendig!
261*cdf0e10cSrcweir 			Invalidate( SID_ZOOM_TOOLBOX );
262*cdf0e10cSrcweir 			rReq.Ignore ();
263*cdf0e10cSrcweir 		}
264*cdf0e10cSrcweir 		break;
265*cdf0e10cSrcweir 
266*cdf0e10cSrcweir 		case SID_BEFORE_OBJ:
267*cdf0e10cSrcweir 		case SID_BEHIND_OBJ:
268*cdf0e10cSrcweir 		{
269*cdf0e10cSrcweir 			SetCurrentFunction( FuDisplayOrder::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
270*cdf0e10cSrcweir 			Invalidate( SID_POSITION );
271*cdf0e10cSrcweir 			rReq.Ignore ();
272*cdf0e10cSrcweir 			// Beendet sich selbst, kein Cancel() notwendig!
273*cdf0e10cSrcweir 		}
274*cdf0e10cSrcweir 		break;
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir 		case SID_REVERSE_ORDER:   // BASIC
277*cdf0e10cSrcweir 		{
278*cdf0e10cSrcweir 			mpDrawView->ReverseOrderOfMarked();
279*cdf0e10cSrcweir 			Invalidate( SID_POSITION );
280*cdf0e10cSrcweir 			Cancel();
281*cdf0e10cSrcweir 			rReq.Done ();
282*cdf0e10cSrcweir 		}
283*cdf0e10cSrcweir 		break;
284*cdf0e10cSrcweir 
285*cdf0e10cSrcweir 		case SID_ANIMATION_EFFECTS:
286*cdf0e10cSrcweir 		{
287*cdf0e10cSrcweir 			SetCurrentFunction( FuObjectAnimationParameters::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
288*cdf0e10cSrcweir 			Cancel();
289*cdf0e10cSrcweir 		}
290*cdf0e10cSrcweir 		break;
291*cdf0e10cSrcweir 
292*cdf0e10cSrcweir 		case SID_LINEEND_POLYGON:
293*cdf0e10cSrcweir 		{
294*cdf0e10cSrcweir 			SetCurrentFunction( FuLineEnd::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
295*cdf0e10cSrcweir 			Cancel();
296*cdf0e10cSrcweir 		}
297*cdf0e10cSrcweir 		break;
298*cdf0e10cSrcweir 
299*cdf0e10cSrcweir 		case SID_CAPTUREPOINT:
300*cdf0e10cSrcweir 			// negative Werte um Aufruf aus Menue zu signalisieren
301*cdf0e10cSrcweir 			maMousePos = Point(-1,-1);
302*cdf0e10cSrcweir 		case SID_SET_SNAPITEM:
303*cdf0e10cSrcweir 		{
304*cdf0e10cSrcweir 			SetCurrentFunction( FuSnapLine::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
305*cdf0e10cSrcweir 			Cancel();
306*cdf0e10cSrcweir 		}
307*cdf0e10cSrcweir 		break;
308*cdf0e10cSrcweir 
309*cdf0e10cSrcweir 		case SID_MANAGE_LINKS:
310*cdf0e10cSrcweir 		{
311*cdf0e10cSrcweir 			SetCurrentFunction( FuLink::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
312*cdf0e10cSrcweir 			Cancel();
313*cdf0e10cSrcweir 			rReq.Ignore ();
314*cdf0e10cSrcweir 		}
315*cdf0e10cSrcweir 		break;
316*cdf0e10cSrcweir 
317*cdf0e10cSrcweir         case SID_THESAURUS:
318*cdf0e10cSrcweir 		{
319*cdf0e10cSrcweir 			SetCurrentFunction( FuThesaurus::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
320*cdf0e10cSrcweir 			Cancel();
321*cdf0e10cSrcweir 			rReq.Ignore ();
322*cdf0e10cSrcweir 		}
323*cdf0e10cSrcweir 		break;
324*cdf0e10cSrcweir 
325*cdf0e10cSrcweir 		case SID_TEXTATTR_DLG:
326*cdf0e10cSrcweir 		{
327*cdf0e10cSrcweir 			SetCurrentFunction( FuTextAttrDlg::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
328*cdf0e10cSrcweir 			Cancel();
329*cdf0e10cSrcweir 			rReq.Ignore ();
330*cdf0e10cSrcweir 		}
331*cdf0e10cSrcweir 		break;
332*cdf0e10cSrcweir 
333*cdf0e10cSrcweir 		case SID_MEASURE_DLG:
334*cdf0e10cSrcweir 		{
335*cdf0e10cSrcweir 			SetCurrentFunction( FuMeasureDlg::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
336*cdf0e10cSrcweir 			Cancel();
337*cdf0e10cSrcweir 			rReq.Ignore ();
338*cdf0e10cSrcweir 		}
339*cdf0e10cSrcweir 		break;
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir 		case SID_CONNECTION_DLG:
342*cdf0e10cSrcweir 		{
343*cdf0e10cSrcweir 			SetCurrentFunction( FuConnectionDlg::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
344*cdf0e10cSrcweir 			Cancel();
345*cdf0e10cSrcweir 			rReq.Done();
346*cdf0e10cSrcweir 		}
347*cdf0e10cSrcweir 		break;
348*cdf0e10cSrcweir 
349*cdf0e10cSrcweir 		case SID_CONNECTION_NEW_ROUTING:
350*cdf0e10cSrcweir 		{
351*cdf0e10cSrcweir 			SfxItemSet aDefAttr( GetPool(), SDRATTR_EDGELINE1DELTA, SDRATTR_EDGELINE3DELTA );
352*cdf0e10cSrcweir 			GetView()->SetAttributes( aDefAttr, sal_True ); // (ReplaceAll)
353*cdf0e10cSrcweir 
354*cdf0e10cSrcweir 			Cancel();
355*cdf0e10cSrcweir 			rReq.Done();
356*cdf0e10cSrcweir 		}
357*cdf0e10cSrcweir 		break;
358*cdf0e10cSrcweir 
359*cdf0e10cSrcweir         case SID_TWAIN_SELECT:
360*cdf0e10cSrcweir 		{
361*cdf0e10cSrcweir 			sal_Bool bDone = sal_False;
362*cdf0e10cSrcweir 
363*cdf0e10cSrcweir 			if( mxScannerManager.is() )
364*cdf0e10cSrcweir 			{
365*cdf0e10cSrcweir 				try
366*cdf0e10cSrcweir 				{
367*cdf0e10cSrcweir 					const ::com::sun::star::uno::Sequence< ::com::sun::star::scanner::ScannerContext >
368*cdf0e10cSrcweir 						aContexts( mxScannerManager->getAvailableScanners() );
369*cdf0e10cSrcweir 
370*cdf0e10cSrcweir 					if( aContexts.getLength() )
371*cdf0e10cSrcweir 					{
372*cdf0e10cSrcweir 						::com::sun::star::scanner::ScannerContext aContext( aContexts.getConstArray()[ 0 ] );
373*cdf0e10cSrcweir 						bDone = mxScannerManager->configureScanner( aContext );
374*cdf0e10cSrcweir 					}
375*cdf0e10cSrcweir 				}
376*cdf0e10cSrcweir 				catch(...)
377*cdf0e10cSrcweir 				{
378*cdf0e10cSrcweir                 }
379*cdf0e10cSrcweir 			}
380*cdf0e10cSrcweir 
381*cdf0e10cSrcweir             Cancel();
382*cdf0e10cSrcweir 			rReq.Done();
383*cdf0e10cSrcweir 		}
384*cdf0e10cSrcweir 		break;
385*cdf0e10cSrcweir 
386*cdf0e10cSrcweir         case SID_TWAIN_TRANSFER:
387*cdf0e10cSrcweir 		{
388*cdf0e10cSrcweir 			sal_Bool bDone = sal_False;
389*cdf0e10cSrcweir 
390*cdf0e10cSrcweir 			if( mxScannerManager.is() )
391*cdf0e10cSrcweir 			{
392*cdf0e10cSrcweir 				try
393*cdf0e10cSrcweir 				{
394*cdf0e10cSrcweir 					const ::com::sun::star::uno::Sequence< ::com::sun::star::scanner::ScannerContext > aContexts( mxScannerManager->getAvailableScanners() );
395*cdf0e10cSrcweir 
396*cdf0e10cSrcweir 					if( aContexts.getLength() )
397*cdf0e10cSrcweir 					{
398*cdf0e10cSrcweir 						mxScannerManager->startScan( aContexts.getConstArray()[ 0 ], mxScannerListener );
399*cdf0e10cSrcweir 						bDone = sal_True;
400*cdf0e10cSrcweir 					}
401*cdf0e10cSrcweir 				}
402*cdf0e10cSrcweir 				catch( ... )
403*cdf0e10cSrcweir 				{
404*cdf0e10cSrcweir 				}
405*cdf0e10cSrcweir 			}
406*cdf0e10cSrcweir 
407*cdf0e10cSrcweir 			if( !bDone )
408*cdf0e10cSrcweir 			{
409*cdf0e10cSrcweir #ifndef UNX
410*cdf0e10cSrcweir 				const sal_uInt16 nId = STR_TWAIN_NO_SOURCE;
411*cdf0e10cSrcweir #else
412*cdf0e10cSrcweir 				const sal_uInt16 nId = STR_TWAIN_NO_SOURCE_UNX;
413*cdf0e10cSrcweir #endif
414*cdf0e10cSrcweir 
415*cdf0e10cSrcweir                 ::sd::Window* pWindow = GetActiveWindow();
416*cdf0e10cSrcweir 				InfoBox(pWindow, String( SdResId( nId ) ) ).Execute();
417*cdf0e10cSrcweir 			}
418*cdf0e10cSrcweir 			else
419*cdf0e10cSrcweir 			{
420*cdf0e10cSrcweir 				SfxBindings& rBindings = GetViewFrame()->GetBindings();
421*cdf0e10cSrcweir 				rBindings.Invalidate( SID_TWAIN_SELECT );
422*cdf0e10cSrcweir 				rBindings.Invalidate( SID_TWAIN_TRANSFER );
423*cdf0e10cSrcweir 			}
424*cdf0e10cSrcweir 
425*cdf0e10cSrcweir             Cancel();
426*cdf0e10cSrcweir 			rReq.Done();
427*cdf0e10cSrcweir 		}
428*cdf0e10cSrcweir 		break;
429*cdf0e10cSrcweir 
430*cdf0e10cSrcweir 		case SID_POLYGON_MORPHING:
431*cdf0e10cSrcweir 		{
432*cdf0e10cSrcweir 			SetCurrentFunction( FuMorph::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
433*cdf0e10cSrcweir 			Cancel();
434*cdf0e10cSrcweir 		}
435*cdf0e10cSrcweir 		break;
436*cdf0e10cSrcweir 
437*cdf0e10cSrcweir 		case SID_VECTORIZE:
438*cdf0e10cSrcweir 		{
439*cdf0e10cSrcweir 			SetCurrentFunction( FuVectorize::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
440*cdf0e10cSrcweir 			Cancel();
441*cdf0e10cSrcweir 		}
442*cdf0e10cSrcweir 		break;
443*cdf0e10cSrcweir 
444*cdf0e10cSrcweir 		default:
445*cdf0e10cSrcweir 		{
446*cdf0e10cSrcweir 			// switch Anweisung wegen CLOOKS aufgeteilt. Alle case-Anweisungen die
447*cdf0e10cSrcweir 			// eine Fu???? -Funktion aufrufen, sind in die Methode FuTemp01 (drviews8),
448*cdf0e10cSrcweir 			// FuTemp02 (drviewsb) gewandert.
449*cdf0e10cSrcweir 			FuTemp02(rReq);
450*cdf0e10cSrcweir 		}
451*cdf0e10cSrcweir 		break;
452*cdf0e10cSrcweir 	}
453*cdf0e10cSrcweir }
454*cdf0e10cSrcweir 
455*cdf0e10cSrcweir /*************************************************************************
456*cdf0e10cSrcweir |*
457*cdf0e10cSrcweir |* Scanner-Event
458*cdf0e10cSrcweir |*
459*cdf0e10cSrcweir \************************************************************************/
460*cdf0e10cSrcweir 
461*cdf0e10cSrcweir void DrawViewShell::ScannerEvent( const ::com::sun::star::lang::EventObject& )
462*cdf0e10cSrcweir {
463*cdf0e10cSrcweir 	if( mxScannerManager.is() )
464*cdf0e10cSrcweir 	{
465*cdf0e10cSrcweir 		const ::com::sun::star::scanner::ScannerContext	aContext( mxScannerManager->getAvailableScanners().getConstArray()[ 0 ] );
466*cdf0e10cSrcweir 		const ::com::sun::star::scanner::ScanError		eError = mxScannerManager->getError( aContext );
467*cdf0e10cSrcweir 
468*cdf0e10cSrcweir 		if( ::com::sun::star::scanner::ScanError_ScanErrorNone == eError )
469*cdf0e10cSrcweir 		{
470*cdf0e10cSrcweir 			const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap > xBitmap( mxScannerManager->getBitmap( aContext ) );
471*cdf0e10cSrcweir 
472*cdf0e10cSrcweir 			if( xBitmap.is() )
473*cdf0e10cSrcweir 			{
474*cdf0e10cSrcweir 				const BitmapEx aScanBmp( VCLUnoHelper::GetBitmap( xBitmap ) );
475*cdf0e10cSrcweir 
476*cdf0e10cSrcweir 				if( !!aScanBmp )
477*cdf0e10cSrcweir 				{
478*cdf0e10cSrcweir                     const ::vos::OGuard aGuard( Application::GetSolarMutex() );
479*cdf0e10cSrcweir 		            SdrPage*            pPage = mpDrawView->GetSdrPageView()->GetPage();
480*cdf0e10cSrcweir             		Size                aBmpSize( aScanBmp.GetPrefSize() ), aPageSize( pPage->GetSize() );
481*cdf0e10cSrcweir                     const MapMode       aMap100( MAP_100TH_MM );
482*cdf0e10cSrcweir 
483*cdf0e10cSrcweir 		            if( !aBmpSize.Width() || !aBmpSize.Height() )
484*cdf0e10cSrcweir 			            aBmpSize = aScanBmp.GetSizePixel();
485*cdf0e10cSrcweir 
486*cdf0e10cSrcweir 		            if( aScanBmp.GetPrefMapMode().GetMapUnit() == MAP_PIXEL )
487*cdf0e10cSrcweir 			            aBmpSize = GetActiveWindow()->PixelToLogic( aBmpSize, aMap100 );
488*cdf0e10cSrcweir 		            else
489*cdf0e10cSrcweir 			            aBmpSize = OutputDevice::LogicToLogic( aBmpSize, aScanBmp.GetPrefMapMode(), aMap100 );
490*cdf0e10cSrcweir 
491*cdf0e10cSrcweir                     aPageSize.Width() -= pPage->GetLftBorder() + pPage->GetRgtBorder();
492*cdf0e10cSrcweir 		            aPageSize.Height() -= pPage->GetUppBorder() + pPage->GetLwrBorder();
493*cdf0e10cSrcweir 
494*cdf0e10cSrcweir 		            if( ( ( aBmpSize.Height() > aPageSize.Height() ) || ( aBmpSize.Width() > aPageSize.Width() ) ) && aBmpSize.Height() && aPageSize.Height() )
495*cdf0e10cSrcweir 		            {
496*cdf0e10cSrcweir 			            double fGrfWH = (double) aBmpSize.Width() / aBmpSize.Height();
497*cdf0e10cSrcweir 			            double fWinWH = (double) aPageSize.Width() / aPageSize.Height();
498*cdf0e10cSrcweir 
499*cdf0e10cSrcweir 			            if( fGrfWH < fWinWH )
500*cdf0e10cSrcweir 			            {
501*cdf0e10cSrcweir 				            aBmpSize.Width() = FRound( aPageSize.Height() * fGrfWH );
502*cdf0e10cSrcweir 				            aBmpSize.Height()= aPageSize.Height();
503*cdf0e10cSrcweir 			            }
504*cdf0e10cSrcweir 			            else if( fGrfWH > 0.F )
505*cdf0e10cSrcweir 			            {
506*cdf0e10cSrcweir 				            aBmpSize.Width() = aPageSize.Width();
507*cdf0e10cSrcweir 				            aBmpSize.Height()= FRound( aPageSize.Width() / fGrfWH );
508*cdf0e10cSrcweir 			            }
509*cdf0e10cSrcweir 		            }
510*cdf0e10cSrcweir 
511*cdf0e10cSrcweir 		            Point aPnt ( ( aPageSize.Width() - aBmpSize.Width() ) >> 1, ( aPageSize.Height() - aBmpSize.Height() ) >> 1 );
512*cdf0e10cSrcweir                     aPnt += Point( pPage->GetLftBorder(), pPage->GetUppBorder() );
513*cdf0e10cSrcweir 		            Rectangle   aRect( aPnt, aBmpSize );
514*cdf0e10cSrcweir 		            SdrGrafObj* pGrafObj = NULL;
515*cdf0e10cSrcweir                     sal_Bool        bInsertNewObject = sal_True;
516*cdf0e10cSrcweir 
517*cdf0e10cSrcweir 		            if( GetView()->AreObjectsMarked() )
518*cdf0e10cSrcweir 		            {
519*cdf0e10cSrcweir 			            const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
520*cdf0e10cSrcweir 
521*cdf0e10cSrcweir 			            if( rMarkList.GetMarkCount() == 1 )
522*cdf0e10cSrcweir 			            {
523*cdf0e10cSrcweir 				            SdrMark*    pMark = rMarkList.GetMark(0);
524*cdf0e10cSrcweir 				            SdrObject*  pObj = pMark->GetMarkedSdrObj();
525*cdf0e10cSrcweir 
526*cdf0e10cSrcweir 				            if( pObj->ISA( SdrGrafObj ) )
527*cdf0e10cSrcweir 				            {
528*cdf0e10cSrcweir 					            pGrafObj = static_cast< SdrGrafObj* >( pObj );
529*cdf0e10cSrcweir 
530*cdf0e10cSrcweir 					            if( pGrafObj->IsEmptyPresObj() )
531*cdf0e10cSrcweir 					            {
532*cdf0e10cSrcweir 						            bInsertNewObject = sal_False;
533*cdf0e10cSrcweir 						            pGrafObj->SetEmptyPresObj(sal_False);
534*cdf0e10cSrcweir 						            pGrafObj->SetOutlinerParaObject(NULL);
535*cdf0e10cSrcweir 						            pGrafObj->SetGraphic( Graphic( aScanBmp ) );
536*cdf0e10cSrcweir 					            }
537*cdf0e10cSrcweir 				            }
538*cdf0e10cSrcweir 			            }
539*cdf0e10cSrcweir 		            }
540*cdf0e10cSrcweir 
541*cdf0e10cSrcweir 		            if( bInsertNewObject )
542*cdf0e10cSrcweir 		            {
543*cdf0e10cSrcweir 			            pGrafObj = new SdrGrafObj( Graphic( aScanBmp ), aRect );
544*cdf0e10cSrcweir 			            SdrPageView* pPV = GetView()->GetSdrPageView();
545*cdf0e10cSrcweir 			            GetView()->InsertObjectAtView( pGrafObj, *pPV, SDRINSERT_SETDEFLAYER );
546*cdf0e10cSrcweir 		            }
547*cdf0e10cSrcweir 				}
548*cdf0e10cSrcweir 			}
549*cdf0e10cSrcweir 		}
550*cdf0e10cSrcweir 	}
551*cdf0e10cSrcweir 
552*cdf0e10cSrcweir 	SfxBindings& rBindings = GetViewFrame()->GetBindings();
553*cdf0e10cSrcweir 	rBindings.Invalidate( SID_TWAIN_SELECT );
554*cdf0e10cSrcweir 	rBindings.Invalidate( SID_TWAIN_TRANSFER );
555*cdf0e10cSrcweir }
556*cdf0e10cSrcweir 
557*cdf0e10cSrcweir } // end of namespace sd
558