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 : #include "fuzoom.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 2 : void ImpAddPrintableCharactersToTextEdit(SfxRequest& rReq, ::sd::View* pView)
109 : {
110 : // evtl. feed characters to activated textedit
111 2 : const SfxItemSet* pSet = rReq.GetArgs();
112 :
113 2 : if(pSet)
114 : {
115 2 : OUString aInputString;
116 :
117 2 : if(SfxItemState::SET == pSet->GetItemState(SID_ATTR_CHAR))
118 2 : aInputString = static_cast<const SfxStringItem&>(pSet->Get(SID_ATTR_CHAR)).GetValue();
119 :
120 2 : if(!aInputString.isEmpty())
121 : {
122 2 : OutlinerView* pOLV = pView->GetTextEditOutlinerView();
123 :
124 2 : if(pOLV)
125 : {
126 4 : for(sal_Int32 a(0); a < aInputString.getLength(); a++)
127 : {
128 2 : sal_Char aChar = (sal_Char)aInputString[a];
129 2 : vcl::KeyCode aKeyCode;
130 2 : KeyEvent aKeyEvent(aChar, aKeyCode);
131 :
132 : // add actual character
133 2 : pOLV->PostKeyEvent(aKeyEvent);
134 : }
135 : }
136 2 : }
137 : }
138 2 : }
139 :
140 139 : void DrawViewShell::FuPermanent(SfxRequest& rReq)
141 : {
142 : // We do not execute a thing during a native slide show
143 :
144 139 : if (SlideShow::IsRunning(GetViewShellBase()))
145 0 : return;
146 :
147 139 : sal_uInt16 nSId = rReq.GetSlot();
148 :
149 143 : if( HasCurrentFunction() &&
150 3 : ( nSId == SID_TEXTEDIT || nSId == SID_ATTR_CHAR || nSId == SID_TEXT_FITTOSIZE ||
151 1 : nSId == SID_ATTR_CHAR_VERTICAL || nSId == SID_TEXT_FITTOSIZE_VERTICAL ) )
152 : {
153 4 : rtl::Reference<FuPoor> xFunc( GetCurrentFunction() );
154 :
155 4 : FuText* pFuText = dynamic_cast< FuText* >( xFunc.get() );
156 :
157 4 : if( pFuText )
158 : {
159 1 : pFuText->SetPermanent(true);
160 1 : xFunc->ReceiveRequest( rReq );
161 :
162 1 : MapSlot( nSId );
163 :
164 1 : Invalidate();
165 :
166 1 : Invalidate();
167 :
168 : // evtl. feed characters to activated textedit
169 1 : if(SID_ATTR_CHAR == nSId && GetView() && GetView()->IsTextEdit())
170 0 : ImpAddPrintableCharactersToTextEdit(rReq, GetView());
171 :
172 1 : rReq.Done();
173 1 : return;
174 3 : }
175 : }
176 :
177 138 : CheckLineTo (rReq);
178 138 : sal_uInt16 nOldSId = 0;
179 138 : bool bPermanent = false;
180 :
181 138 : if( !mpDrawView )
182 0 : return;
183 :
184 138 : if(HasCurrentFunction())
185 : {
186 4 : 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 4 : if(GetOldFunction() == GetCurrentFunction())
194 : {
195 4 : SetOldFunction(0);
196 : }
197 : }
198 :
199 7 : if ( nSId != SID_TEXTEDIT && nSId != SID_ATTR_CHAR && nSId != SID_TEXT_FITTOSIZE &&
200 1 : nSId != SID_ATTR_CHAR_VERTICAL && nSId != SID_TEXT_FITTOSIZE_VERTICAL &&
201 5 : nSId != SID_FORMATPAINTBRUSH &&
202 1 : mpDrawView->IsTextEdit() )
203 : {
204 0 : mpDrawView->SdrEndTextEdit();
205 : }
206 :
207 4 : if( HasCurrentFunction() )
208 : {
209 4 : nOldSId = GetCurrentFunction()->GetSlotID();
210 :
211 4 : if (nOldSId == nSId ||
212 3 : ((nOldSId == SID_TEXTEDIT || nOldSId == SID_ATTR_CHAR || nOldSId == SID_TEXT_FITTOSIZE ||
213 3 : 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 1 : bPermanent = true;
218 : }
219 :
220 4 : GetCurrentFunction()->Deactivate();
221 : }
222 :
223 4 : SetCurrentFunction(0);
224 :
225 4 : SfxBindings& rBind = GetViewFrame()->GetBindings();
226 4 : rBind.Invalidate(nOldSId);
227 4 : rBind.Update(nOldSId);
228 : }
229 :
230 : // map Slot (ToolboxImages/-Slots)
231 138 : MapSlot( nSId );
232 :
233 138 : 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 3 : SetCurrentFunction( FuText::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
242 3 : GetCurrentFunction()->DoExecute(rReq);
243 :
244 3 : SfxBindings& rBindings = GetViewFrame()->GetBindings();
245 3 : rBindings.Invalidate( SID_ATTR_CHAR );
246 3 : rBindings.Invalidate( SID_ATTR_CHAR_VERTICAL );
247 3 : rBindings.Invalidate( SID_TEXT_FITTOSIZE );
248 3 : rBindings.Invalidate( SID_TEXT_FITTOSIZE_VERTICAL );
249 :
250 : // evtl. feed characters to activated textedit
251 3 : if(SID_ATTR_CHAR == nSId && GetView() && GetView()->IsTextEdit())
252 2 : ImpAddPrintableCharactersToTextEdit(rReq, GetView());
253 :
254 3 : rReq.Done();
255 : }
256 3 : 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 135 : short nSlotId = rReq.GetSlot();
313 :
314 135 : 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 135 : if (nSlotId == SID_OBJECT_CROOK_ROTATE ||
325 135 : 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 : ScopedVclPtr<InfoBox>::Create(pWindow, SD_RESSTR(STR_ACTION_NOTPOSSIBLE) )->Execute();
335 : }
336 0 : else if ( ScopedVclPtr<QueryBox>::Create(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( GetActiveWindow() );
342 0 : mpDrawView->ConvertMarkedToPathObj(false);
343 : }
344 0 : }
345 : }
346 135 : else if (nSlotId == SID_OBJECT_SHEAR)
347 : {
348 0 : size_t i = 0;
349 0 : const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
350 0 : const size_t nMarkCnt = rMarkList.GetMarkCount();
351 0 : bool b3DObjMarked = false;
352 :
353 0 : while (i < nMarkCnt && !b3DObjMarked)
354 : {
355 0 : if (rMarkList.GetMark(i)->GetMarkedSdrObj()->ISA(E3dObject))
356 : {
357 0 : b3DObjMarked = 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 : ScopedVclPtr<InfoBox>::Create(pWindow, SD_RESSTR(STR_ACTION_NOTPOSSIBLE) )->Execute();
372 : }
373 0 : else if ( ScopedVclPtr<QueryBox>::Create(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( GetActiveWindow() );
379 0 : mpDrawView->ConvertMarkedToPathObj(false);
380 : }
381 : }
382 : }
383 :
384 135 : SetCurrentFunction( FuSelection::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
385 135 : rReq.Done();
386 135 : Invalidate( SID_OBJECT_SELECT );
387 : }
388 135 : 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, SfxCallMode::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 : case SID_ZOOM_MODE:
538 : case SID_ZOOM_PANNING:
539 : {
540 0 : mbZoomOnPage = false;
541 0 : SetCurrentFunction( FuZoom::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) );
542 0 : rReq.Done();
543 : }
544 0 : break;
545 :
546 : default:
547 0 : break;
548 : }
549 :
550 138 : if(HasOldFunction())
551 : {
552 1 : sal_uInt16 nSlotId = GetOldFunction()->GetSlotID();
553 :
554 1 : GetOldFunction()->Deactivate();
555 1 : SetOldFunction(0);
556 :
557 1 : SfxBindings& rBind = GetViewFrame()->GetBindings();
558 1 : rBind.Invalidate( nSlotId );
559 1 : rBind.Update( nSlotId );
560 : }
561 :
562 138 : if(HasCurrentFunction())
563 : {
564 138 : GetCurrentFunction()->Activate();
565 138 : SetOldFunction( GetCurrentFunction() );
566 :
567 138 : SetHelpId( GetCurrentFunction()->GetSlotID() );
568 : }
569 :
570 : // invalidate shell, is faster than every individually (says MI)
571 : // now explicit the last slot incl. Update()
572 138 : Invalidate();
573 :
574 : // CTRL-SID_OBJECT_SELECT -> select first draw object if none is selected yet
575 138 : if(SID_OBJECT_SELECT == nSId && HasCurrentFunction() && (rReq.GetModifier() & KEY_MOD1))
576 : {
577 0 : if(!GetView()->AreObjectsMarked())
578 : {
579 : // select first object
580 0 : GetView()->UnmarkAllObj();
581 0 : GetView()->MarkNextObj(true);
582 :
583 : // ...and make it visible
584 0 : if(GetView()->AreObjectsMarked())
585 0 : GetView()->MakeVisible(GetView()->GetAllMarkedRect(), *GetActiveWindow());
586 : }
587 : }
588 :
589 : // with qualifier construct directly
590 138 : if(HasCurrentFunction() && (rReq.GetModifier() & KEY_MOD1))
591 : {
592 : // get SdOptions
593 0 : SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType());
594 0 : sal_uInt32 nDefaultObjectSizeWidth(pOptions->GetDefaultObjectSizeWidth());
595 0 : sal_uInt32 nDefaultObjectSizeHeight(pOptions->GetDefaultObjectSizeHeight());
596 :
597 : // calc position and size
598 0 : Rectangle aVisArea = GetActiveWindow()->PixelToLogic(Rectangle(Point(0,0), GetActiveWindow()->GetOutputSizePixel()));
599 0 : Point aPagePos = aVisArea.Center();
600 0 : aPagePos.X() -= nDefaultObjectSizeWidth / 2;
601 0 : aPagePos.Y() -= nDefaultObjectSizeHeight / 2;
602 0 : Rectangle aNewObjectRectangle(aPagePos, Size(nDefaultObjectSizeWidth, nDefaultObjectSizeHeight));
603 0 : SdrPageView* pPageView = mpDrawView->GetSdrPageView();
604 :
605 0 : if(pPageView)
606 : {
607 : // create the default object
608 0 : SdrObject* pObj = GetCurrentFunction()->CreateDefaultObject(nSId, aNewObjectRectangle);
609 :
610 0 : if(pObj)
611 : {
612 : // insert into page
613 0 : GetView()->InsertObjectAtView(pObj, *pPageView);
614 :
615 : // Now that pFuActual has done what it was created for we
616 : // can switch on the edit mode for callout objects.
617 0 : switch (nSId)
618 : {
619 : case SID_DRAW_CAPTION:
620 : case SID_DRAW_CAPTION_VERTICAL:
621 : {
622 : // Make FuText the current function.
623 0 : SfxUInt16Item aItem (SID_TEXTEDIT, 1);
624 : GetViewFrame()->GetDispatcher()->
625 : Execute(SID_TEXTEDIT, SfxCallMode::SYNCHRON |
626 0 : SfxCallMode::RECORD, &aItem, 0L);
627 : // Put text object into edit mode.
628 0 : GetView()->SdrBeginTextEdit(static_cast<SdrTextObj*>(pObj), pPageView);
629 0 : break;
630 : }
631 : }
632 : }
633 : }
634 : }
635 : }
636 :
637 0 : void DrawViewShell::FuDeleteSelectedObjects()
638 : {
639 0 : if( !mpDrawView )
640 0 : return;
641 :
642 0 : bool bConsumed = false;
643 :
644 : //if any placeholders are selected
645 0 : if (mpDrawView->IsPresObjSelected(false, true, false, false))
646 : {
647 : //If there are placeholders in the list which can be toggled
648 : //off in edit->master->master elements then do that here,
649 0 : std::vector<SdrObject*> aPresMarksToRemove;
650 0 : const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
651 0 : for (size_t i=0; i < rMarkList.GetMarkCount(); ++i)
652 : {
653 0 : SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
654 0 : SdPage* pPage = static_cast<SdPage*>(pObj->GetPage());
655 0 : PresObjKind eKind = pPage->GetPresObjKind(pObj);
656 0 : if (eKind == PRESOBJ_FOOTER || eKind == PRESOBJ_HEADER ||
657 0 : eKind == PRESOBJ_DATETIME || eKind == PRESOBJ_SLIDENUMBER)
658 : {
659 0 : aPresMarksToRemove.push_back(pObj);
660 : }
661 : }
662 :
663 0 : for (SdrObject* pObj : aPresMarksToRemove)
664 : {
665 : //Unmark object
666 0 : mpDrawView->MarkObj(pObj, mpDrawView->GetSdrPageView(), true);
667 0 : SdPage* pPage = static_cast<SdPage*>(pObj->GetPage());
668 : //remove placeholder from master page
669 0 : pPage->DestroyDefaultPresObj(pPage->GetPresObjKind(pObj));
670 : }
671 :
672 0 : bConsumed = true;
673 : }
674 :
675 : // placeholders which cannot be deleted selected
676 0 : if (mpDrawView->IsPresObjSelected(false, true, false, true))
677 : {
678 0 : ::sd::Window* pWindow = GetActiveWindow();
679 0 : ScopedVclPtr<InfoBox>::Create(pWindow, SD_RESSTR(STR_ACTION_NOTPOSSIBLE) )->Execute();
680 0 : bConsumed = true;
681 : }
682 :
683 0 : if (!bConsumed)
684 : {
685 0 : vcl::KeyCode aKCode(KEY_DELETE);
686 0 : KeyEvent aKEvt( 0, aKCode);
687 :
688 0 : bConsumed = mpDrawView->getSmartTags().KeyInput( aKEvt );
689 :
690 0 : if (!bConsumed && HasCurrentFunction())
691 0 : bConsumed = GetCurrentFunction()->KeyInput(aKEvt);
692 :
693 0 : if (!bConsumed)
694 0 : mpDrawView->DeleteMarked();
695 : }
696 : }
697 :
698 435 : void DrawViewShell::FuSupport(SfxRequest& rReq)
699 : {
700 435 : if( rReq.GetSlot() == SID_STYLE_FAMILY && rReq.GetArgs())
701 0 : GetDocSh()->SetStyleFamily(static_cast<const SfxUInt16Item&>(rReq.GetArgs()->Get( SID_STYLE_FAMILY )).GetValue());
702 :
703 : // We do not execute a thing during a native slide show
704 435 : if(SlideShow::IsRunning(GetViewShellBase()) &&
705 0 : (rReq.GetSlot() != SID_PRESENTATION_END &&
706 0 : rReq.GetSlot() != SID_SIZE_PAGE))
707 0 : return;
708 :
709 435 : CheckLineTo (rReq);
710 :
711 435 : if( !mpDrawView )
712 0 : return;
713 :
714 435 : sal_uInt16 nSId = rReq.GetSlot();
715 :
716 : // maybe we map the slot (ToolboxImages/-Slots)
717 435 : MapSlot( nSId );
718 :
719 435 : switch ( nSId )
720 : {
721 : case SID_CLEAR_UNDO_STACK:
722 : {
723 0 : GetDocSh()->ClearUndoBuffer();
724 0 : rReq.Ignore ();
725 : }
726 0 : break;
727 :
728 : // execute slots of ToolboxController mapped
729 : case SID_OBJECT_CHOOSE_MODE:
730 : case SID_POSITION:
731 : case SID_OBJECT_ALIGN:
732 : case SID_ZOOM_TOOLBOX:
733 : case SID_DRAWTBX_TEXT:
734 : case SID_DRAWTBX_RECTANGLES:
735 : case SID_DRAWTBX_ELLIPSES:
736 : case SID_DRAWTBX_LINES:
737 : case SID_DRAWTBX_ARROWS:
738 : case SID_DRAWTBX_3D_OBJECTS:
739 : case SID_DRAWTBX_CONNECTORS:
740 : case SID_DRAWTBX_INSERT:
741 : {
742 0 : sal_uInt16 nMappedSlot = GetMappedSlot( nSId );
743 0 : if( nMappedSlot > 0 )
744 : {
745 0 : SfxRequest aReq( nMappedSlot, SfxCallMode::SLOT, GetDoc()->GetItemPool() );
746 0 : ExecuteSlot( aReq );
747 : }
748 : }
749 0 : break;
750 :
751 : case SID_PRESENTATION:
752 : case SID_PRESENTATION_CURRENT_SLIDE:
753 : case SID_REHEARSE_TIMINGS:
754 : {
755 0 : ShowSlideShow(rReq);
756 0 : rReq.Ignore ();
757 : }
758 0 : break;
759 :
760 : case SID_PRESENTATION_END:
761 : {
762 0 : StopSlideShow(true);
763 :
764 0 : rReq.Ignore ();
765 : }
766 0 : break;
767 :
768 : case SID_BEZIER_EDIT:
769 : {
770 0 : mpDrawView->SetFrameDragSingles(!mpDrawView->IsFrameDragSingles());
771 :
772 : /******************************************************************
773 : * turn ObjectBar on
774 : ******************************************************************/
775 0 : if( dynamic_cast< FuSelection* >( GetCurrentFunction().get() ) || dynamic_cast< FuConstructBezierPolygon* >( GetCurrentFunction().get() ) )
776 : {
777 : // Tell the tool bar manager about the context change.
778 0 : GetViewShellBase().GetToolBarManager()->SelectionHasChanged(*this,*mpDrawView);
779 : }
780 :
781 0 : Invalidate(SID_BEZIER_EDIT);
782 0 : rReq.Ignore();
783 : }
784 0 : break;
785 :
786 : case SID_OBJECT_CLOSE:
787 : {
788 0 : const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
789 0 : if ( rMarkList.GetMark(0) && !mpDrawView->IsAction() )
790 : {
791 0 : SdrPathObj* pPathObj = static_cast<SdrPathObj*>( rMarkList.GetMark(0)->GetMarkedSdrObj());
792 0 : const bool bUndo = mpDrawView->IsUndoEnabled();
793 0 : if( bUndo )
794 0 : mpDrawView->BegUndo(SD_RESSTR(STR_UNDO_BEZCLOSE));
795 :
796 0 : mpDrawView->UnmarkAllPoints();
797 :
798 0 : if( bUndo )
799 0 : mpDrawView->AddUndo(new SdrUndoGeoObj(*pPathObj));
800 :
801 0 : pPathObj->ToggleClosed();
802 :
803 0 : if( bUndo )
804 0 : mpDrawView->EndUndo();
805 : }
806 0 : rReq.Done();
807 : }
808 0 : break;
809 :
810 : case SID_CUT:
811 : {
812 0 : if ( mpDrawView->IsPresObjSelected(false, true, false, true) )
813 : {
814 0 : ::sd::Window* pWindow = GetActiveWindow();
815 0 : ScopedVclPtr<InfoBox>::Create(pWindow, SD_RESSTR(STR_ACTION_NOTPOSSIBLE) )->Execute();
816 : }
817 : else
818 : {
819 0 : if(HasCurrentFunction())
820 : {
821 0 : GetCurrentFunction()->DoCut();
822 : }
823 0 : else if(mpDrawView)
824 : {
825 0 : mpDrawView->DoCut();
826 : }
827 : }
828 0 : rReq.Ignore ();
829 : }
830 0 : break;
831 :
832 : case SID_COPY:
833 : {
834 0 : if ( mpDrawView->IsPresObjSelected(false, true, false, true) )
835 : {
836 0 : ::sd::Window* pWindow = GetActiveWindow();
837 0 : ScopedVclPtr<InfoBox>::Create(pWindow, SD_RESSTR(STR_ACTION_NOTPOSSIBLE) )->Execute();
838 : }
839 : else
840 : {
841 0 : if(HasCurrentFunction())
842 : {
843 0 : GetCurrentFunction()->DoCopy();
844 : }
845 0 : else if( mpDrawView )
846 : {
847 0 : mpDrawView->DoCopy();
848 : }
849 : }
850 0 : rReq.Ignore ();
851 : }
852 0 : break;
853 :
854 : case SID_PASTE:
855 : {
856 0 : WaitObject aWait( GetActiveWindow() );
857 :
858 0 : if(HasCurrentFunction())
859 : {
860 0 : GetCurrentFunction()->DoPaste();
861 : }
862 0 : else if(mpDrawView)
863 : {
864 0 : mpDrawView->DoPaste();
865 : }
866 :
867 0 : rReq.Ignore ();
868 : }
869 0 : break;
870 :
871 : case SID_PASTE_UNFORMATTED:
872 : {
873 0 : WaitObject aWait( GetActiveWindow() );
874 :
875 0 : if(HasCurrentFunction())
876 : {
877 0 : GetCurrentFunction()->DoPasteUnformatted();
878 : }
879 0 : else if(mpDrawView)
880 : {
881 0 : sal_Int8 nAction = DND_ACTION_COPY;
882 0 : TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) );
883 0 : if (aDataHelper.GetTransferable().is())
884 : {
885 : mpDrawView->InsertData( aDataHelper,
886 0 : GetActiveWindow()->PixelToLogic( Rectangle( Point(), GetActiveWindow()->GetOutputSizePixel() ).Center() ),
887 0 : nAction, false, SotClipboardFormatId::STRING);
888 0 : }
889 : }
890 :
891 0 : rReq.Ignore ();
892 : }
893 0 : break;
894 :
895 : case SID_CLIPBOARD_FORMAT_ITEMS:
896 : {
897 0 : WaitObject aWait( GetActiveWindow() );
898 0 : TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) );
899 0 : const SfxItemSet* pReqArgs = rReq.GetArgs();
900 0 : SotClipboardFormatId nFormat = SotClipboardFormatId::NONE;
901 :
902 0 : if( pReqArgs )
903 : {
904 0 : SFX_REQUEST_ARG( rReq, pIsActive, SfxUInt32Item, SID_CLIPBOARD_FORMAT_ITEMS, false );
905 0 : nFormat = static_cast<SotClipboardFormatId>(pIsActive->GetValue());
906 : }
907 :
908 0 : if( nFormat != SotClipboardFormatId::NONE && aDataHelper.GetTransferable().is() )
909 : {
910 0 : sal_Int8 nAction = DND_ACTION_COPY;
911 :
912 0 : if( !mpDrawView->InsertData( aDataHelper,
913 0 : GetActiveWindow()->PixelToLogic( Rectangle( Point(), GetActiveWindow()->GetOutputSizePixel() ).Center() ),
914 0 : nAction, false, nFormat ) )
915 : {
916 0 : INetBookmark aINetBookmark( aEmptyStr, aEmptyStr );
917 :
918 0 : if( ( aDataHelper.HasFormat( SotClipboardFormatId::NETSCAPE_BOOKMARK ) &&
919 0 : aDataHelper.GetINetBookmark( SotClipboardFormatId::NETSCAPE_BOOKMARK, aINetBookmark ) ) ||
920 0 : ( aDataHelper.HasFormat( SotClipboardFormatId::FILEGRPDESCRIPTOR ) &&
921 0 : aDataHelper.GetINetBookmark( SotClipboardFormatId::FILEGRPDESCRIPTOR, aINetBookmark ) ) ||
922 0 : ( aDataHelper.HasFormat( SotClipboardFormatId::UNIFORMRESOURCELOCATOR ) &&
923 0 : aDataHelper.GetINetBookmark( SotClipboardFormatId::UNIFORMRESOURCELOCATOR, aINetBookmark ) ) )
924 : {
925 0 : InsertURLField( aINetBookmark.GetURL(), aINetBookmark.GetDescription(), aEmptyStr, NULL );
926 0 : }
927 : }
928 0 : }
929 : }
930 0 : break;
931 :
932 : case SID_DELETE:
933 : {
934 0 : if ( mpDrawView->IsTextEdit() )
935 : {
936 0 : OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
937 :
938 0 : if (pOLV)
939 : {
940 0 : vcl::KeyCode aKCode(KEY_DELETE);
941 0 : KeyEvent aKEvt( 0, aKCode);
942 0 : pOLV->PostKeyEvent(aKEvt);
943 : }
944 : }
945 : else
946 : {
947 0 : FuDeleteSelectedObjects();
948 : }
949 0 : rReq.Ignore ();
950 : }
951 0 : break;
952 :
953 : case SID_NOTESMODE:
954 : case SID_HANDOUTMODE:
955 : // AutoLayouts have to be ready.
956 0 : GetDoc()->StopWorkStartupDelay();
957 : // Fall through to following case statements.
958 :
959 : case SID_DRAWINGMODE:
960 : case SID_DIAMODE:
961 : case SID_OUTLINEMODE:
962 : // Let the sub-shell manager handle the slot handling.
963 0 : framework::FrameworkHelper::Instance(GetViewShellBase())->HandleModeChangeSlot(
964 : nSId,
965 0 : rReq);
966 0 : rReq.Ignore ();
967 0 : break;
968 :
969 : case SID_MASTERPAGE: // BASIC
970 : case SID_SLIDE_MASTERPAGE: // BASIC
971 : case SID_TITLE_MASTERPAGE: // BASIC
972 : case SID_NOTES_MASTERPAGE: // BASIC
973 : case SID_HANDOUT_MASTERPAGE: // BASIC
974 : {
975 : // AutoLayouts needs to be finished
976 0 : GetDoc()->StopWorkStartupDelay();
977 :
978 0 : const SfxItemSet* pReqArgs = rReq.GetArgs();
979 :
980 0 : if ( pReqArgs )
981 : {
982 0 : SFX_REQUEST_ARG (rReq, pIsActive, SfxBoolItem, SID_MASTERPAGE, false);
983 0 : mbIsLayerModeActive = pIsActive->GetValue ();
984 : }
985 :
986 : Broadcast (
987 0 : ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_START));
988 :
989 0 : if (nSId == SID_MASTERPAGE ||
990 0 : (nSId == SID_SLIDE_MASTERPAGE && mePageKind == PK_STANDARD) ||
991 0 : (nSId == SID_TITLE_MASTERPAGE && mePageKind == PK_STANDARD) ||
992 0 : (nSId == SID_NOTES_MASTERPAGE && mePageKind == PK_NOTES) ||
993 0 : (nSId == SID_HANDOUT_MASTERPAGE && mePageKind == PK_HANDOUT))
994 : {
995 0 : if (nSId == SID_TITLE_MASTERPAGE ||
996 : nSId == SID_SLIDE_MASTERPAGE)
997 : {
998 : // Is there a page with the AutoLayout "Title"?
999 0 : bool bFound = false;
1000 0 : sal_uInt16 i = 0;
1001 0 : sal_uInt16 nCount = GetDoc()->GetSdPageCount(PK_STANDARD);
1002 :
1003 0 : while (i < nCount && !bFound)
1004 : {
1005 0 : SdPage* pPage = GetDoc()->GetSdPage(i, PK_STANDARD);
1006 :
1007 0 : if (nSId == SID_TITLE_MASTERPAGE && pPage->GetAutoLayout() == AUTOLAYOUT_TITLE)
1008 : {
1009 0 : bFound = true;
1010 0 : SwitchPage((pPage->GetPageNum() - 1) / 2);
1011 : }
1012 0 : else if (nSId == SID_SLIDE_MASTERPAGE && pPage->GetAutoLayout() != AUTOLAYOUT_TITLE)
1013 : {
1014 0 : bFound = true;
1015 0 : SwitchPage((pPage->GetPageNum() - 1) / 2);
1016 : }
1017 :
1018 0 : i++;
1019 : }
1020 : }
1021 :
1022 : // turn on default layer of MasterPage
1023 0 : mpDrawView->SetActiveLayer( SD_RESSTR(STR_LAYER_BCKGRNDOBJ) );
1024 :
1025 0 : ChangeEditMode(EM_MASTERPAGE, mbIsLayerModeActive);
1026 :
1027 0 : if(HasCurrentFunction(SID_BEZIER_EDIT))
1028 0 : GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SfxCallMode::ASYNCHRON);
1029 : }
1030 : else
1031 : {
1032 : // Switch to requested ViewShell.
1033 0 : ::OUString sRequestedView;
1034 : PageKind ePageKind;
1035 0 : switch (nSId)
1036 : {
1037 : case SID_SLIDE_MASTERPAGE:
1038 : case SID_TITLE_MASTERPAGE:
1039 : default:
1040 0 : sRequestedView = framework::FrameworkHelper::msImpressViewURL;
1041 0 : ePageKind = PK_STANDARD;
1042 0 : break;
1043 :
1044 : case SID_NOTES_MASTERPAGE:
1045 0 : sRequestedView = framework::FrameworkHelper::msNotesViewURL;
1046 0 : ePageKind = PK_NOTES;
1047 0 : break;
1048 :
1049 : case SID_HANDOUT_MASTERPAGE:
1050 0 : sRequestedView = framework::FrameworkHelper::msHandoutViewURL;
1051 0 : ePageKind = PK_HANDOUT;
1052 0 : break;
1053 : }
1054 :
1055 0 : mpFrameView->SetViewShEditMode(EM_MASTERPAGE, ePageKind);
1056 0 : mpFrameView->SetLayerMode(mbIsLayerModeActive);
1057 0 : framework::FrameworkHelper::Instance(GetViewShellBase())->RequestView(
1058 : sRequestedView,
1059 0 : framework::FrameworkHelper::msCenterPaneURL);
1060 : }
1061 : Broadcast (
1062 0 : ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_END));
1063 :
1064 0 : InvalidateWindows();
1065 0 : Invalidate();
1066 :
1067 0 : rReq.Done();
1068 : }
1069 0 : break;
1070 :
1071 : case SID_CLOSE_MASTER_VIEW:
1072 : {
1073 : Broadcast (
1074 0 : ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_START));
1075 :
1076 : // Switch page back to the first one. Not doing so leads to a
1077 : // crash. This seems to be some bug in the edit mode switching
1078 : // and page switching methods.
1079 0 : SwitchPage (0);
1080 0 : ChangeEditMode(EM_PAGE, IsLayerModeActive());
1081 : Broadcast (
1082 0 : ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_END));
1083 :
1084 0 : if(HasCurrentFunction(SID_BEZIER_EDIT))
1085 : {
1086 : GetViewFrame()->GetDispatcher()->Execute(
1087 : SID_OBJECT_SELECT,
1088 0 : SfxCallMode::ASYNCHRON);
1089 : }
1090 :
1091 0 : rReq.Done();
1092 : }
1093 0 : break;
1094 :
1095 : case SID_RULER:
1096 : {
1097 0 : const SfxItemSet* pReqArgs = rReq.GetArgs();
1098 :
1099 : // Remember old ruler state
1100 0 : bool bOldHasRuler(HasRuler());
1101 :
1102 0 : if ( pReqArgs )
1103 : {
1104 0 : SFX_REQUEST_ARG (rReq, pIsActive, SfxBoolItem, SID_RULER, false);
1105 0 : SetRuler (pIsActive->GetValue ());
1106 : }
1107 0 : else SetRuler (!HasRuler());
1108 :
1109 : // Did ruler state change? Tell that to SdOptions, too.
1110 0 : bool bHasRuler(HasRuler());
1111 :
1112 0 : if(bOldHasRuler != bHasRuler)
1113 : {
1114 0 : SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType());
1115 :
1116 0 : if(pOptions && pOptions->IsRulerVisible() != bHasRuler)
1117 : {
1118 0 : pOptions->SetRulerVisible(bHasRuler);
1119 : }
1120 : }
1121 :
1122 0 : Invalidate (SID_RULER);
1123 0 : Resize();
1124 0 : rReq.Done ();
1125 : }
1126 0 : break;
1127 :
1128 : case SID_SIZE_PAGE:
1129 : case SID_SIZE_PAGE_WIDTH: // BASIC
1130 : {
1131 427 : mbZoomOnPage = ( rReq.GetSlot() == SID_SIZE_PAGE );
1132 :
1133 427 : SdrPageView* pPageView = mpDrawView->GetSdrPageView();
1134 :
1135 427 : if ( pPageView )
1136 : {
1137 427 : Point aPagePos(0, 0); // = pPageView->GetOffset();
1138 427 : Size aPageSize = pPageView->GetPage()->GetSize();
1139 :
1140 427 : aPagePos.X() += aPageSize.Width() / 2;
1141 427 : aPageSize.Width() = (long) (aPageSize.Width() * 1.03);
1142 :
1143 427 : if( rReq.GetSlot() == SID_SIZE_PAGE )
1144 : {
1145 427 : aPagePos.Y() += aPageSize.Height() / 2;
1146 427 : aPageSize.Height() = (long) (aPageSize.Height() * 1.03);
1147 427 : aPagePos.Y() -= aPageSize.Height() / 2;
1148 : }
1149 : else
1150 : {
1151 0 : Point aPt = GetActiveWindow()->PixelToLogic( Point( 0, GetActiveWindow()->GetSizePixel().Height() / 2 ) );
1152 0 : aPagePos.Y() += aPt.Y();
1153 0 : aPageSize.Height() = 2;
1154 : }
1155 :
1156 427 : aPagePos.X() -= aPageSize.Width() / 2;
1157 :
1158 427 : SetZoomRect( Rectangle( aPagePos, aPageSize ) );
1159 :
1160 427 : Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
1161 854 : GetActiveWindow()->GetOutputSizePixel()) );
1162 427 : mpZoomList->InsertZoomRect(aVisAreaWin);
1163 : }
1164 427 : Invalidate( SID_ZOOM_IN );
1165 427 : Invalidate( SID_ZOOM_OUT );
1166 427 : Invalidate( SID_ZOOM_PANNING );
1167 427 : Invalidate( SID_ZOOM_TOOLBOX );
1168 427 : rReq.Done ();
1169 : }
1170 427 : break;
1171 :
1172 : case SID_SIZE_REAL: // BASIC
1173 : {
1174 0 : mbZoomOnPage = false;
1175 0 : SetZoom( 100 );
1176 0 : Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
1177 0 : GetActiveWindow()->GetOutputSizePixel()) );
1178 0 : mpZoomList->InsertZoomRect(aVisAreaWin);
1179 0 : Invalidate( SID_ZOOM_IN );
1180 0 : Invalidate( SID_ZOOM_OUT );
1181 0 : Invalidate( SID_ZOOM_PANNING );
1182 0 : Invalidate( SID_ZOOM_TOOLBOX );
1183 0 : rReq.Done ();
1184 : }
1185 0 : break;
1186 :
1187 : case SID_ZOOM_IN: // BASIC
1188 : {
1189 0 : mbZoomOnPage = false;
1190 0 : SetZoom( std::max( (long) ( GetActiveWindow()->GetZoom() / 2 ), (long) GetActiveWindow()->GetMinZoom() ) );
1191 0 : Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
1192 0 : GetActiveWindow()->GetOutputSizePixel()) );
1193 0 : mpZoomList->InsertZoomRect(aVisAreaWin);
1194 0 : Invalidate( SID_ZOOM_IN );
1195 0 : Invalidate( SID_ZOOM_OUT );
1196 0 : Invalidate( SID_ZOOM_PANNING );
1197 0 : Invalidate( SID_ZOOM_TOOLBOX );
1198 0 : rReq.Done ();
1199 : }
1200 0 : break;
1201 :
1202 : case SID_ZOOM_OUT:
1203 : {
1204 0 : mbZoomOnPage = false;
1205 0 : SetZoom( std::min( (long) ( GetActiveWindow()->GetZoom() * 2 ), (long) GetActiveWindow()->GetMaxZoom() ) );
1206 0 : Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
1207 0 : GetActiveWindow()->GetOutputSizePixel()) );
1208 0 : mpZoomList->InsertZoomRect(aVisAreaWin);
1209 0 : Invalidate( SID_ZOOM_IN );
1210 0 : Invalidate( SID_ZOOM_PANNING );
1211 0 : Invalidate( SID_ZOOM_TOOLBOX );
1212 0 : rReq.Done ();
1213 : }
1214 0 : break;
1215 :
1216 : case SID_SIZE_VISAREA:
1217 : {
1218 0 : Rectangle aVisArea = mpFrameView->GetVisArea();
1219 0 : Size aVisAreaSize = aVisArea.GetSize();
1220 :
1221 0 : if (aVisAreaSize.Height()!=0 && aVisAreaSize.Width()!=0)
1222 : {
1223 0 : mbZoomOnPage = false;
1224 0 : SetZoomRect(aVisArea);
1225 0 : Invalidate( SID_ZOOM_IN );
1226 0 : Invalidate( SID_ZOOM_OUT );
1227 0 : Invalidate( SID_ZOOM_PANNING );
1228 0 : Invalidate( SID_ZOOM_TOOLBOX );
1229 : }
1230 0 : rReq.Done ();
1231 : }
1232 0 : break;
1233 :
1234 : // name confusion: SID_SIZE_OPTIMAL -> Zoom onto selected objects
1235 : // --> Is offered as object zoom in program
1236 : case SID_SIZE_OPTIMAL: // BASIC
1237 : {
1238 0 : mbZoomOnPage = false;
1239 0 : if ( mpDrawView->AreObjectsMarked() )
1240 : {
1241 0 : maMarkRect = mpDrawView->GetAllMarkedRect();
1242 0 : long nW = (long) (maMarkRect.GetWidth() * 1.03);
1243 0 : long nH = (long) (maMarkRect.GetHeight() * 1.03);
1244 0 : Point aPos = maMarkRect.Center();
1245 0 : aPos.X() -= nW / 2;
1246 0 : aPos.Y() -= nH / 2;
1247 0 : if ( nW && nH )
1248 : {
1249 0 : SetZoomRect(Rectangle(aPos, Size(nW, nH)));
1250 :
1251 0 : Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
1252 0 : GetActiveWindow()->GetOutputSizePixel()) );
1253 0 : mpZoomList->InsertZoomRect(aVisAreaWin);
1254 : }
1255 : }
1256 0 : Invalidate( SID_ZOOM_IN );
1257 0 : Invalidate( SID_ZOOM_OUT );
1258 0 : Invalidate( SID_ZOOM_PANNING );
1259 0 : Invalidate( SID_ZOOM_TOOLBOX );
1260 0 : rReq.Done ();
1261 : }
1262 0 : break;
1263 :
1264 : // name confusion: SID_SIZE_ALL -> Zoom onto all objects
1265 : // --> Is offered as optimal in program
1266 : case SID_SIZE_ALL: // BASIC
1267 : {
1268 0 : mbZoomOnPage = false;
1269 0 : SdrPageView* pPageView = mpDrawView->GetSdrPageView();
1270 :
1271 0 : if( pPageView )
1272 : {
1273 0 : Rectangle aBoundRect( pPageView->GetObjList()->GetAllObjBoundRect() );
1274 :
1275 0 : long nW = (long) (aBoundRect.GetWidth() * 1.03);
1276 0 : long nH = (long) (aBoundRect.GetHeight() * 1.03);
1277 0 : Point aPos = aBoundRect.Center();
1278 0 : aPos.X() -= nW / 2;
1279 0 : aPos.Y() -= nH / 2;
1280 0 : if ( nW && nH )
1281 : {
1282 0 : SetZoomRect( Rectangle( aPos, Size( nW, nH ) ) );
1283 :
1284 0 : Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
1285 0 : GetActiveWindow()->GetOutputSizePixel()) );
1286 0 : mpZoomList->InsertZoomRect(aVisAreaWin);
1287 : }
1288 :
1289 0 : Invalidate( SID_ZOOM_IN );
1290 0 : Invalidate( SID_ZOOM_OUT );
1291 0 : Invalidate( SID_ZOOM_PANNING );
1292 0 : Invalidate( SID_ZOOM_TOOLBOX );
1293 : }
1294 0 : rReq.Done ();
1295 : }
1296 0 : break;
1297 :
1298 : case SID_ZOOM_PREV:
1299 : {
1300 0 : if (mpDrawView->IsTextEdit())
1301 : {
1302 0 : mpDrawView->SdrEndTextEdit();
1303 : }
1304 :
1305 0 : if (mpZoomList->IsPreviousPossible())
1306 : {
1307 : // set previous ZoomRect
1308 0 : SetZoomRect(mpZoomList->GetPreviousZoomRect());
1309 : }
1310 0 : rReq.Done ();
1311 0 : Invalidate( SID_ZOOM_TOOLBOX );
1312 : }
1313 0 : break;
1314 :
1315 : case SID_ZOOM_NEXT:
1316 : {
1317 0 : if (mpDrawView->IsTextEdit())
1318 : {
1319 0 : mpDrawView->SdrEndTextEdit();
1320 : }
1321 :
1322 0 : if (mpZoomList->IsNextPossible())
1323 : {
1324 : // set next ZoomRect
1325 0 : SetZoomRect(mpZoomList->GetNextZoomRect());
1326 : }
1327 0 : rReq.Done ();
1328 0 : Invalidate( SID_ZOOM_TOOLBOX );
1329 : }
1330 0 : break;
1331 :
1332 : case SID_GLUE_INSERT_POINT:
1333 : case SID_GLUE_PERCENT:
1334 : case SID_GLUE_ESCDIR:
1335 : case SID_GLUE_ESCDIR_LEFT:
1336 : case SID_GLUE_ESCDIR_RIGHT:
1337 : case SID_GLUE_ESCDIR_TOP:
1338 : case SID_GLUE_ESCDIR_BOTTOM:
1339 : case SID_GLUE_HORZALIGN_CENTER:
1340 : case SID_GLUE_HORZALIGN_LEFT:
1341 : case SID_GLUE_HORZALIGN_RIGHT:
1342 : case SID_GLUE_VERTALIGN_CENTER:
1343 : case SID_GLUE_VERTALIGN_TOP:
1344 : case SID_GLUE_VERTALIGN_BOTTOM:
1345 : {
1346 0 : rtl::Reference<FuPoor> xFunc( GetCurrentFunction() );
1347 0 : FuEditGluePoints* pFunc = dynamic_cast< FuEditGluePoints* >( xFunc.get() );
1348 :
1349 0 : if(pFunc)
1350 0 : pFunc->ReceiveRequest(rReq);
1351 :
1352 0 : rReq.Done();
1353 : }
1354 0 : break;
1355 :
1356 : #ifdef DBG_UTIL
1357 : case SID_SHOW_ITEMBROWSER:
1358 : {
1359 : mpDrawView->ShowItemBrowser( !mpDrawView->IsItemBrowserVisible() );
1360 : rReq.Done ();
1361 : }
1362 : break;
1363 : #endif
1364 :
1365 : case SID_AUTOSPELL_CHECK:
1366 : {
1367 0 : bool bOnlineSpell = !GetDoc()->GetOnlineSpell();
1368 0 : GetDoc()->SetOnlineSpell(bOnlineSpell);
1369 :
1370 0 : ::Outliner* pOL = mpDrawView->GetTextEditOutliner();
1371 :
1372 0 : if (pOL)
1373 : {
1374 0 : EEControlBits nCntrl = pOL->GetControlWord();
1375 :
1376 0 : if (bOnlineSpell)
1377 0 : nCntrl |= EEControlBits::ONLINESPELLING;
1378 : else
1379 0 : nCntrl &= ~EEControlBits::ONLINESPELLING;
1380 :
1381 0 : pOL->SetControlWord(nCntrl);
1382 : }
1383 :
1384 0 : GetActiveWindow()->Invalidate();
1385 0 : rReq.Done ();
1386 : }
1387 0 : break;
1388 :
1389 : case SID_CONVERT_TO_1BIT_THRESHOLD:
1390 : case SID_CONVERT_TO_1BIT_MATRIX:
1391 : case SID_CONVERT_TO_4BIT_GRAYS:
1392 : case SID_CONVERT_TO_4BIT_COLORS:
1393 : case SID_CONVERT_TO_8BIT_GRAYS:
1394 : case SID_CONVERT_TO_8BIT_COLORS:
1395 : case SID_CONVERT_TO_24BIT:
1396 : {
1397 0 : BmpConversion eBmpConvert = BMP_CONVERSION_NONE;
1398 :
1399 0 : switch( nSId )
1400 : {
1401 : case SID_CONVERT_TO_1BIT_THRESHOLD:
1402 0 : eBmpConvert = BMP_CONVERSION_1BIT_THRESHOLD;
1403 0 : break;
1404 :
1405 : case SID_CONVERT_TO_1BIT_MATRIX:
1406 0 : eBmpConvert = BMP_CONVERSION_1BIT_MATRIX;
1407 0 : break;
1408 :
1409 : case SID_CONVERT_TO_4BIT_GRAYS:
1410 0 : eBmpConvert = BMP_CONVERSION_4BIT_GREYS;
1411 0 : break;
1412 :
1413 : case SID_CONVERT_TO_4BIT_COLORS:
1414 0 : eBmpConvert = BMP_CONVERSION_4BIT_COLORS;
1415 0 : break;
1416 :
1417 : case SID_CONVERT_TO_8BIT_GRAYS:
1418 0 : eBmpConvert = BMP_CONVERSION_8BIT_GREYS;
1419 0 : break;
1420 :
1421 : case SID_CONVERT_TO_8BIT_COLORS:
1422 0 : eBmpConvert = BMP_CONVERSION_8BIT_COLORS;
1423 0 : break;
1424 :
1425 : case SID_CONVERT_TO_24BIT:
1426 0 : eBmpConvert = BMP_CONVERSION_24BIT;
1427 0 : break;
1428 : }
1429 :
1430 0 : mpDrawView->BegUndo(SD_RESSTR(STR_UNDO_COLORRESOLUTION));
1431 0 : const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
1432 :
1433 0 : for (size_t i=0; i<rMarkList.GetMarkCount(); ++i)
1434 : {
1435 0 : SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
1436 :
1437 0 : if (pObj->GetObjInventor() == SdrInventor)
1438 : {
1439 0 : if (pObj->GetObjIdentifier() == OBJ_GRAF && !static_cast<SdrGrafObj*>(pObj)->IsLinkedGraphic())
1440 : {
1441 0 : const Graphic& rGraphic = static_cast<SdrGrafObj*>(pObj)->GetGraphic();
1442 :
1443 0 : if( rGraphic.GetType() == GRAPHIC_BITMAP )
1444 : {
1445 0 : SdrGrafObj* pNewObj = static_cast<SdrGrafObj*>( pObj->Clone() );
1446 :
1447 0 : if( rGraphic.IsAnimated() )
1448 : {
1449 0 : Animation aAnim( rGraphic.GetAnimation() );
1450 0 : aAnim.Convert( eBmpConvert );
1451 0 : pNewObj->SetGraphic( aAnim );
1452 : }
1453 : else
1454 : {
1455 0 : BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
1456 0 : aBmpEx.Convert( eBmpConvert );
1457 0 : pNewObj->SetGraphic( aBmpEx );
1458 : }
1459 :
1460 0 : mpDrawView->ReplaceObjectAtView( pObj, *mpDrawView->GetSdrPageView(), pNewObj );
1461 : }
1462 : }
1463 : }
1464 : }
1465 :
1466 0 : mpDrawView->EndUndo();
1467 0 : rReq.Done ();
1468 : }
1469 0 : break;
1470 :
1471 : case SID_TRANSLITERATE_SENTENCE_CASE:
1472 : case SID_TRANSLITERATE_TITLE_CASE:
1473 : case SID_TRANSLITERATE_TOGGLE_CASE:
1474 : case SID_TRANSLITERATE_UPPER:
1475 : case SID_TRANSLITERATE_LOWER:
1476 : case SID_TRANSLITERATE_HALFWIDTH:
1477 : case SID_TRANSLITERATE_FULLWIDTH:
1478 : case SID_TRANSLITERATE_HIRAGANA:
1479 : case SID_TRANSLITERATE_KATAGANA:
1480 : {
1481 0 : OutlinerView* pOLV = GetView()->GetTextEditOutlinerView();
1482 0 : if( pOLV )
1483 : {
1484 : using namespace ::com::sun::star::i18n;
1485 0 : sal_Int32 nType = 0;
1486 :
1487 0 : switch( nSId )
1488 : {
1489 : case SID_TRANSLITERATE_SENTENCE_CASE:
1490 0 : nType = TransliterationModulesExtra::SENTENCE_CASE;
1491 0 : break;
1492 : case SID_TRANSLITERATE_TITLE_CASE:
1493 0 : nType = TransliterationModulesExtra::TITLE_CASE;
1494 0 : break;
1495 : case SID_TRANSLITERATE_TOGGLE_CASE:
1496 0 : nType = TransliterationModulesExtra::TOGGLE_CASE;
1497 0 : break;
1498 : case SID_TRANSLITERATE_UPPER:
1499 0 : nType = TransliterationModules_LOWERCASE_UPPERCASE;
1500 0 : break;
1501 : case SID_TRANSLITERATE_LOWER:
1502 0 : nType = TransliterationModules_UPPERCASE_LOWERCASE;
1503 0 : break;
1504 : case SID_TRANSLITERATE_HALFWIDTH:
1505 0 : nType = TransliterationModules_FULLWIDTH_HALFWIDTH;
1506 0 : break;
1507 : case SID_TRANSLITERATE_FULLWIDTH:
1508 0 : nType = TransliterationModules_HALFWIDTH_FULLWIDTH;
1509 0 : break;
1510 : case SID_TRANSLITERATE_HIRAGANA:
1511 0 : nType = TransliterationModules_KATAKANA_HIRAGANA;
1512 0 : break;
1513 : case SID_TRANSLITERATE_KATAGANA:
1514 0 : nType = TransliterationModules_HIRAGANA_KATAKANA;
1515 0 : break;
1516 : }
1517 :
1518 0 : pOLV->TransliterateText( nType );
1519 : }
1520 :
1521 0 : rReq.Done();
1522 : }
1523 0 : break;
1524 :
1525 : // #UndoRedo#
1526 : case SID_UNDO :
1527 : {
1528 : // moved implementation to BaseClass
1529 6 : ImpSidUndo(true, rReq);
1530 : }
1531 6 : break;
1532 : case SID_REDO :
1533 : {
1534 : // moved implementation to BaseClass
1535 2 : ImpSidRedo(true, rReq);
1536 : }
1537 2 : break;
1538 :
1539 : default:
1540 0 : break;
1541 : }
1542 : }
1543 :
1544 0 : void DrawViewShell::FuSupportRotate(SfxRequest &rReq)
1545 : {
1546 0 : if( rReq.GetSlot() == SID_TRANSLITERATE_ROTATE_CASE )
1547 : {
1548 0 : ::sd::View* pView = GetView();
1549 :
1550 0 : if (!pView)
1551 0 : return;
1552 :
1553 0 : OutlinerView* pOLV = pView->GetTextEditOutlinerView();
1554 :
1555 0 : if (!pOLV)
1556 0 : return;
1557 :
1558 0 : pOLV->TransliterateText( m_aRotateCase.getNextMode() );
1559 : }
1560 : }
1561 :
1562 0 : void DrawViewShell::InsertURLField(const OUString& rURL, const OUString& rText,
1563 : const OUString& rTarget, const Point* pPos)
1564 : {
1565 0 : OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
1566 :
1567 0 : if (pOLV)
1568 : {
1569 0 : ESelection aSel( pOLV->GetSelection() );
1570 0 : SvxFieldItem aURLItem( SvxURLField( rURL, rText, SVXURLFORMAT_REPR ), EE_FEATURE_FIELD );
1571 0 : pOLV->InsertField( aURLItem );
1572 0 : if ( aSel.nStartPos <= aSel.nEndPos )
1573 0 : aSel.nEndPos = aSel.nStartPos + 1;
1574 : else
1575 0 : aSel.nStartPos = aSel.nEndPos + 1;
1576 0 : pOLV->SetSelection( aSel );
1577 : }
1578 : else
1579 : {
1580 0 : Outliner* pOutl = GetDoc()->GetInternalOutliner();
1581 0 : pOutl->Init( OUTLINERMODE_TEXTOBJECT );
1582 0 : sal_uInt16 nOutlMode = pOutl->GetMode();
1583 :
1584 0 : SvxURLField aURLField(rURL, rText, SVXURLFORMAT_REPR);
1585 0 : aURLField.SetTargetFrame(rTarget);
1586 0 : SvxFieldItem aURLItem(aURLField, EE_FEATURE_FIELD);
1587 0 : pOutl->QuickInsertField( aURLItem, ESelection() );
1588 0 : OutlinerParaObject* pOutlParaObject = pOutl->CreateParaObject();
1589 :
1590 0 : SdrRectObj* pRectObj = new SdrRectObj(OBJ_TEXT);
1591 :
1592 0 : pOutl->UpdateFields();
1593 0 : pOutl->SetUpdateMode( true );
1594 0 : Size aSize(pOutl->CalcTextSize());
1595 0 : pOutl->SetUpdateMode( false );
1596 :
1597 0 : Point aPos;
1598 :
1599 0 : if (pPos)
1600 : {
1601 0 : aPos = *pPos;
1602 : }
1603 : else
1604 : {
1605 0 : Rectangle aRect(aPos, GetActiveWindow()->GetOutputSizePixel() );
1606 0 : aPos = aRect.Center();
1607 0 : aPos = GetActiveWindow()->PixelToLogic(aPos);
1608 0 : aPos.X() -= aSize.Width() / 2;
1609 0 : aPos.Y() -= aSize.Height() / 2;
1610 : }
1611 :
1612 0 : Rectangle aLogicRect(aPos, aSize);
1613 0 : pRectObj->SetLogicRect(aLogicRect);
1614 0 : pRectObj->SetOutlinerParaObject( pOutlParaObject );
1615 0 : mpDrawView->InsertObjectAtView(pRectObj, *mpDrawView->GetSdrPageView());
1616 0 : pOutl->Init( nOutlMode );
1617 : }
1618 0 : }
1619 :
1620 0 : void DrawViewShell::InsertURLButton(const OUString& rURL, const OUString& rText,
1621 : const OUString& rTarget, const Point* pPos)
1622 : {
1623 0 : bool bNewObj = true;
1624 :
1625 0 : const OUString sTargetURL( ::URIHelper::SmartRel2Abs( INetURLObject( GetDocSh()->GetMedium()->GetBaseURL() ), rURL, URIHelper::GetMaybeFileHdl(), true, false,
1626 : INetURLObject::WAS_ENCODED,
1627 0 : INetURLObject::DECODE_UNAMBIGUOUS ) );
1628 0 : if (mpDrawView->GetMarkedObjectList().GetMarkCount() > 0)
1629 : {
1630 0 : SdrObject* pMarkedObj = mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
1631 0 : if( pMarkedObj ) try
1632 : {
1633 : // change first marked object
1634 0 : if( (FmFormInventor == pMarkedObj->GetObjInventor() && pMarkedObj->GetObjIdentifier() == OBJ_FM_BUTTON) )
1635 : {
1636 0 : bNewObj = false;
1637 :
1638 0 : SdrUnoObj* pUnoCtrl = static_cast< SdrUnoObj* >( pMarkedObj );
1639 :
1640 0 : Reference< awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel(), UNO_QUERY_THROW );
1641 0 : Reference< beans::XPropertySet > xPropSet( xControlModel, UNO_QUERY_THROW );
1642 :
1643 0 : xPropSet->setPropertyValue("Label" , Any( rText ) );
1644 0 : xPropSet->setPropertyValue("TargetURL" , Any( sTargetURL ) );
1645 :
1646 0 : if( !rTarget.isEmpty() )
1647 0 : xPropSet->setPropertyValue("TargetFrame" , Any( rTarget ) );
1648 :
1649 0 : xPropSet->setPropertyValue( "ButtonType" , Any( form::FormButtonType_URL ) );
1650 0 : if ( ::avmedia::MediaWindow::isMediaURL( rURL, ""/*TODO?*/ ) )
1651 : {
1652 0 : xPropSet->setPropertyValue( "DispatchURLInternal" , Any( sal_True ) );
1653 0 : }
1654 : }
1655 : else
1656 : {
1657 : // add url as interaction for first selected shape
1658 0 : bNewObj = false;
1659 :
1660 0 : SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pMarkedObj, true);
1661 0 : pInfo->meClickAction = presentation::ClickAction_DOCUMENT;
1662 0 : pInfo->SetBookmark( sTargetURL );
1663 : }
1664 : }
1665 0 : catch( uno::Exception& )
1666 : {
1667 : }
1668 : }
1669 :
1670 0 : if (bNewObj) try
1671 : {
1672 : SdrUnoObj* pUnoCtrl = static_cast< SdrUnoObj* >( SdrObjFactory::MakeNewObject(FmFormInventor, OBJ_FM_BUTTON,
1673 0 : mpDrawView->GetSdrPageView()->GetPage(), GetDoc()) );
1674 :
1675 0 : Reference< awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel(), uno::UNO_QUERY_THROW );
1676 0 : Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY_THROW );
1677 :
1678 0 : xPropSet->setPropertyValue( "Label" , Any( OUString( rText ) ) );
1679 0 : xPropSet->setPropertyValue( "TargetURL" , Any( sTargetURL ) );
1680 :
1681 0 : if( !rTarget.isEmpty() )
1682 0 : xPropSet->setPropertyValue( "TargetFrame" , Any( rTarget ) );
1683 :
1684 0 : xPropSet->setPropertyValue( "ButtonType" , Any( form::FormButtonType_URL ) );
1685 0 : if ( ::avmedia::MediaWindow::isMediaURL( rURL, ""/*TODO?*/ ) )
1686 0 : xPropSet->setPropertyValue( "DispatchURLInternal" , Any( sal_True ) );
1687 :
1688 0 : Point aPos;
1689 :
1690 0 : if (pPos)
1691 : {
1692 0 : aPos = *pPos;
1693 : }
1694 : else
1695 : {
1696 0 : aPos = Rectangle(aPos, GetActiveWindow()->GetOutputSizePixel()).Center();
1697 0 : aPos = GetActiveWindow()->PixelToLogic(aPos);
1698 : }
1699 :
1700 0 : Size aSize(4000, 1000);
1701 0 : aPos.X() -= aSize.Width() / 2;
1702 0 : aPos.Y() -= aSize.Height() / 2;
1703 0 : pUnoCtrl->SetLogicRect(Rectangle(aPos, aSize));
1704 :
1705 0 : SdrInsertFlags nOptions = SdrInsertFlags::SETDEFLAYER;
1706 :
1707 : OSL_ASSERT (GetViewShell()!=NULL);
1708 0 : SfxInPlaceClient* pIpClient = GetViewShell()->GetIPClient();
1709 0 : if (pIpClient!=NULL && pIpClient->IsObjectInPlaceActive())
1710 : {
1711 0 : nOptions |= SdrInsertFlags::DONTMARK;
1712 : }
1713 :
1714 0 : mpDrawView->InsertObjectAtView(pUnoCtrl, *mpDrawView->GetSdrPageView(), nOptions);
1715 : }
1716 0 : catch( Exception& )
1717 : {
1718 0 : }
1719 0 : }
1720 :
1721 0 : void DrawViewShell::ShowUIControls (bool bVisible)
1722 : {
1723 0 : ViewShell::ShowUIControls (bVisible);
1724 0 : maTabControl->Show (bVisible);
1725 0 : }
1726 :
1727 : namespace slideshowhelp
1728 : {
1729 0 : void ShowSlideShow(SfxRequest& rReq, SdDrawDocument &rDoc)
1730 : {
1731 0 : Reference< XPresentation2 > xPresentation( rDoc.getPresentation() );
1732 0 : if( xPresentation.is() )
1733 : {
1734 0 : if (SID_REHEARSE_TIMINGS == rReq.GetSlot())
1735 0 : xPresentation->rehearseTimings();
1736 0 : else if (rDoc.getPresentationSettings().mbCustomShow)
1737 : {
1738 : //fdo#69975 if a custom show has been set, then
1739 : //use it whether or not we've been asked to
1740 : //start from the current or first slide
1741 0 : xPresentation->start();
1742 : }
1743 0 : else if (SID_PRESENTATION_CURRENT_SLIDE == rReq.GetSlot())
1744 : {
1745 : //If there is no custom show set, start will automatically
1746 : //start at the current page
1747 0 : xPresentation->start();
1748 : }
1749 : else
1750 : {
1751 : //Start at page 0, this would blow away any custom
1752 : //show settings if any were set
1753 0 : Sequence< PropertyValue > aArguments(1);
1754 0 : PropertyValue aPage;
1755 0 : OUString sValue("0");
1756 :
1757 0 : aPage.Name = "FirstPage";
1758 0 : aPage.Value <<= sValue;
1759 :
1760 0 : aArguments[0] = aPage;
1761 :
1762 0 : xPresentation->startWithArguments( aArguments );
1763 : }
1764 0 : }
1765 0 : }
1766 : }
1767 :
1768 0 : void DrawViewShell::ShowSlideShow(SfxRequest& rReq)
1769 : {
1770 0 : slideshowhelp::ShowSlideShow(rReq, *GetDoc());
1771 0 : }
1772 :
1773 0 : void DrawViewShell::StopSlideShow (bool /*bCloseFrame*/)
1774 : {
1775 0 : Reference< XPresentation2 > xPresentation( GetDoc()->getPresentation() );
1776 0 : if(xPresentation.is() && xPresentation->isRunning())
1777 : {
1778 0 : if( mpDrawView->IsTextEdit() )
1779 0 : mpDrawView->SdrEndTextEdit();
1780 :
1781 0 : xPresentation->end();
1782 0 : }
1783 0 : }
1784 :
1785 66 : } // end of namespace sd
1786 :
1787 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|