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