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