Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : #include <com/sun/star/presentation/XPresentation2.hpp>
22 : #include <com/sun/star/form/FormButtonType.hpp>
23 : #include <com/sun/star/beans/XPropertySet.hpp>
24 : #include <com/sun/star/i18n/TransliterationModules.hpp>
25 : #include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
26 : #include <com/sun/star/beans/PropertyValue.hpp>
27 : #include <com/sun/star/uno/Any.hxx>
28 :
29 : #include <comphelper/processfactory.hxx>
30 :
31 : #include "undo/undomanager.hxx"
32 : #include <vcl/waitobj.hxx>
33 : #include <svl/aeitem.hxx>
34 : #include <editeng/editstat.hxx>
35 : #include <vcl/msgbox.hxx>
36 : #include <svl/urlbmk.hxx>
37 : #include <svx/svdpagv.hxx>
38 : #include <svx/fmshell.hxx>
39 : #include <vcl/scrbar.hxx>
40 : #include <svx/svdopath.hxx>
41 : #include <svx/svdundo.hxx>
42 : #include <svx/svdorect.hxx>
43 : #include <svx/svdograf.hxx>
44 : #include <svl/eitem.hxx>
45 : #include <editeng/eeitem.hxx>
46 : #include <sfx2/dispatch.hxx>
47 : #include <sfx2/viewfrm.hxx>
48 : #include <sfx2/request.hxx>
49 : #include <svx/svxids.hrc>
50 : #include <editeng/flditem.hxx>
51 : #include <svx/ruler.hxx>
52 : #include <svx/obj3d.hxx>
53 : #include <svx/fmglob.hxx>
54 : #include <svx/svdouno.hxx>
55 : #include <svx/dataaccessdescriptor.hxx>
56 : #include <tools/urlobj.hxx>
57 : #include <svl/slstitm.hxx>
58 : #include <sfx2/ipclient.hxx>
59 : #include <toolkit/helper/vclunohelper.hxx>
60 : #include <avmedia/mediawindow.hxx>
61 : #include <svl/urihelper.hxx>
62 : #include <sfx2/docfile.hxx>
63 :
64 : #include "DrawViewShell.hxx"
65 : #include "slideshow.hxx"
66 : #include "ViewShellImplementation.hxx"
67 : #include "ViewShellHint.hxx"
68 : #include "framework/FrameworkHelper.hxx"
69 : #include "app.hrc"
70 : #include "glob.hrc"
71 : #include "strings.hrc"
72 : #include "res_bmp.hrc"
73 : #include "drawdoc.hxx"
74 : #include "fusel.hxx"
75 : #include "futext.hxx"
76 : #include "fuconrec.hxx"
77 : #include "fuconcs.hxx"
78 : #include "fuconuno.hxx"
79 : #include "fuconbez.hxx"
80 : #include "fuediglu.hxx"
81 : #include "fuconarc.hxx"
82 : #include "fucon3d.hxx"
83 : #include "sdresid.hxx"
84 : #include "Outliner.hxx"
85 : #include "PresentationViewShell.hxx"
86 : #include "sdpage.hxx"
87 : #include "FrameView.hxx"
88 : #include "zoomlist.hxx"
89 : #include "drawview.hxx"
90 : #include "DrawDocShell.hxx"
91 : #include "sdattr.hxx"
92 : #include "ViewShellBase.hxx"
93 : #include "ToolBarManager.hxx"
94 : #include "anminfo.hxx"
95 : #include "optsitem.hxx"
96 : #include "Window.hxx"
97 : #include "fuformatpaintbrush.hxx"
98 :
99 : using namespace ::com::sun::star;
100 : using namespace ::com::sun::star::uno;
101 : using namespace ::com::sun::star::presentation;
102 : using namespace ::com::sun::star::beans;
103 :
104 : namespace sd {
105 :
106 : // Permanent Functions
107 :
108 0 : void ImpAddPrintableCharactersToTextEdit(SfxRequest& rReq, ::sd::View* pView)
109 : {
110 : // evtl. feed characters to activated textedit
111 0 : const SfxItemSet* pSet = rReq.GetArgs();
112 :
113 0 : if(pSet)
114 : {
115 0 : OUString aInputString;
116 :
117 0 : if(SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_CHAR))
118 0 : aInputString = ((SfxStringItem&)pSet->Get(SID_ATTR_CHAR)).GetValue();
119 :
120 0 : if(!aInputString.isEmpty())
121 : {
122 0 : OutlinerView* pOLV = pView->GetTextEditOutlinerView();
123 :
124 0 : if(pOLV)
125 : {
126 0 : for(sal_Int32 a(0); a < aInputString.getLength(); a++)
127 : {
128 0 : sal_Char aChar = (sal_Char)aInputString[a];
129 0 : KeyCode aKeyCode;
130 0 : KeyEvent aKeyEvent(aChar, aKeyCode);
131 :
132 : // add actual character
133 0 : pOLV->PostKeyEvent(aKeyEvent);
134 : }
135 : }
136 0 : }
137 : }
138 0 : }
139 :
140 0 : void DrawViewShell::FuPermanent(SfxRequest& rReq)
141 : {
142 : // We do not execute a thing during a native slide show
143 :
144 0 : if (SlideShow::IsRunning(GetViewShellBase()))
145 0 : return;
146 :
147 0 : sal_uInt16 nSId = rReq.GetSlot();
148 :
149 0 : if( HasCurrentFunction() &&
150 0 : ( nSId == SID_TEXTEDIT || nSId == SID_ATTR_CHAR || nSId == SID_TEXT_FITTOSIZE ||
151 0 : nSId == SID_ATTR_CHAR_VERTICAL || nSId == SID_TEXT_FITTOSIZE_VERTICAL ) )
152 : {
153 0 : rtl::Reference<FuPoor> xFunc( GetCurrentFunction() );
154 :
155 0 : FuText* pFuText = dynamic_cast< FuText* >( xFunc.get() );
156 :
157 0 : if( pFuText )
158 : {
159 0 : pFuText->SetPermanent(sal_True);
160 0 : xFunc->ReceiveRequest( rReq );
161 :
162 0 : MapSlot( nSId );
163 :
164 0 : Invalidate();
165 :
166 0 : Invalidate();
167 :
168 : // evtl. feed characters to activated textedit
169 0 : if(SID_ATTR_CHAR == nSId && GetView() && GetView()->IsTextEdit())
170 0 : ImpAddPrintableCharactersToTextEdit(rReq, GetView());
171 :
172 0 : rReq.Done();
173 0 : return;
174 0 : }
175 : }
176 :
177 0 : CheckLineTo (rReq);
178 0 : sal_uInt16 nOldSId = 0;
179 0 : sal_Bool bPermanent = sal_False;
180 :
181 0 : if( !mpDrawView )
182 0 : return;
183 :
184 0 : if(HasCurrentFunction())
185 : {
186 0 : if( (nSId == SID_FORMATPAINTBRUSH) && (GetCurrentFunction()->GetSlotID() == SID_TEXTEDIT) )
187 : {
188 : // save text edit mode for format paintbrush!
189 0 : SetOldFunction( GetCurrentFunction() );
190 : }
191 : else
192 : {
193 0 : if(GetOldFunction() == GetCurrentFunction())
194 : {
195 0 : SetOldFunction(0);
196 : }
197 : }
198 :
199 0 : if ( nSId != SID_TEXTEDIT && nSId != SID_ATTR_CHAR && nSId != SID_TEXT_FITTOSIZE &&
200 0 : nSId != SID_ATTR_CHAR_VERTICAL && nSId != SID_TEXT_FITTOSIZE_VERTICAL &&
201 0 : nSId != SID_FORMATPAINTBRUSH &&
202 0 : mpDrawView->IsTextEdit() )
203 : {
204 0 : mpDrawView->SdrEndTextEdit();
205 : }
206 :
207 0 : if( HasCurrentFunction() )
208 : {
209 0 : nOldSId = GetCurrentFunction()->GetSlotID();
210 :
211 0 : if (nOldSId == nSId ||
212 0 : ((nOldSId == SID_TEXTEDIT || nOldSId == SID_ATTR_CHAR || nOldSId == SID_TEXT_FITTOSIZE ||
213 0 : nOldSId == SID_ATTR_CHAR_VERTICAL || nOldSId == SID_TEXT_FITTOSIZE_VERTICAL) &&
214 0 : (nSId == SID_TEXTEDIT || nSId == SID_ATTR_CHAR || nSId == SID_TEXT_FITTOSIZE ||
215 0 : nSId == SID_ATTR_CHAR_VERTICAL || nSId == SID_TEXT_FITTOSIZE_VERTICAL )))
216 : {
217 0 : bPermanent = sal_True;
218 : }
219 :
220 0 : GetCurrentFunction()->Deactivate();
221 : }
222 :
223 0 : SetCurrentFunction(0);
224 :
225 0 : SfxBindings& rBind = GetViewFrame()->GetBindings();
226 0 : rBind.Invalidate(nOldSId);
227 0 : rBind.Update(nOldSId);
228 : }
229 :
230 : // map Slot (ToolboxImages/-Slots)
231 0 : MapSlot( nSId );
232 :
233 0 : switch ( nSId )
234 : {
235 : case SID_TEXTEDIT: // BASIC ???
236 : case SID_ATTR_CHAR:
237 : case SID_ATTR_CHAR_VERTICAL:
238 : case SID_TEXT_FITTOSIZE:
239 : case SID_TEXT_FITTOSIZE_VERTICAL:
240 : {
241 0 : SetCurrentFunction( FuText::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
242 0 : GetCurrentFunction()->DoExecute(rReq);
243 :
244 0 : SfxBindings& rBindings = GetViewFrame()->GetBindings();
245 0 : rBindings.Invalidate( SID_ATTR_CHAR );
246 0 : rBindings.Invalidate( SID_ATTR_CHAR_VERTICAL );
247 0 : rBindings.Invalidate( SID_TEXT_FITTOSIZE );
248 0 : rBindings.Invalidate( SID_TEXT_FITTOSIZE_VERTICAL );
249 :
250 : // evtl. feed characters to activated textedit
251 0 : if(SID_ATTR_CHAR == nSId && GetView() && GetView()->IsTextEdit())
252 0 : ImpAddPrintableCharactersToTextEdit(rReq, GetView());
253 :
254 0 : rReq.Done();
255 : }
256 0 : break;
257 :
258 : case SID_FM_CREATE_CONTROL:
259 : {
260 0 : SetCurrentFunction( FuConstructUnoControl::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq, bPermanent ) );
261 0 : rReq.Done();
262 : }
263 0 : break;
264 :
265 : case SID_FM_CREATE_FIELDCONTROL:
266 : {
267 0 : SFX_REQUEST_ARG( rReq, pDescriptorItem, SfxUnoAnyItem, SID_FM_DATACCESS_DESCRIPTOR, false );
268 : DBG_ASSERT( pDescriptorItem, "DrawViewShell::FuPermanent(SID_FM_CREATE_FIELDCONTROL): invalid request args!" );
269 :
270 0 : if(pDescriptorItem)
271 : {
272 : // get the form view
273 0 : FmFormView* pFormView = PTR_CAST(FmFormView, mpDrawView);
274 0 : SdrPageView* pPageView = pFormView ? pFormView->GetSdrPageView() : NULL;
275 :
276 0 : if(pPageView)
277 : {
278 0 : ::svx::ODataAccessDescriptor aDescriptor(pDescriptorItem->GetValue());
279 0 : SdrObject* pNewDBField = pFormView->CreateFieldControl(aDescriptor);
280 :
281 0 : if(pNewDBField)
282 : {
283 0 : Rectangle aVisArea = GetActiveWindow()->PixelToLogic(Rectangle(Point(0,0), GetActiveWindow()->GetOutputSizePixel()));
284 0 : Point aObjPos(aVisArea.Center());
285 0 : Size aObjSize(pNewDBField->GetLogicRect().GetSize());
286 0 : aObjPos.X() -= aObjSize.Width() / 2;
287 0 : aObjPos.Y() -= aObjSize.Height() / 2;
288 0 : Rectangle aNewObjectRectangle(aObjPos, aObjSize);
289 :
290 0 : pNewDBField->SetLogicRect(aNewObjectRectangle);
291 :
292 0 : GetView()->InsertObjectAtView(pNewDBField, *pPageView);
293 0 : }
294 : }
295 : }
296 0 : rReq.Done();
297 : }
298 0 : break;
299 :
300 : case SID_OBJECT_SELECT:
301 : case SID_OBJECT_ROTATE:
302 : case SID_OBJECT_MIRROR:
303 : case SID_OBJECT_CROP:
304 : case SID_OBJECT_TRANSPARENCE:
305 : case SID_OBJECT_GRADIENT:
306 : case SID_OBJECT_SHEAR:
307 : case SID_OBJECT_CROOK_ROTATE:
308 : case SID_OBJECT_CROOK_SLANT:
309 : case SID_OBJECT_CROOK_STRETCH:
310 : case SID_CONVERT_TO_3D_LATHE:
311 : {
312 0 : short nSlotId = rReq.GetSlot();
313 :
314 0 : if( nSlotId == SID_OBJECT_ROTATE )
315 : {
316 : // toggle rotation
317 0 : if( nOldSId == nSlotId )
318 : {
319 0 : nSlotId = SID_OBJECT_SELECT;
320 0 : rReq.SetSlot( nSlotId );
321 : }
322 : }
323 :
324 0 : if (nSlotId == SID_OBJECT_CROOK_ROTATE ||
325 0 : nSlotId == SID_OBJECT_CROOK_SLANT ||
326 : nSlotId == SID_OBJECT_CROOK_STRETCH)
327 : {
328 0 : if ( mpDrawView->GetMarkedObjectList().GetMarkCount() > 0 &&
329 0 : !mpDrawView->IsCrookAllowed( mpDrawView->IsCrookNoContortion() ) )
330 : {
331 0 : if ( mpDrawView->IsPresObjSelected() )
332 : {
333 0 : ::sd::Window* pWindow = GetActiveWindow();
334 0 : InfoBox(pWindow, SD_RESSTR(STR_ACTION_NOTPOSSIBLE) ).Execute();
335 : }
336 0 : else if ( QueryBox(GetActiveWindow(), WB_YES_NO,
337 : SD_RESSTR(STR_ASK_FOR_CONVERT_TO_BEZIER)
338 0 : ).Execute() == RET_YES )
339 : {
340 : // implicit transformation into bezier
341 0 : WaitObject aWait( (Window*)GetActiveWindow() );
342 0 : mpDrawView->ConvertMarkedToPathObj(false);
343 : }
344 0 : }
345 : }
346 0 : else if (nSlotId == SID_OBJECT_SHEAR)
347 : {
348 0 : sal_uLong i = 0;
349 0 : const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
350 0 : sal_uLong nMarkCnt = rMarkList.GetMarkCount();
351 0 : sal_Bool b3DObjMarked = sal_False;
352 :
353 0 : while (i < nMarkCnt && !b3DObjMarked)
354 : {
355 0 : if (rMarkList.GetMark(i)->GetMarkedSdrObj()->ISA(E3dObject))
356 : {
357 0 : b3DObjMarked = sal_True;
358 : }
359 : else
360 : {
361 0 : i++;
362 : }
363 : }
364 :
365 0 : if ( nMarkCnt > 0 && !b3DObjMarked &&
366 0 : (!mpDrawView->IsShearAllowed() || !mpDrawView->IsDistortAllowed()) )
367 : {
368 0 : if ( mpDrawView->IsPresObjSelected() )
369 : {
370 0 : ::sd::Window* pWindow = GetActiveWindow();
371 0 : InfoBox(pWindow, SD_RESSTR(STR_ACTION_NOTPOSSIBLE) ).Execute();
372 : }
373 0 : else if ( QueryBox(GetActiveWindow(), WB_YES_NO,
374 : SD_RESSTR(STR_ASK_FOR_CONVERT_TO_BEZIER)
375 0 : ).Execute() == RET_YES )
376 : {
377 : // implicit transformation into bezier
378 0 : WaitObject aWait( (Window*)GetActiveWindow() );
379 0 : mpDrawView->ConvertMarkedToPathObj(false);
380 : }
381 : }
382 : }
383 :
384 0 : SetCurrentFunction( FuSelection::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
385 0 : rReq.Done();
386 0 : Invalidate( SID_OBJECT_SELECT );
387 : }
388 0 : break;
389 :
390 : case SID_DRAW_LINE:
391 : case SID_DRAW_XLINE:
392 : case SID_DRAW_MEASURELINE:
393 : case SID_LINE_ARROW_START:
394 : case SID_LINE_ARROW_END:
395 : case SID_LINE_ARROWS:
396 : case SID_LINE_ARROW_CIRCLE:
397 : case SID_LINE_CIRCLE_ARROW:
398 : case SID_LINE_ARROW_SQUARE:
399 : case SID_LINE_SQUARE_ARROW:
400 :
401 : case SID_DRAW_RECT:
402 : case SID_DRAW_RECT_NOFILL:
403 : case SID_DRAW_RECT_ROUND:
404 : case SID_DRAW_RECT_ROUND_NOFILL:
405 : case SID_DRAW_SQUARE:
406 : case SID_DRAW_SQUARE_NOFILL:
407 : case SID_DRAW_SQUARE_ROUND:
408 : case SID_DRAW_SQUARE_ROUND_NOFILL:
409 : case SID_DRAW_ELLIPSE:
410 : case SID_DRAW_ELLIPSE_NOFILL:
411 : case SID_DRAW_CIRCLE:
412 : case SID_DRAW_CIRCLE_NOFILL:
413 : case SID_DRAW_CAPTION:
414 : case SID_DRAW_CAPTION_VERTICAL:
415 : case SID_TOOL_CONNECTOR:
416 : case SID_CONNECTOR_ARROW_START:
417 : case SID_CONNECTOR_ARROW_END:
418 : case SID_CONNECTOR_ARROWS:
419 : case SID_CONNECTOR_CIRCLE_START:
420 : case SID_CONNECTOR_CIRCLE_END:
421 : case SID_CONNECTOR_CIRCLES:
422 : case SID_CONNECTOR_LINE:
423 : case SID_CONNECTOR_LINE_ARROW_START:
424 : case SID_CONNECTOR_LINE_ARROW_END:
425 : case SID_CONNECTOR_LINE_ARROWS:
426 : case SID_CONNECTOR_LINE_CIRCLE_START:
427 : case SID_CONNECTOR_LINE_CIRCLE_END:
428 : case SID_CONNECTOR_LINE_CIRCLES:
429 : case SID_CONNECTOR_CURVE:
430 : case SID_CONNECTOR_CURVE_ARROW_START:
431 : case SID_CONNECTOR_CURVE_ARROW_END:
432 : case SID_CONNECTOR_CURVE_ARROWS:
433 : case SID_CONNECTOR_CURVE_CIRCLE_START:
434 : case SID_CONNECTOR_CURVE_CIRCLE_END:
435 : case SID_CONNECTOR_CURVE_CIRCLES:
436 : case SID_CONNECTOR_LINES:
437 : case SID_CONNECTOR_LINES_ARROW_START:
438 : case SID_CONNECTOR_LINES_ARROW_END:
439 : case SID_CONNECTOR_LINES_ARROWS:
440 : case SID_CONNECTOR_LINES_CIRCLE_START:
441 : case SID_CONNECTOR_LINES_CIRCLE_END:
442 : case SID_CONNECTOR_LINES_CIRCLES:
443 : {
444 0 : SetCurrentFunction( FuConstructRectangle::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq, bPermanent ) );
445 0 : rReq.Done();
446 : }
447 0 : break;
448 : case SID_DRAW_POLYGON:
449 : case SID_DRAW_POLYGON_NOFILL:
450 : case SID_DRAW_XPOLYGON:
451 : case SID_DRAW_XPOLYGON_NOFILL:
452 : case SID_DRAW_FREELINE:
453 : case SID_DRAW_FREELINE_NOFILL:
454 : case SID_DRAW_BEZIER_FILL: // BASIC
455 : case SID_DRAW_BEZIER_NOFILL: // BASIC
456 : {
457 0 : SetCurrentFunction( FuConstructBezierPolygon::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq, bPermanent) );
458 0 : rReq.Done();
459 : }
460 0 : break;
461 :
462 : case SID_GLUE_EDITMODE:
463 : {
464 0 : if (nOldSId != SID_GLUE_EDITMODE)
465 : {
466 0 : SetCurrentFunction( FuEditGluePoints::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq, bPermanent ) );
467 : }
468 : else
469 : {
470 0 : GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
471 : }
472 :
473 0 : rReq.Done();
474 : }
475 0 : break;
476 :
477 : case SID_DRAW_ARC:
478 : case SID_DRAW_CIRCLEARC:
479 : case SID_DRAW_PIE:
480 : case SID_DRAW_PIE_NOFILL:
481 : case SID_DRAW_CIRCLEPIE:
482 : case SID_DRAW_CIRCLEPIE_NOFILL:
483 : case SID_DRAW_ELLIPSECUT:
484 : case SID_DRAW_ELLIPSECUT_NOFILL:
485 : case SID_DRAW_CIRCLECUT:
486 : case SID_DRAW_CIRCLECUT_NOFILL:
487 : {
488 0 : SetCurrentFunction( FuConstructArc::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq, bPermanent) );
489 0 : rReq.Done();
490 : }
491 0 : break;
492 :
493 : case SID_3D_CUBE:
494 : case SID_3D_SHELL:
495 : case SID_3D_SPHERE:
496 : case SID_3D_TORUS:
497 : case SID_3D_HALF_SPHERE:
498 : case SID_3D_CYLINDER:
499 : case SID_3D_CONE:
500 : case SID_3D_PYRAMID:
501 : {
502 0 : SetCurrentFunction( FuConstruct3dObject::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq, bPermanent ) );
503 0 : rReq.Done();
504 : }
505 0 : break;
506 :
507 : case SID_DRAWTBX_CS_BASIC :
508 : case SID_DRAWTBX_CS_SYMBOL :
509 : case SID_DRAWTBX_CS_ARROW :
510 : case SID_DRAWTBX_CS_FLOWCHART :
511 : case SID_DRAWTBX_CS_CALLOUT :
512 : case SID_DRAWTBX_CS_STAR :
513 : case SID_DRAW_CS_ID :
514 : {
515 0 : SetCurrentFunction( FuConstructCustomShape::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq, bPermanent ) );
516 0 : rReq.Done();
517 :
518 0 : if ( nSId != SID_DRAW_CS_ID )
519 : {
520 0 : SfxBindings& rBind = GetViewFrame()->GetBindings();
521 0 : rBind.Invalidate( nSId );
522 0 : rBind.Update( nSId );
523 : }
524 : }
525 0 : break;
526 :
527 : case SID_FORMATPAINTBRUSH:
528 : {
529 0 : SetCurrentFunction( FuFormatPaintBrush::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
530 0 : rReq.Done();
531 0 : SfxBindings& rBind = GetViewFrame()->GetBindings();
532 0 : rBind.Invalidate( nSId );
533 0 : rBind.Update( nSId );
534 0 : break;
535 : }
536 :
537 : default:
538 0 : break;
539 : }
540 :
541 0 : if(HasOldFunction())
542 : {
543 0 : sal_uInt16 nSlotId = GetOldFunction()->GetSlotID();
544 :
545 0 : GetOldFunction()->Deactivate();
546 0 : SetOldFunction(0);
547 :
548 0 : SfxBindings& rBind = GetViewFrame()->GetBindings();
549 0 : rBind.Invalidate( nSlotId );
550 0 : rBind.Update( nSlotId );
551 : }
552 :
553 0 : if(HasCurrentFunction())
554 : {
555 0 : GetCurrentFunction()->Activate();
556 0 : SetOldFunction( GetCurrentFunction() );
557 :
558 0 : SetHelpId( GetCurrentFunction()->GetSlotID() );
559 : }
560 :
561 : // invalidate shell, is faster than every individually (says MI)
562 : // now explicit the last slot incl. Update()
563 0 : Invalidate();
564 :
565 : // CTRL-SID_OBJECT_SELECT -> select first draw object if none is selected yet
566 0 : if(SID_OBJECT_SELECT == nSId && HasCurrentFunction() && (rReq.GetModifier() & KEY_MOD1))
567 : {
568 0 : if(!GetView()->AreObjectsMarked())
569 : {
570 : // select first object
571 0 : GetView()->UnmarkAllObj();
572 0 : GetView()->MarkNextObj(true);
573 :
574 : // ...and make it visible
575 0 : if(GetView()->AreObjectsMarked())
576 0 : GetView()->MakeVisible(GetView()->GetAllMarkedRect(), *GetActiveWindow());
577 : }
578 : }
579 :
580 : // with qualifier construct directly
581 0 : if(HasCurrentFunction() && (rReq.GetModifier() & KEY_MOD1))
582 : {
583 : // get SdOptions
584 0 : SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType());
585 0 : sal_uInt32 nDefaultObjectSizeWidth(pOptions->GetDefaultObjectSizeWidth());
586 0 : sal_uInt32 nDefaultObjectSizeHeight(pOptions->GetDefaultObjectSizeHeight());
587 :
588 : // calc position and size
589 0 : Rectangle aVisArea = GetActiveWindow()->PixelToLogic(Rectangle(Point(0,0), GetActiveWindow()->GetOutputSizePixel()));
590 0 : Point aPagePos = aVisArea.Center();
591 0 : aPagePos.X() -= nDefaultObjectSizeWidth / 2;
592 0 : aPagePos.Y() -= nDefaultObjectSizeHeight / 2;
593 0 : Rectangle aNewObjectRectangle(aPagePos, Size(nDefaultObjectSizeWidth, nDefaultObjectSizeHeight));
594 0 : SdrPageView* pPageView = mpDrawView->GetSdrPageView();
595 :
596 0 : if(pPageView)
597 : {
598 : // create the default object
599 0 : SdrObject* pObj = GetCurrentFunction()->CreateDefaultObject(nSId, aNewObjectRectangle);
600 :
601 0 : if(pObj)
602 : {
603 : // insert into page
604 0 : GetView()->InsertObjectAtView(pObj, *pPageView);
605 :
606 : // Now that pFuActual has done what it was created for we
607 : // can switch on the edit mode for callout objects.
608 0 : switch (nSId)
609 : {
610 : case SID_DRAW_CAPTION:
611 : case SID_DRAW_CAPTION_VERTICAL:
612 : {
613 : // Make FuText the current function.
614 0 : SfxUInt16Item aItem (SID_TEXTEDIT, 1);
615 : GetViewFrame()->GetDispatcher()->
616 : Execute(SID_TEXTEDIT, SFX_CALLMODE_SYNCHRON |
617 0 : SFX_CALLMODE_RECORD, &aItem, 0L);
618 : // Put text object into edit mode.
619 0 : GetView()->SdrBeginTextEdit(static_cast<SdrTextObj*>(pObj), pPageView);
620 0 : break;
621 : }
622 : }
623 : }
624 : }
625 : }
626 : }
627 :
628 0 : void DrawViewShell::FuSupport(SfxRequest& rReq)
629 : {
630 0 : if( rReq.GetSlot() == SID_STYLE_FAMILY && rReq.GetArgs())
631 0 : GetDocSh()->SetStyleFamily(((SfxUInt16Item&)rReq.GetArgs()->Get( SID_STYLE_FAMILY )).GetValue());
632 :
633 : // We do not execute a thing during a native slide show
634 0 : if(SlideShow::IsRunning(GetViewShellBase()) &&
635 0 : (rReq.GetSlot() != SID_PRESENTATION_END &&
636 0 : rReq.GetSlot() != SID_SIZE_PAGE))
637 0 : return;
638 :
639 0 : CheckLineTo (rReq);
640 :
641 0 : if( !mpDrawView )
642 0 : return;
643 :
644 0 : sal_uInt16 nSId = rReq.GetSlot();
645 :
646 : // maybe we map the slot (ToolboxImages/-Slots)
647 0 : MapSlot( nSId );
648 :
649 0 : switch ( nSId )
650 : {
651 : case SID_CLEAR_UNDO_STACK:
652 : {
653 0 : GetDocSh()->ClearUndoBuffer();
654 0 : rReq.Ignore ();
655 : }
656 0 : break;
657 :
658 : // execute slots of ToolboxController mapped
659 : case SID_OBJECT_CHOOSE_MODE:
660 : case SID_POSITION:
661 : case SID_OBJECT_ALIGN:
662 : case SID_ZOOM_TOOLBOX:
663 : case SID_DRAWTBX_TEXT:
664 : case SID_DRAWTBX_RECTANGLES:
665 : case SID_DRAWTBX_ELLIPSES:
666 : case SID_DRAWTBX_LINES:
667 : case SID_DRAWTBX_ARROWS:
668 : case SID_DRAWTBX_3D_OBJECTS:
669 : case SID_DRAWTBX_CONNECTORS:
670 : case SID_DRAWTBX_INSERT:
671 : {
672 0 : sal_uInt16 nMappedSlot = GetMappedSlot( nSId );
673 0 : if( nMappedSlot > 0 )
674 : {
675 0 : SfxRequest aReq( nMappedSlot, 0, GetDoc()->GetItemPool() );
676 0 : ExecuteSlot( aReq );
677 : }
678 : }
679 0 : break;
680 :
681 : case SID_PRESENTATION:
682 : case SID_PRESENTATION_CURRENT_SLIDE:
683 : case SID_REHEARSE_TIMINGS:
684 : {
685 0 : ShowSlideShow(rReq);
686 0 : rReq.Ignore ();
687 : }
688 0 : break;
689 :
690 : case SID_PRESENTATION_END:
691 : {
692 0 : StopSlideShow(true);
693 :
694 0 : rReq.Ignore ();
695 : }
696 0 : break;
697 :
698 : case SID_BEZIER_EDIT:
699 : {
700 0 : mpDrawView->SetFrameDragSingles(!mpDrawView->IsFrameDragSingles());
701 :
702 : /******************************************************************
703 : * turn ObjectBar on
704 : ******************************************************************/
705 0 : if( dynamic_cast< FuSelection* >( GetCurrentFunction().get() ) || dynamic_cast< FuConstructBezierPolygon* >( GetCurrentFunction().get() ) )
706 : {
707 : // Tell the tool bar manager about the context change.
708 0 : GetViewShellBase().GetToolBarManager()->SelectionHasChanged(*this,*mpDrawView);
709 : }
710 :
711 0 : Invalidate(SID_BEZIER_EDIT);
712 0 : rReq.Ignore();
713 : }
714 0 : break;
715 :
716 : case SID_OBJECT_CLOSE:
717 : {
718 0 : const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
719 0 : if ( rMarkList.GetMark(0) && !mpDrawView->IsAction() )
720 : {
721 0 : SdrPathObj* pPathObj = (SdrPathObj*) rMarkList.GetMark(0)->GetMarkedSdrObj();
722 0 : const bool bUndo = mpDrawView->IsUndoEnabled();
723 0 : if( bUndo )
724 0 : mpDrawView->BegUndo(SD_RESSTR(STR_UNDO_BEZCLOSE));
725 :
726 0 : mpDrawView->UnmarkAllPoints();
727 :
728 0 : if( bUndo )
729 0 : mpDrawView->AddUndo(new SdrUndoGeoObj(*pPathObj));
730 :
731 0 : pPathObj->ToggleClosed();
732 :
733 0 : if( bUndo )
734 0 : mpDrawView->EndUndo();
735 : }
736 0 : rReq.Done();
737 : }
738 0 : break;
739 :
740 : case SID_CUT:
741 : {
742 0 : if ( mpDrawView->IsPresObjSelected(sal_False, sal_True, sal_False, sal_True) )
743 : {
744 0 : ::sd::Window* pWindow = GetActiveWindow();
745 0 : InfoBox(pWindow, SD_RESSTR(STR_ACTION_NOTPOSSIBLE) ).Execute();
746 : }
747 : else
748 : {
749 0 : if(HasCurrentFunction())
750 : {
751 0 : GetCurrentFunction()->DoCut();
752 : }
753 0 : else if(mpDrawView)
754 : {
755 0 : mpDrawView->DoCut();
756 : }
757 : }
758 0 : rReq.Ignore ();
759 : }
760 0 : break;
761 :
762 : case SID_COPY:
763 : {
764 0 : if ( mpDrawView->IsPresObjSelected(sal_False, sal_True, sal_False, sal_True) )
765 : {
766 0 : ::sd::Window* pWindow = GetActiveWindow();
767 0 : InfoBox(pWindow, SD_RESSTR(STR_ACTION_NOTPOSSIBLE) ).Execute();
768 : }
769 : else
770 : {
771 0 : if(HasCurrentFunction())
772 : {
773 0 : GetCurrentFunction()->DoCopy();
774 : }
775 0 : else if( mpDrawView )
776 : {
777 0 : mpDrawView->DoCopy();
778 : }
779 : }
780 0 : rReq.Ignore ();
781 : }
782 0 : break;
783 :
784 : case SID_PASTE:
785 : {
786 0 : WaitObject aWait( (Window*)GetActiveWindow() );
787 :
788 0 : if(HasCurrentFunction())
789 : {
790 0 : GetCurrentFunction()->DoPaste();
791 : }
792 0 : else if(mpDrawView)
793 : {
794 0 : mpDrawView->DoPaste();
795 : }
796 :
797 0 : rReq.Ignore ();
798 : }
799 0 : break;
800 :
801 : case SID_PASTE_UNFORMATTED:
802 : {
803 0 : WaitObject aWait( (Window*)GetActiveWindow() );
804 :
805 0 : if(HasCurrentFunction())
806 : {
807 0 : GetCurrentFunction()->DoPasteUnformatted();
808 : }
809 0 : else if(mpDrawView)
810 : {
811 0 : sal_Int8 nAction = DND_ACTION_COPY;
812 0 : TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) );
813 0 : if (aDataHelper.GetTransferable().is())
814 : {
815 : mpDrawView->InsertData( aDataHelper,
816 0 : GetActiveWindow()->PixelToLogic( Rectangle( Point(), GetActiveWindow()->GetOutputSizePixel() ).Center() ),
817 0 : nAction, sal_False, FORMAT_STRING);
818 0 : }
819 : }
820 :
821 0 : rReq.Ignore ();
822 : }
823 0 : break;
824 :
825 : case SID_CLIPBOARD_FORMAT_ITEMS:
826 : {
827 0 : WaitObject aWait( (Window*)GetActiveWindow() );
828 0 : TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) );
829 0 : const SfxItemSet* pReqArgs = rReq.GetArgs();
830 0 : sal_uInt32 nFormat = 0;
831 :
832 0 : if( pReqArgs )
833 : {
834 0 : SFX_REQUEST_ARG( rReq, pIsActive, SfxUInt32Item, SID_CLIPBOARD_FORMAT_ITEMS, false );
835 0 : nFormat = pIsActive->GetValue();
836 : }
837 :
838 :
839 0 : if( nFormat && aDataHelper.GetTransferable().is() )
840 : {
841 0 : sal_Int8 nAction = DND_ACTION_COPY;
842 :
843 0 : if( !mpDrawView->InsertData( aDataHelper,
844 0 : GetActiveWindow()->PixelToLogic( Rectangle( Point(), GetActiveWindow()->GetOutputSizePixel() ).Center() ),
845 0 : nAction, sal_False, nFormat ) )
846 : {
847 0 : INetBookmark aINetBookmark( aEmptyStr, aEmptyStr );
848 :
849 0 : if( ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ) &&
850 0 : aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, aINetBookmark ) ) ||
851 0 : ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR ) &&
852 0 : aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, aINetBookmark ) ) ||
853 0 : ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR ) &&
854 0 : aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, aINetBookmark ) ) )
855 : {
856 0 : InsertURLField( aINetBookmark.GetURL(), aINetBookmark.GetDescription(), aEmptyStr, NULL );
857 0 : }
858 : }
859 0 : }
860 : }
861 0 : break;
862 :
863 : case SID_DELETE:
864 : {
865 0 : if ( mpDrawView->IsTextEdit() )
866 : {
867 0 : OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
868 :
869 0 : if (pOLV)
870 : {
871 0 : KeyCode aKCode(KEY_DELETE);
872 0 : KeyEvent aKEvt( 0, aKCode);
873 0 : pOLV->PostKeyEvent(aKEvt);
874 : }
875 : }
876 0 : else if ( mpDrawView->IsPresObjSelected(sal_False, sal_True, sal_False, sal_True) )
877 : {
878 0 : ::sd::Window* pWindow = GetActiveWindow();
879 0 : InfoBox(pWindow, SD_RESSTR(STR_ACTION_NOTPOSSIBLE) ).Execute();
880 : }
881 : else
882 : {
883 0 : KeyCode aKCode(KEY_DELETE);
884 0 : KeyEvent aKEvt( 0, aKCode);
885 :
886 0 : bool bConsumed = mpDrawView && mpDrawView->getSmartTags().KeyInput( aKEvt );
887 :
888 0 : if( !bConsumed && HasCurrentFunction() )
889 0 : bConsumed = GetCurrentFunction()->KeyInput(aKEvt);
890 :
891 0 : if( !bConsumed && mpDrawView )
892 0 : mpDrawView->DeleteMarked();
893 : }
894 0 : rReq.Ignore ();
895 : }
896 0 : break;
897 :
898 : case SID_NOTESMODE:
899 : case SID_HANDOUTMODE:
900 : // AutoLayouts have to be ready.
901 0 : GetDoc()->StopWorkStartupDelay();
902 : // Fall through to following case statements.
903 :
904 : case SID_DRAWINGMODE:
905 : case SID_DIAMODE:
906 : case SID_OUTLINEMODE:
907 : // Let the sub-shell manager handle the slot handling.
908 0 : framework::FrameworkHelper::Instance(GetViewShellBase())->HandleModeChangeSlot(
909 : nSId,
910 0 : rReq);
911 0 : rReq.Ignore ();
912 0 : break;
913 :
914 : case SID_MASTERPAGE: // BASIC
915 : case SID_SLIDE_MASTERPAGE: // BASIC
916 : case SID_TITLE_MASTERPAGE: // BASIC
917 : case SID_NOTES_MASTERPAGE: // BASIC
918 : case SID_HANDOUT_MASTERPAGE: // BASIC
919 : {
920 : // AutoLayouts needs to be finished
921 0 : GetDoc()->StopWorkStartupDelay();
922 :
923 0 : const SfxItemSet* pReqArgs = rReq.GetArgs();
924 :
925 0 : if ( pReqArgs )
926 : {
927 0 : SFX_REQUEST_ARG (rReq, pIsActive, SfxBoolItem, SID_MASTERPAGE, false);
928 0 : mbIsLayerModeActive = pIsActive->GetValue ();
929 : }
930 :
931 : Broadcast (
932 0 : ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_START));
933 :
934 0 : if (nSId == SID_MASTERPAGE ||
935 0 : (nSId == SID_SLIDE_MASTERPAGE && mePageKind == PK_STANDARD) ||
936 0 : (nSId == SID_TITLE_MASTERPAGE && mePageKind == PK_STANDARD) ||
937 0 : (nSId == SID_NOTES_MASTERPAGE && mePageKind == PK_NOTES) ||
938 0 : (nSId == SID_HANDOUT_MASTERPAGE && mePageKind == PK_HANDOUT))
939 : {
940 0 : if (nSId == SID_TITLE_MASTERPAGE ||
941 : nSId == SID_SLIDE_MASTERPAGE)
942 : {
943 : // Is there a page with the AutoLayout "Title"?
944 0 : sal_Bool bFound = sal_False;
945 0 : sal_uInt16 i = 0;
946 0 : sal_uInt16 nCount = GetDoc()->GetSdPageCount(PK_STANDARD);
947 :
948 0 : while (i < nCount && !bFound)
949 : {
950 0 : SdPage* pPage = GetDoc()->GetSdPage(i, PK_STANDARD);
951 :
952 0 : if (nSId == SID_TITLE_MASTERPAGE && pPage->GetAutoLayout() == AUTOLAYOUT_TITLE)
953 : {
954 0 : bFound = sal_True;
955 0 : SwitchPage((pPage->GetPageNum() - 1) / 2);
956 : }
957 0 : else if (nSId == SID_SLIDE_MASTERPAGE && pPage->GetAutoLayout() != AUTOLAYOUT_TITLE)
958 : {
959 0 : bFound = sal_True;
960 0 : SwitchPage((pPage->GetPageNum() - 1) / 2);
961 : }
962 :
963 0 : i++;
964 : }
965 : }
966 :
967 : // turn on default layer of MasterPage
968 0 : mpDrawView->SetActiveLayer( SD_RESSTR(STR_LAYER_BCKGRNDOBJ) );
969 :
970 0 : ChangeEditMode(EM_MASTERPAGE, mbIsLayerModeActive);
971 :
972 0 : if(HasCurrentFunction(SID_BEZIER_EDIT))
973 0 : GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
974 : }
975 : else
976 : {
977 : // Switch to requested ViewShell.
978 0 : ::OUString sRequestedView;
979 : PageKind ePageKind;
980 0 : switch (nSId)
981 : {
982 : case SID_SLIDE_MASTERPAGE:
983 : case SID_TITLE_MASTERPAGE:
984 : default:
985 0 : sRequestedView = framework::FrameworkHelper::msImpressViewURL;
986 0 : ePageKind = PK_STANDARD;
987 0 : break;
988 :
989 : case SID_NOTES_MASTERPAGE:
990 0 : sRequestedView = framework::FrameworkHelper::msNotesViewURL;
991 0 : ePageKind = PK_NOTES;
992 0 : break;
993 :
994 : case SID_HANDOUT_MASTERPAGE:
995 0 : sRequestedView = framework::FrameworkHelper::msHandoutViewURL;
996 0 : ePageKind = PK_HANDOUT;
997 0 : break;
998 : }
999 :
1000 0 : mpFrameView->SetViewShEditMode(EM_MASTERPAGE, ePageKind);
1001 0 : mpFrameView->SetLayerMode(mbIsLayerModeActive);
1002 0 : framework::FrameworkHelper::Instance(GetViewShellBase())->RequestView(
1003 : sRequestedView,
1004 0 : framework::FrameworkHelper::msCenterPaneURL);
1005 : }
1006 : Broadcast (
1007 0 : ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_END));
1008 :
1009 0 : InvalidateWindows();
1010 0 : Invalidate();
1011 :
1012 0 : rReq.Done();
1013 : }
1014 0 : break;
1015 :
1016 :
1017 : case SID_CLOSE_MASTER_VIEW:
1018 : {
1019 : Broadcast (
1020 0 : ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_START));
1021 :
1022 : // Switch page back to the first one. Not doing so leads to a
1023 : // crash. This seems to be some bug in the edit mode switching
1024 : // and page switching methods.
1025 0 : SwitchPage (0);
1026 0 : ChangeEditMode(EM_PAGE, IsLayerModeActive());
1027 : Broadcast (
1028 0 : ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_END));
1029 :
1030 0 : if(HasCurrentFunction(SID_BEZIER_EDIT))
1031 : {
1032 : GetViewFrame()->GetDispatcher()->Execute(
1033 : SID_OBJECT_SELECT,
1034 0 : SFX_CALLMODE_ASYNCHRON);
1035 : }
1036 :
1037 :
1038 0 : rReq.Done();
1039 : }
1040 0 : break;
1041 :
1042 :
1043 : case SID_RULER:
1044 : {
1045 0 : const SfxItemSet* pReqArgs = rReq.GetArgs();
1046 :
1047 : // Remember old ruler state
1048 0 : sal_Bool bOldHasRuler(HasRuler());
1049 :
1050 0 : if ( pReqArgs )
1051 : {
1052 0 : SFX_REQUEST_ARG (rReq, pIsActive, SfxBoolItem, SID_RULER, false);
1053 0 : SetRuler (pIsActive->GetValue ());
1054 : }
1055 0 : else SetRuler (!HasRuler());
1056 :
1057 : // Did ruler state change? Tell that to SdOptions, too.
1058 0 : sal_Bool bHasRuler(HasRuler());
1059 :
1060 0 : if(bOldHasRuler != bHasRuler)
1061 : {
1062 0 : SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType());
1063 :
1064 0 : if(pOptions && pOptions->IsRulerVisible() != bHasRuler)
1065 : {
1066 0 : pOptions->SetRulerVisible(bHasRuler);
1067 : }
1068 : }
1069 :
1070 0 : Invalidate (SID_RULER);
1071 0 : Resize();
1072 0 : rReq.Done ();
1073 : }
1074 0 : break;
1075 :
1076 : case SID_SIZE_PAGE:
1077 : case SID_SIZE_PAGE_WIDTH: // BASIC
1078 : {
1079 0 : mbZoomOnPage = ( rReq.GetSlot() == SID_SIZE_PAGE );
1080 :
1081 0 : SdrPageView* pPageView = mpDrawView->GetSdrPageView();
1082 :
1083 0 : if ( pPageView )
1084 : {
1085 0 : Point aPagePos(0, 0); // = pPageView->GetOffset();
1086 0 : Size aPageSize = pPageView->GetPage()->GetSize();
1087 :
1088 0 : aPagePos.X() += aPageSize.Width() / 2;
1089 0 : aPageSize.Width() = (long) (aPageSize.Width() * 1.03);
1090 :
1091 0 : if( rReq.GetSlot() == SID_SIZE_PAGE )
1092 : {
1093 0 : aPagePos.Y() += aPageSize.Height() / 2;
1094 0 : aPageSize.Height() = (long) (aPageSize.Height() * 1.03);
1095 0 : aPagePos.Y() -= aPageSize.Height() / 2;
1096 : }
1097 : else
1098 : {
1099 0 : Point aPt = GetActiveWindow()->PixelToLogic( Point( 0, GetActiveWindow()->GetSizePixel().Height() / 2 ) );
1100 0 : aPagePos.Y() += aPt.Y();
1101 0 : aPageSize.Height() = 2;
1102 : }
1103 :
1104 0 : aPagePos.X() -= aPageSize.Width() / 2;
1105 :
1106 0 : SetZoomRect( Rectangle( aPagePos, aPageSize ) );
1107 :
1108 0 : Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
1109 0 : GetActiveWindow()->GetOutputSizePixel()) );
1110 0 : mpZoomList->InsertZoomRect(aVisAreaWin);
1111 : }
1112 0 : Invalidate( SID_ZOOM_IN );
1113 0 : Invalidate( SID_ZOOM_OUT );
1114 0 : Invalidate( SID_ZOOM_PANNING );
1115 0 : Invalidate( SID_ZOOM_TOOLBOX );
1116 0 : rReq.Done ();
1117 : }
1118 0 : break;
1119 :
1120 : case SID_SIZE_REAL: // BASIC
1121 : {
1122 0 : mbZoomOnPage = sal_False;
1123 0 : SetZoom( 100 );
1124 0 : Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
1125 0 : GetActiveWindow()->GetOutputSizePixel()) );
1126 0 : mpZoomList->InsertZoomRect(aVisAreaWin);
1127 0 : Invalidate( SID_ZOOM_IN );
1128 0 : Invalidate( SID_ZOOM_OUT );
1129 0 : Invalidate( SID_ZOOM_PANNING );
1130 0 : Invalidate( SID_ZOOM_TOOLBOX );
1131 0 : rReq.Done ();
1132 : }
1133 0 : break;
1134 :
1135 : case SID_ZOOM_IN: // BASIC
1136 : {
1137 0 : mbZoomOnPage = sal_False;
1138 0 : SetZoom( std::max( (long) ( GetActiveWindow()->GetZoom() / 2 ), (long) GetActiveWindow()->GetMinZoom() ) );
1139 0 : Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
1140 0 : GetActiveWindow()->GetOutputSizePixel()) );
1141 0 : mpZoomList->InsertZoomRect(aVisAreaWin);
1142 0 : Invalidate( SID_ZOOM_IN );
1143 0 : Invalidate( SID_ZOOM_OUT );
1144 0 : Invalidate( SID_ZOOM_PANNING );
1145 0 : Invalidate( SID_ZOOM_TOOLBOX );
1146 0 : rReq.Done ();
1147 : }
1148 0 : break;
1149 :
1150 : case SID_SIZE_VISAREA:
1151 : {
1152 0 : Rectangle aVisArea = mpFrameView->GetVisArea();
1153 0 : Size aVisAreaSize = aVisArea.GetSize();
1154 :
1155 0 : if (aVisAreaSize.Height()!=0 && aVisAreaSize.Width()!=0)
1156 : {
1157 0 : mbZoomOnPage = sal_False;
1158 0 : SetZoomRect(aVisArea);
1159 0 : Invalidate( SID_ZOOM_IN );
1160 0 : Invalidate( SID_ZOOM_OUT );
1161 0 : Invalidate( SID_ZOOM_PANNING );
1162 0 : Invalidate( SID_ZOOM_TOOLBOX );
1163 : }
1164 0 : rReq.Done ();
1165 : }
1166 0 : break;
1167 :
1168 : // name confusion: SID_SIZE_OPTIMAL -> Zoom onto selected objects
1169 : // --> Is offered as object zoom in program
1170 : case SID_SIZE_OPTIMAL: // BASIC
1171 : {
1172 0 : mbZoomOnPage = sal_False;
1173 0 : if ( mpDrawView->AreObjectsMarked() )
1174 : {
1175 0 : maMarkRect = mpDrawView->GetAllMarkedRect();
1176 0 : long nW = (long) (maMarkRect.GetWidth() * 1.03);
1177 0 : long nH = (long) (maMarkRect.GetHeight() * 1.03);
1178 0 : Point aPos = maMarkRect.Center();
1179 0 : aPos.X() -= nW / 2;
1180 0 : aPos.Y() -= nH / 2;
1181 0 : if ( nW && nH )
1182 : {
1183 0 : SetZoomRect(Rectangle(aPos, Size(nW, nH)));
1184 :
1185 0 : Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
1186 0 : GetActiveWindow()->GetOutputSizePixel()) );
1187 0 : mpZoomList->InsertZoomRect(aVisAreaWin);
1188 : }
1189 : }
1190 0 : Invalidate( SID_ZOOM_IN );
1191 0 : Invalidate( SID_ZOOM_OUT );
1192 0 : Invalidate( SID_ZOOM_PANNING );
1193 0 : Invalidate( SID_ZOOM_TOOLBOX );
1194 0 : rReq.Done ();
1195 : }
1196 0 : break;
1197 :
1198 : // name confusion: SID_SIZE_ALL -> Zoom onto all objects
1199 : // --> Is offered as optimal in program
1200 : case SID_SIZE_ALL: // BASIC
1201 : {
1202 0 : mbZoomOnPage = sal_False;
1203 0 : SdrPageView* pPageView = mpDrawView->GetSdrPageView();
1204 :
1205 0 : if( pPageView )
1206 : {
1207 0 : Rectangle aBoundRect( pPageView->GetObjList()->GetAllObjBoundRect() );
1208 :
1209 0 : long nW = (long) (aBoundRect.GetWidth() * 1.03);
1210 0 : long nH = (long) (aBoundRect.GetHeight() * 1.03);
1211 0 : Point aPos = aBoundRect.Center();
1212 0 : aPos.X() -= nW / 2;
1213 0 : aPos.Y() -= nH / 2;
1214 0 : if ( nW && nH )
1215 : {
1216 0 : SetZoomRect( Rectangle( aPos, Size( nW, nH ) ) );
1217 :
1218 0 : Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
1219 0 : GetActiveWindow()->GetOutputSizePixel()) );
1220 0 : mpZoomList->InsertZoomRect(aVisAreaWin);
1221 : }
1222 :
1223 0 : Invalidate( SID_ZOOM_IN );
1224 0 : Invalidate( SID_ZOOM_OUT );
1225 0 : Invalidate( SID_ZOOM_PANNING );
1226 0 : Invalidate( SID_ZOOM_TOOLBOX );
1227 : }
1228 0 : rReq.Done ();
1229 : }
1230 0 : break;
1231 :
1232 : case SID_ZOOM_PREV:
1233 : {
1234 0 : if (mpDrawView->IsTextEdit())
1235 : {
1236 0 : mpDrawView->SdrEndTextEdit();
1237 : }
1238 :
1239 0 : if (mpZoomList->IsPreviousPossible())
1240 : {
1241 : // set previous ZoomRect
1242 0 : SetZoomRect(mpZoomList->GetPreviousZoomRect());
1243 : }
1244 0 : rReq.Done ();
1245 0 : Invalidate( SID_ZOOM_TOOLBOX );
1246 : }
1247 0 : break;
1248 :
1249 : case SID_ZOOM_NEXT:
1250 : {
1251 0 : if (mpDrawView->IsTextEdit())
1252 : {
1253 0 : mpDrawView->SdrEndTextEdit();
1254 : }
1255 :
1256 0 : if (mpZoomList->IsNextPossible())
1257 : {
1258 : // set next ZoomRect
1259 0 : SetZoomRect(mpZoomList->GetNextZoomRect());
1260 : }
1261 0 : rReq.Done ();
1262 0 : Invalidate( SID_ZOOM_TOOLBOX );
1263 : }
1264 0 : break;
1265 :
1266 : case SID_GLUE_INSERT_POINT:
1267 : case SID_GLUE_PERCENT:
1268 : case SID_GLUE_ESCDIR:
1269 : case SID_GLUE_ESCDIR_LEFT:
1270 : case SID_GLUE_ESCDIR_RIGHT:
1271 : case SID_GLUE_ESCDIR_TOP:
1272 : case SID_GLUE_ESCDIR_BOTTOM:
1273 : case SID_GLUE_HORZALIGN_CENTER:
1274 : case SID_GLUE_HORZALIGN_LEFT:
1275 : case SID_GLUE_HORZALIGN_RIGHT:
1276 : case SID_GLUE_VERTALIGN_CENTER:
1277 : case SID_GLUE_VERTALIGN_TOP:
1278 : case SID_GLUE_VERTALIGN_BOTTOM:
1279 : {
1280 0 : rtl::Reference<FuPoor> xFunc( GetCurrentFunction() );
1281 0 : FuEditGluePoints* pFunc = dynamic_cast< FuEditGluePoints* >( xFunc.get() );
1282 :
1283 0 : if(pFunc)
1284 0 : pFunc->ReceiveRequest(rReq);
1285 :
1286 0 : rReq.Done();
1287 : }
1288 0 : break;
1289 :
1290 : #ifdef DBG_UTIL
1291 : case SID_SHOW_ITEMBROWSER:
1292 : {
1293 : mpDrawView->ShowItemBrowser( !mpDrawView->IsItemBrowserVisible() );
1294 : rReq.Done ();
1295 : }
1296 : break;
1297 : #endif
1298 :
1299 : case SID_AUTOSPELL_CHECK:
1300 : {
1301 0 : sal_Bool bOnlineSpell = !GetDoc()->GetOnlineSpell();
1302 0 : GetDoc()->SetOnlineSpell(bOnlineSpell);
1303 :
1304 0 : ::Outliner* pOL = mpDrawView->GetTextEditOutliner();
1305 :
1306 0 : if (pOL)
1307 : {
1308 0 : sal_uLong nCntrl = pOL->GetControlWord();
1309 :
1310 0 : if (bOnlineSpell)
1311 0 : nCntrl |= EE_CNTRL_ONLINESPELLING;
1312 : else
1313 0 : nCntrl &= ~EE_CNTRL_ONLINESPELLING;
1314 :
1315 0 : pOL->SetControlWord(nCntrl);
1316 : }
1317 :
1318 0 : GetActiveWindow()->Invalidate();
1319 0 : rReq.Done ();
1320 : }
1321 0 : break;
1322 :
1323 : case SID_CONVERT_TO_1BIT_THRESHOLD:
1324 : case SID_CONVERT_TO_1BIT_MATRIX:
1325 : case SID_CONVERT_TO_4BIT_GRAYS:
1326 : case SID_CONVERT_TO_4BIT_COLORS:
1327 : case SID_CONVERT_TO_8BIT_GRAYS:
1328 : case SID_CONVERT_TO_8BIT_COLORS:
1329 : case SID_CONVERT_TO_24BIT:
1330 : {
1331 0 : BmpConversion eBmpConvert = BMP_CONVERSION_NONE;
1332 :
1333 0 : switch( nSId )
1334 : {
1335 : case SID_CONVERT_TO_1BIT_THRESHOLD:
1336 0 : eBmpConvert = BMP_CONVERSION_1BIT_THRESHOLD;
1337 0 : break;
1338 :
1339 : case SID_CONVERT_TO_1BIT_MATRIX:
1340 0 : eBmpConvert = BMP_CONVERSION_1BIT_MATRIX;
1341 0 : break;
1342 :
1343 : case SID_CONVERT_TO_4BIT_GRAYS:
1344 0 : eBmpConvert = BMP_CONVERSION_4BIT_GREYS;
1345 0 : break;
1346 :
1347 : case SID_CONVERT_TO_4BIT_COLORS:
1348 0 : eBmpConvert = BMP_CONVERSION_4BIT_COLORS;
1349 0 : break;
1350 :
1351 : case SID_CONVERT_TO_8BIT_GRAYS:
1352 0 : eBmpConvert = BMP_CONVERSION_8BIT_GREYS;
1353 0 : break;
1354 :
1355 : case SID_CONVERT_TO_8BIT_COLORS:
1356 0 : eBmpConvert = BMP_CONVERSION_8BIT_COLORS;
1357 0 : break;
1358 :
1359 : case SID_CONVERT_TO_24BIT:
1360 0 : eBmpConvert = BMP_CONVERSION_24BIT;
1361 0 : break;
1362 : }
1363 :
1364 0 : mpDrawView->BegUndo(SD_RESSTR(STR_UNDO_COLORRESOLUTION));
1365 0 : const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
1366 :
1367 0 : for (sal_uLong i=0; i<rMarkList.GetMarkCount(); i++)
1368 : {
1369 0 : SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
1370 :
1371 0 : if (pObj->GetObjInventor() == SdrInventor)
1372 : {
1373 0 : if (pObj->GetObjIdentifier() == OBJ_GRAF && !((SdrGrafObj*) pObj)->IsLinkedGraphic())
1374 : {
1375 0 : const Graphic& rGraphic = ((SdrGrafObj*) pObj)->GetGraphic();
1376 :
1377 0 : if( rGraphic.GetType() == GRAPHIC_BITMAP )
1378 : {
1379 0 : SdrGrafObj* pNewObj = (SdrGrafObj*) pObj->Clone();
1380 :
1381 0 : if( rGraphic.IsAnimated() )
1382 : {
1383 0 : Animation aAnim( rGraphic.GetAnimation() );
1384 0 : aAnim.Convert( eBmpConvert );
1385 0 : pNewObj->SetGraphic( aAnim );
1386 : }
1387 : else
1388 : {
1389 0 : BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
1390 0 : aBmpEx.Convert( eBmpConvert );
1391 0 : pNewObj->SetGraphic( aBmpEx );
1392 : }
1393 :
1394 0 : mpDrawView->ReplaceObjectAtView( pObj, *mpDrawView->GetSdrPageView(), pNewObj );
1395 : }
1396 : }
1397 : }
1398 : }
1399 :
1400 0 : mpDrawView->EndUndo();
1401 0 : rReq.Done ();
1402 : }
1403 0 : break;
1404 :
1405 : case SID_TRANSLITERATE_SENTENCE_CASE:
1406 : case SID_TRANSLITERATE_TITLE_CASE:
1407 : case SID_TRANSLITERATE_TOGGLE_CASE:
1408 : case SID_TRANSLITERATE_UPPER:
1409 : case SID_TRANSLITERATE_LOWER:
1410 : case SID_TRANSLITERATE_HALFWIDTH:
1411 : case SID_TRANSLITERATE_FULLWIDTH:
1412 : case SID_TRANSLITERATE_HIRAGANA:
1413 : case SID_TRANSLITERATE_KATAGANA:
1414 : {
1415 0 : OutlinerView* pOLV = GetView()->GetTextEditOutlinerView();
1416 0 : if( pOLV )
1417 : {
1418 : using namespace ::com::sun::star::i18n;
1419 0 : sal_Int32 nType = 0;
1420 :
1421 0 : switch( nSId )
1422 : {
1423 : case SID_TRANSLITERATE_SENTENCE_CASE:
1424 0 : nType = TransliterationModulesExtra::SENTENCE_CASE;
1425 0 : break;
1426 : case SID_TRANSLITERATE_TITLE_CASE:
1427 0 : nType = TransliterationModulesExtra::TITLE_CASE;
1428 0 : break;
1429 : case SID_TRANSLITERATE_TOGGLE_CASE:
1430 0 : nType = TransliterationModulesExtra::TOGGLE_CASE;
1431 0 : break;
1432 : case SID_TRANSLITERATE_UPPER:
1433 0 : nType = TransliterationModules_LOWERCASE_UPPERCASE;
1434 0 : break;
1435 : case SID_TRANSLITERATE_LOWER:
1436 0 : nType = TransliterationModules_UPPERCASE_LOWERCASE;
1437 0 : break;
1438 : case SID_TRANSLITERATE_HALFWIDTH:
1439 0 : nType = TransliterationModules_FULLWIDTH_HALFWIDTH;
1440 0 : break;
1441 : case SID_TRANSLITERATE_FULLWIDTH:
1442 0 : nType = TransliterationModules_HALFWIDTH_FULLWIDTH;
1443 0 : break;
1444 : case SID_TRANSLITERATE_HIRAGANA:
1445 0 : nType = TransliterationModules_KATAKANA_HIRAGANA;
1446 0 : break;
1447 : case SID_TRANSLITERATE_KATAGANA:
1448 0 : nType = TransliterationModules_HIRAGANA_KATAKANA;
1449 0 : break;
1450 : }
1451 :
1452 0 : pOLV->TransliterateText( nType );
1453 : }
1454 :
1455 0 : rReq.Done();
1456 : }
1457 0 : break;
1458 :
1459 : // #UndoRedo#
1460 : case SID_UNDO :
1461 : {
1462 : // moved implementation to BaseClass
1463 0 : ImpSidUndo(sal_True, rReq);
1464 : }
1465 0 : break;
1466 : case SID_REDO :
1467 : {
1468 : // moved implementation to BaseClass
1469 0 : ImpSidRedo(sal_True, rReq);
1470 : }
1471 0 : break;
1472 :
1473 : default:
1474 0 : break;
1475 : }
1476 : }
1477 :
1478 0 : void DrawViewShell::FuSupportRotate(SfxRequest &rReq)
1479 : {
1480 0 : if( rReq.GetSlot() == SID_TRANSLITERATE_ROTATE_CASE )
1481 : {
1482 0 : ::sd::View* pView = GetView();
1483 :
1484 0 : if (!pView)
1485 0 : return;
1486 :
1487 0 : OutlinerView* pOLV = pView->GetTextEditOutlinerView();
1488 :
1489 0 : if (!pOLV)
1490 0 : return;
1491 :
1492 0 : pOLV->TransliterateText( m_aRotateCase.getNextMode() );
1493 : }
1494 : }
1495 :
1496 :
1497 0 : void DrawViewShell::InsertURLField(const OUString& rURL, const OUString& rText,
1498 : const OUString& rTarget, const Point* pPos)
1499 : {
1500 0 : OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
1501 :
1502 0 : if (pOLV)
1503 : {
1504 0 : ESelection aSel( pOLV->GetSelection() );
1505 0 : SvxFieldItem aURLItem( SvxURLField( rURL, rText, SVXURLFORMAT_REPR ), EE_FEATURE_FIELD );
1506 0 : pOLV->InsertField( aURLItem );
1507 0 : if ( aSel.nStartPos <= aSel.nEndPos )
1508 0 : aSel.nEndPos = aSel.nStartPos + 1;
1509 : else
1510 0 : aSel.nStartPos = aSel.nEndPos + 1;
1511 0 : pOLV->SetSelection( aSel );
1512 : }
1513 : else
1514 : {
1515 0 : Outliner* pOutl = GetDoc()->GetInternalOutliner();
1516 0 : pOutl->Init( OUTLINERMODE_TEXTOBJECT );
1517 0 : sal_uInt16 nOutlMode = pOutl->GetMode();
1518 :
1519 0 : SvxURLField aURLField(rURL, rText, SVXURLFORMAT_REPR);
1520 0 : aURLField.SetTargetFrame(rTarget);
1521 0 : SvxFieldItem aURLItem(aURLField, EE_FEATURE_FIELD);
1522 0 : pOutl->QuickInsertField( aURLItem, ESelection() );
1523 0 : OutlinerParaObject* pOutlParaObject = pOutl->CreateParaObject();
1524 :
1525 0 : SdrRectObj* pRectObj = new SdrRectObj(OBJ_TEXT);
1526 :
1527 0 : pOutl->UpdateFields();
1528 0 : pOutl->SetUpdateMode( true );
1529 0 : Size aSize(pOutl->CalcTextSize());
1530 0 : pOutl->SetUpdateMode( false );
1531 :
1532 0 : Point aPos;
1533 :
1534 0 : if (pPos)
1535 : {
1536 0 : aPos = *pPos;
1537 : }
1538 : else
1539 : {
1540 0 : Rectangle aRect(aPos, GetActiveWindow()->GetOutputSizePixel() );
1541 0 : aPos = aRect.Center();
1542 0 : aPos = GetActiveWindow()->PixelToLogic(aPos);
1543 0 : aPos.X() -= aSize.Width() / 2;
1544 0 : aPos.Y() -= aSize.Height() / 2;
1545 : }
1546 :
1547 0 : Rectangle aLogicRect(aPos, aSize);
1548 0 : pRectObj->SetLogicRect(aLogicRect);
1549 0 : pRectObj->SetOutlinerParaObject( pOutlParaObject );
1550 0 : mpDrawView->InsertObjectAtView(pRectObj, *mpDrawView->GetSdrPageView());
1551 0 : pOutl->Init( nOutlMode );
1552 : }
1553 0 : }
1554 :
1555 :
1556 0 : void DrawViewShell::InsertURLButton(const OUString& rURL, const OUString& rText,
1557 : const OUString& rTarget, const Point* pPos)
1558 : {
1559 0 : sal_Bool bNewObj = sal_True;
1560 :
1561 0 : const OUString sTargetURL( ::URIHelper::SmartRel2Abs( INetURLObject( GetDocSh()->GetMedium()->GetBaseURL() ), rURL, URIHelper::GetMaybeFileHdl(), true, false,
1562 : INetURLObject::WAS_ENCODED,
1563 0 : INetURLObject::DECODE_UNAMBIGUOUS ) );
1564 0 : if (mpDrawView->GetMarkedObjectList().GetMarkCount() > 0)
1565 : {
1566 0 : SdrObject* pMarkedObj = mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
1567 0 : if( pMarkedObj ) try
1568 : {
1569 : // change first marked object
1570 0 : if( (FmFormInventor == pMarkedObj->GetObjInventor() && pMarkedObj->GetObjIdentifier() == OBJ_FM_BUTTON) )
1571 : {
1572 0 : bNewObj = sal_False;
1573 :
1574 0 : SdrUnoObj* pUnoCtrl = static_cast< SdrUnoObj* >( pMarkedObj );
1575 :
1576 0 : Reference< awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel(), UNO_QUERY_THROW );
1577 0 : Reference< beans::XPropertySet > xPropSet( xControlModel, UNO_QUERY_THROW );
1578 :
1579 0 : xPropSet->setPropertyValue("Label" , Any( rText ) );
1580 0 : xPropSet->setPropertyValue("TargetURL" , Any( sTargetURL ) );
1581 :
1582 0 : if( !rTarget.isEmpty() )
1583 0 : xPropSet->setPropertyValue("TargetFrame" , Any( rTarget ) );
1584 :
1585 0 : xPropSet->setPropertyValue( "ButtonType" , Any( form::FormButtonType_URL ) );
1586 0 : if ( ::avmedia::MediaWindow::isMediaURL( rURL, ""/*TODO?*/ ) )
1587 : {
1588 0 : xPropSet->setPropertyValue( "DispatchURLInternal" , Any( sal_True ) );
1589 0 : }
1590 : }
1591 : else
1592 : {
1593 : // add url as interaction for first selected shape
1594 0 : bNewObj = sal_False;
1595 :
1596 0 : SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pMarkedObj, true);
1597 0 : pInfo->meClickAction = presentation::ClickAction_DOCUMENT;
1598 0 : pInfo->SetBookmark( sTargetURL );
1599 : }
1600 : }
1601 0 : catch( uno::Exception& )
1602 : {
1603 : }
1604 : }
1605 :
1606 0 : if (bNewObj) try
1607 : {
1608 : SdrUnoObj* pUnoCtrl = static_cast< SdrUnoObj* >( SdrObjFactory::MakeNewObject(FmFormInventor, OBJ_FM_BUTTON,
1609 0 : mpDrawView->GetSdrPageView()->GetPage(), GetDoc()) );
1610 :
1611 0 : Reference< awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel(), uno::UNO_QUERY_THROW );
1612 0 : Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY_THROW );
1613 :
1614 0 : xPropSet->setPropertyValue( "Label" , Any( OUString( rText ) ) );
1615 0 : xPropSet->setPropertyValue( "TargetURL" , Any( sTargetURL ) );
1616 :
1617 0 : if( !rTarget.isEmpty() )
1618 0 : xPropSet->setPropertyValue( "TargetFrame" , Any( rTarget ) );
1619 :
1620 0 : xPropSet->setPropertyValue( "ButtonType" , Any( form::FormButtonType_URL ) );
1621 0 : if ( ::avmedia::MediaWindow::isMediaURL( rURL, ""/*TODO?*/ ) )
1622 0 : xPropSet->setPropertyValue( "DispatchURLInternal" , Any( sal_True ) );
1623 :
1624 0 : Point aPos;
1625 :
1626 0 : if (pPos)
1627 : {
1628 0 : aPos = *pPos;
1629 : }
1630 : else
1631 : {
1632 0 : aPos = Rectangle(aPos, GetActiveWindow()->GetOutputSizePixel()).Center();
1633 0 : aPos = GetActiveWindow()->PixelToLogic(aPos);
1634 : }
1635 :
1636 0 : Size aSize(4000, 1000);
1637 0 : aPos.X() -= aSize.Width() / 2;
1638 0 : aPos.Y() -= aSize.Height() / 2;
1639 0 : pUnoCtrl->SetLogicRect(Rectangle(aPos, aSize));
1640 :
1641 0 : sal_uLong nOptions = SDRINSERT_SETDEFLAYER;
1642 :
1643 : OSL_ASSERT (GetViewShell()!=NULL);
1644 0 : SfxInPlaceClient* pIpClient = GetViewShell()->GetIPClient();
1645 0 : if (pIpClient!=NULL && pIpClient->IsObjectInPlaceActive())
1646 : {
1647 0 : nOptions |= SDRINSERT_DONTMARK;
1648 : }
1649 :
1650 0 : mpDrawView->InsertObjectAtView(pUnoCtrl, *mpDrawView->GetSdrPageView(), nOptions);
1651 : }
1652 0 : catch( Exception& )
1653 : {
1654 0 : }
1655 0 : }
1656 :
1657 0 : void DrawViewShell::ShowUIControls (bool bVisible)
1658 : {
1659 0 : ViewShell::ShowUIControls (bVisible);
1660 :
1661 : //AF: The LayerDialogChildWindow is not used anymore (I hope).
1662 : // GetViewFrame()->SetChildWindow(
1663 : // LayerDialogChildWindow::GetChildWindowId(),
1664 : // IsLayerModeActive() && bVisible);
1665 0 : maTabControl.Show (bVisible);
1666 0 : }
1667 :
1668 : namespace slideshowhelp
1669 : {
1670 0 : void ShowSlideShow(SfxRequest& rReq, SdDrawDocument &rDoc)
1671 : {
1672 0 : Reference< XPresentation2 > xPresentation( rDoc.getPresentation() );
1673 0 : if( xPresentation.is() )
1674 : {
1675 0 : if (SID_REHEARSE_TIMINGS == rReq.GetSlot())
1676 0 : xPresentation->rehearseTimings();
1677 0 : else if (rDoc.getPresentationSettings().mbCustomShow)
1678 : {
1679 : //fdo#69975 if a custom show has been set, then
1680 : //use it whether or not we've been asked to
1681 : //start from the current or first slide
1682 0 : xPresentation->start();
1683 : }
1684 0 : else if (SID_PRESENTATION_CURRENT_SLIDE == rReq.GetSlot())
1685 : {
1686 : //If there is no custom show set, start will automatically
1687 : //start at the current page
1688 0 : xPresentation->start();
1689 : }
1690 : else
1691 : {
1692 : //Start at page 0, this would blow away any custom
1693 : //show settings if any were set
1694 0 : Sequence< PropertyValue > aArguments(1);
1695 0 : PropertyValue aPage;
1696 0 : OUString sValue("0");
1697 :
1698 0 : aPage.Name = "FirstPage";
1699 0 : aPage.Value <<= sValue;
1700 :
1701 0 : aArguments[0] = aPage;
1702 :
1703 0 : xPresentation->startWithArguments( aArguments );
1704 : }
1705 0 : }
1706 0 : }
1707 : }
1708 :
1709 0 : void DrawViewShell::ShowSlideShow(SfxRequest& rReq)
1710 : {
1711 0 : slideshowhelp::ShowSlideShow(rReq, *GetDoc());
1712 0 : }
1713 :
1714 0 : void DrawViewShell::StopSlideShow (bool /*bCloseFrame*/)
1715 : {
1716 0 : Reference< XPresentation2 > xPresentation( GetDoc()->getPresentation() );
1717 0 : if(xPresentation.is() && xPresentation->isRunning())
1718 : {
1719 0 : if( mpDrawView->IsTextEdit() )
1720 0 : mpDrawView->SdrEndTextEdit();
1721 :
1722 0 : xPresentation->end();
1723 0 : }
1724 0 : }
1725 :
1726 0 : } // end of namespace sd
1727 :
1728 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|