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