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