Update ooo320-m1
[ooovba.git] / sd / source / ui / view / drviewse.cxx
blobd580c442383e663de3164fa36d045914d183d463
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: drviewse.cxx,v $
10 * $Revision: 1.77 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
34 #include <com/sun/star/presentation/XPresentation2.hpp>
35 #include <com/sun/star/form/FormButtonType.hpp>
36 #include <com/sun/star/beans/XPropertySet.hpp>
37 #include <com/sun/star/i18n/TransliterationModules.hdl>
39 #include <comphelper/processfactory.hxx>
41 #include "undo/undomanager.hxx"
42 #include <vcl/waitobj.hxx>
43 #include <svtools/aeitem.hxx>
44 #include <svx/editstat.hxx>
45 #include <vcl/msgbox.hxx>
46 #include <svtools/urlbmk.hxx>
47 #include <svx/svdpagv.hxx>
48 #include <svx/fmshell.hxx>
49 #include <vcl/scrbar.hxx>
50 #include <svx/svdopath.hxx>
51 #include <svx/svdundo.hxx>
52 #include <svx/svdorect.hxx>
53 #include <svx/svdograf.hxx>
54 #include <svtools/eitem.hxx>
55 #include <svx/eeitem.hxx>
56 #include <sfx2/dispatch.hxx>
57 #include <sfx2/viewfrm.hxx>
58 #include <sfx2/request.hxx>
59 #include <svx/svxids.hrc>
60 #include <svx/flditem.hxx>
61 #include <svx/ruler.hxx>
62 #include <svx/obj3d.hxx>
63 #include <svx/fmglob.hxx>
64 #include <svx/svdouno.hxx>
65 #include <svx/dataaccessdescriptor.hxx>
66 #include <tools/urlobj.hxx>
67 #include <svtools/slstitm.hxx>
68 #include <sfx2/ipclient.hxx>
69 #include <toolkit/helper/vclunohelper.hxx>
70 #include <avmedia/mediawindow.hxx>
71 #include <svtools/urihelper.hxx>
72 #include <sfx2/topfrm.hxx>
73 #include <sfx2/docfile.hxx>
75 #include "DrawViewShell.hxx"
76 #include "slideshow.hxx"
77 #include "ViewShellImplementation.hxx"
78 #include "ViewShellHint.hxx"
79 #include "framework/FrameworkHelper.hxx"
80 #include "app.hrc"
81 #include "glob.hrc"
82 #include "strings.hrc"
83 #include "res_bmp.hrc"
84 #include "drawdoc.hxx"
85 #include "fusel.hxx"
86 #include "futext.hxx"
87 #include "fuconrec.hxx"
88 #include "fuconcs.hxx"
89 #include "fuconuno.hxx"
90 #include "fuconbez.hxx"
91 #include "fuediglu.hxx"
92 #include "fuconarc.hxx"
93 #include "fucon3d.hxx"
94 #include "sdresid.hxx"
95 #include "slideshow.hxx"
96 #include "Outliner.hxx"
97 #include "PresentationViewShell.hxx"
98 #include "sdpage.hxx"
99 #include "FrameView.hxx"
100 #include "zoomlist.hxx"
101 #include "drawview.hxx"
102 #include "DrawDocShell.hxx"
103 #include "sdattr.hxx"
104 #include "ViewShellBase.hxx"
105 #include "ToolBarManager.hxx"
106 #include "anminfo.hxx"
107 #include "optsitem.hxx"
108 #include "Window.hxx"
111 using ::rtl::OUString;
112 using namespace ::com::sun::star;
113 using namespace ::com::sun::star::uno;
114 using namespace ::com::sun::star::presentation;
116 namespace sd {
118 #ifdef _MSC_VER
119 #pragma optimize ( "", off )
120 #endif
122 /*************************************************************************
124 |* Permanente Funktionen
126 \************************************************************************/
128 void ImpAddPrintableCharactersToTextEdit(SfxRequest& rReq, ::sd::View* pView)
130 // #98198# evtl. feed characters to activated textedit
131 const SfxItemSet* pSet = rReq.GetArgs();
133 if(pSet)
135 String aInputString;
137 if(SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_CHAR))
138 aInputString = ((SfxStringItem&)pSet->Get(SID_ATTR_CHAR)).GetValue();
140 if(aInputString.Len())
142 OutlinerView* pOLV = pView->GetTextEditOutlinerView();
144 if(pOLV)
146 for(sal_uInt16 a(0); a < aInputString.Len(); a++)
148 sal_Char aChar = (sal_Char)aInputString.GetChar(a);
149 KeyCode aKeyCode;
150 KeyEvent aKeyEvent(aChar, aKeyCode);
152 // add actual character
153 pOLV->PostKeyEvent(aKeyEvent);
160 void DrawViewShell::FuPermanent(SfxRequest& rReq)
162 // Waehrend einer Native-Diashow wird nichts ausgefuehrt!
164 if (SlideShow::IsRunning(GetViewShellBase()))
165 return;
167 USHORT nSId = rReq.GetSlot();
169 if( HasCurrentFunction() &&
170 ( nSId == SID_TEXTEDIT || nSId == SID_ATTR_CHAR || nSId == SID_TEXT_FITTOSIZE ||
171 nSId == SID_ATTR_CHAR_VERTICAL || nSId == SID_TEXT_FITTOSIZE_VERTICAL ) )
173 FunctionReference xFunc( GetCurrentFunction() );
175 FuText* pFuText = dynamic_cast< FuText* >( xFunc.get() );
177 if( pFuText )
179 pFuText->SetPermanent(TRUE);
180 xFunc->ReceiveRequest( rReq );
182 MapSlot( nSId );
184 Invalidate();
186 Invalidate();
188 // #98198# evtl. feed characters to activated textedit
189 if(SID_ATTR_CHAR == nSId && GetView() && GetView()->IsTextEdit())
190 ImpAddPrintableCharactersToTextEdit(rReq, GetView());
192 rReq.Done();
193 return;
197 CheckLineTo (rReq);
198 USHORT nOldSId = 0;
199 BOOL bPermanent = FALSE;
201 if( !mpDrawView )
202 return;
204 if(HasCurrentFunction())
206 if(GetOldFunction() == GetCurrentFunction())
208 SetOldFunction(0);
211 if ( nSId != SID_TEXTEDIT && nSId != SID_ATTR_CHAR && nSId != SID_TEXT_FITTOSIZE &&
212 nSId != SID_ATTR_CHAR_VERTICAL && nSId != SID_TEXT_FITTOSIZE_VERTICAL &&
213 mpDrawView->IsTextEdit() )
215 mpDrawView->SdrEndTextEdit();
218 if( HasCurrentFunction() )
220 nOldSId = GetCurrentFunction()->GetSlotID();
222 if (nOldSId == nSId ||
223 ((nOldSId == SID_TEXTEDIT || nOldSId == SID_ATTR_CHAR || nOldSId == SID_TEXT_FITTOSIZE ||
224 nOldSId == SID_ATTR_CHAR_VERTICAL || nOldSId == SID_TEXT_FITTOSIZE_VERTICAL) &&
225 (nSId == SID_TEXTEDIT || nSId == SID_ATTR_CHAR || nSId == SID_TEXT_FITTOSIZE ||
226 nSId == SID_ATTR_CHAR_VERTICAL || nSId == SID_TEXT_FITTOSIZE_VERTICAL )))
228 bPermanent = TRUE;
231 GetCurrentFunction()->Deactivate();
234 SetCurrentFunction(0);
236 SfxBindings& rBind = GetViewFrame()->GetBindings();
237 rBind.Invalidate(nOldSId);
238 rBind.Update(nOldSId);
241 // Slot wird gemapped (ToolboxImages/-Slots)
242 MapSlot( nSId );
244 switch ( nSId )
246 case SID_TEXTEDIT: // BASIC ???
247 case SID_ATTR_CHAR:
248 case SID_ATTR_CHAR_VERTICAL:
249 case SID_TEXT_FITTOSIZE:
250 case SID_TEXT_FITTOSIZE_VERTICAL:
252 SetCurrentFunction( FuText::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
253 GetCurrentFunction()->DoExecute(rReq);
255 SfxBindings& rBindings = GetViewFrame()->GetBindings();
256 rBindings.Invalidate( SID_ATTR_CHAR );
257 rBindings.Invalidate( SID_ATTR_CHAR_VERTICAL );
258 rBindings.Invalidate( SID_TEXT_FITTOSIZE );
259 rBindings.Invalidate( SID_TEXT_FITTOSIZE_VERTICAL );
261 // #98198# evtl. feed characters to activated textedit
262 if(SID_ATTR_CHAR == nSId && GetView() && GetView()->IsTextEdit())
263 ImpAddPrintableCharactersToTextEdit(rReq, GetView());
265 rReq.Done();
267 break;
269 case SID_FM_CREATE_CONTROL:
271 SetCurrentFunction( FuConstructUnoControl::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq, bPermanent ) );
272 rReq.Done();
274 break;
276 // #98721#
277 case SID_FM_CREATE_FIELDCONTROL:
279 SFX_REQUEST_ARG( rReq, pDescriptorItem, SfxUnoAnyItem, SID_FM_DATACCESS_DESCRIPTOR, sal_False );
280 DBG_ASSERT( pDescriptorItem, "DrawViewShell::FuPermanent(SID_FM_CREATE_FIELDCONTROL): invalid request args!" );
282 if(pDescriptorItem)
284 // get the form view
285 FmFormView* pFormView = PTR_CAST(FmFormView, mpDrawView);
286 SdrPageView* pPageView = pFormView ? pFormView->GetSdrPageView() : NULL;
288 if(pPageView)
290 ::svx::ODataAccessDescriptor aDescriptor(pDescriptorItem->GetValue());
291 SdrObject* pNewDBField = pFormView->CreateFieldControl(aDescriptor);
293 if(pNewDBField)
295 Rectangle aVisArea = GetActiveWindow()->PixelToLogic(Rectangle(Point(0,0), GetActiveWindow()->GetOutputSizePixel()));
296 Point aObjPos(aVisArea.Center());
297 Size aObjSize(pNewDBField->GetLogicRect().GetSize());
298 aObjPos.X() -= aObjSize.Width() / 2;
299 aObjPos.Y() -= aObjSize.Height() / 2;
300 Rectangle aNewObjectRectangle(aObjPos, aObjSize);
302 pNewDBField->SetLogicRect(aNewObjectRectangle);
304 GetView()->InsertObjectAtView(pNewDBField, *pPageView);
308 rReq.Done();
310 break;
312 case SID_OBJECT_SELECT:
313 case SID_OBJECT_ROTATE:
314 case SID_OBJECT_MIRROR:
315 case SID_OBJECT_CROP:
316 case SID_OBJECT_TRANSPARENCE:
317 case SID_OBJECT_GRADIENT:
318 case SID_OBJECT_SHEAR:
319 case SID_OBJECT_CROOK_ROTATE:
320 case SID_OBJECT_CROOK_SLANT:
321 case SID_OBJECT_CROOK_STRETCH:
322 case SID_CONVERT_TO_3D_LATHE:
324 short nSlotId = rReq.GetSlot();
326 if (nSlotId == SID_OBJECT_CROOK_ROTATE ||
327 nSlotId == SID_OBJECT_CROOK_SLANT ||
328 nSlotId == SID_OBJECT_CROOK_STRETCH)
330 if ( mpDrawView->GetMarkedObjectList().GetMarkCount() > 0 &&
331 !mpDrawView->IsCrookAllowed( mpDrawView->IsCrookNoContortion() ) )
333 if ( mpDrawView->IsPresObjSelected() )
335 ::sd::Window* pWindow = GetActiveWindow();
336 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
338 else if ( QueryBox(GetActiveWindow(), WB_YES_NO,
339 String(SdResId(STR_ASK_FOR_CONVERT_TO_BEZIER) )
340 ).Execute() == RET_YES )
342 // Implizite Wandlung in Bezier
343 WaitObject aWait( (Window*)GetActiveWindow() );
344 mpDrawView->ConvertMarkedToPathObj(FALSE);
348 else if (nSlotId == SID_OBJECT_SHEAR)
350 ULONG i = 0;
351 const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
352 ULONG nMarkCnt = rMarkList.GetMarkCount();
353 BOOL b3DObjMarked = FALSE;
355 while (i < nMarkCnt && !b3DObjMarked)
357 if (rMarkList.GetMark(i)->GetMarkedSdrObj()->ISA(E3dObject))
359 b3DObjMarked = TRUE;
361 else
363 i++;
367 if ( nMarkCnt > 0 && !b3DObjMarked &&
368 (!mpDrawView->IsShearAllowed() || !mpDrawView->IsDistortAllowed()) )
370 if ( mpDrawView->IsPresObjSelected() )
372 ::sd::Window* pWindow = GetActiveWindow();
373 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
375 else if ( QueryBox(GetActiveWindow(), WB_YES_NO,
376 String(SdResId(STR_ASK_FOR_CONVERT_TO_BEZIER) )
377 ).Execute() == RET_YES )
379 // Implizite Wandlung in Bezier
380 WaitObject aWait( (Window*)GetActiveWindow() );
381 mpDrawView->ConvertMarkedToPathObj(FALSE);
386 SetCurrentFunction( FuSelection::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
387 rReq.Done();
388 Invalidate( SID_OBJECT_SELECT );
390 break;
392 case SID_DRAW_LINE:
393 case SID_DRAW_XLINE:
394 case SID_DRAW_MEASURELINE:
395 case SID_LINE_ARROW_START:
396 case SID_LINE_ARROW_END:
397 case SID_LINE_ARROWS:
398 case SID_LINE_ARROW_CIRCLE:
399 case SID_LINE_CIRCLE_ARROW:
400 case SID_LINE_ARROW_SQUARE:
401 case SID_LINE_SQUARE_ARROW:
403 case SID_DRAW_RECT:
404 case SID_DRAW_RECT_NOFILL:
405 case SID_DRAW_RECT_ROUND:
406 case SID_DRAW_RECT_ROUND_NOFILL:
407 case SID_DRAW_SQUARE:
408 case SID_DRAW_SQUARE_NOFILL:
409 case SID_DRAW_SQUARE_ROUND:
410 case SID_DRAW_SQUARE_ROUND_NOFILL:
411 case SID_DRAW_ELLIPSE:
412 case SID_DRAW_ELLIPSE_NOFILL:
413 case SID_DRAW_CIRCLE:
414 case SID_DRAW_CIRCLE_NOFILL:
415 case SID_DRAW_CAPTION:
416 case SID_DRAW_CAPTION_VERTICAL:
417 case SID_TOOL_CONNECTOR:
418 case SID_CONNECTOR_ARROW_START:
419 case SID_CONNECTOR_ARROW_END:
420 case SID_CONNECTOR_ARROWS:
421 case SID_CONNECTOR_CIRCLE_START:
422 case SID_CONNECTOR_CIRCLE_END:
423 case SID_CONNECTOR_CIRCLES:
424 case SID_CONNECTOR_LINE:
425 case SID_CONNECTOR_LINE_ARROW_START:
426 case SID_CONNECTOR_LINE_ARROW_END:
427 case SID_CONNECTOR_LINE_ARROWS:
428 case SID_CONNECTOR_LINE_CIRCLE_START:
429 case SID_CONNECTOR_LINE_CIRCLE_END:
430 case SID_CONNECTOR_LINE_CIRCLES:
431 case SID_CONNECTOR_CURVE:
432 case SID_CONNECTOR_CURVE_ARROW_START:
433 case SID_CONNECTOR_CURVE_ARROW_END:
434 case SID_CONNECTOR_CURVE_ARROWS:
435 case SID_CONNECTOR_CURVE_CIRCLE_START:
436 case SID_CONNECTOR_CURVE_CIRCLE_END:
437 case SID_CONNECTOR_CURVE_CIRCLES:
438 case SID_CONNECTOR_LINES:
439 case SID_CONNECTOR_LINES_ARROW_START:
440 case SID_CONNECTOR_LINES_ARROW_END:
441 case SID_CONNECTOR_LINES_ARROWS:
442 case SID_CONNECTOR_LINES_CIRCLE_START:
443 case SID_CONNECTOR_LINES_CIRCLE_END:
444 case SID_CONNECTOR_LINES_CIRCLES:
446 SetCurrentFunction( FuConstructRectangle::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq, bPermanent ) );
447 rReq.Done();
449 break;
450 case SID_DRAW_POLYGON:
451 case SID_DRAW_POLYGON_NOFILL:
452 case SID_DRAW_XPOLYGON:
453 case SID_DRAW_XPOLYGON_NOFILL:
454 case SID_DRAW_FREELINE:
455 case SID_DRAW_FREELINE_NOFILL:
456 case SID_DRAW_BEZIER_FILL: // BASIC
457 case SID_DRAW_BEZIER_NOFILL: // BASIC
459 SetCurrentFunction( FuConstructBezierPolygon::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq, bPermanent) );
460 rReq.Done();
462 break;
464 case SID_GLUE_EDITMODE:
466 if (nOldSId != SID_GLUE_EDITMODE)
468 SetCurrentFunction( FuEditGluePoints::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq, bPermanent ) );
470 else
472 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
475 rReq.Done();
477 break;
479 case SID_DRAW_ARC:
480 case SID_DRAW_CIRCLEARC:
481 case SID_DRAW_PIE:
482 case SID_DRAW_PIE_NOFILL:
483 case SID_DRAW_CIRCLEPIE:
484 case SID_DRAW_CIRCLEPIE_NOFILL:
485 case SID_DRAW_ELLIPSECUT:
486 case SID_DRAW_ELLIPSECUT_NOFILL:
487 case SID_DRAW_CIRCLECUT:
488 case SID_DRAW_CIRCLECUT_NOFILL:
490 SetCurrentFunction( FuConstructArc::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq, bPermanent) );
491 rReq.Done();
493 break;
495 case SID_3D_CUBE:
496 case SID_3D_SHELL:
497 case SID_3D_SPHERE:
498 case SID_3D_TORUS:
499 case SID_3D_HALF_SPHERE:
500 case SID_3D_CYLINDER:
501 case SID_3D_CONE:
502 case SID_3D_PYRAMID:
504 SetCurrentFunction( FuConstruct3dObject::Create(this, GetActiveWindow(), mpDrawView, GetDoc(), rReq, bPermanent ) );
505 rReq.Done();
507 break;
509 case SID_DRAWTBX_CS_BASIC :
510 case SID_DRAWTBX_CS_SYMBOL :
511 case SID_DRAWTBX_CS_ARROW :
512 case SID_DRAWTBX_CS_FLOWCHART :
513 case SID_DRAWTBX_CS_CALLOUT :
514 case SID_DRAWTBX_CS_STAR :
515 case SID_DRAW_CS_ID :
517 SetCurrentFunction( FuConstructCustomShape::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq, bPermanent ) );
518 rReq.Done();
520 if ( nSId != SID_DRAW_CS_ID )
522 SfxBindings& rBind = GetViewFrame()->GetBindings();
523 rBind.Invalidate( nSId );
524 rBind.Update( nSId );
527 break;
529 default:
530 break;
533 if(HasOldFunction())
535 USHORT nSlotId = GetOldFunction()->GetSlotID();
537 GetOldFunction()->Deactivate();
538 SetOldFunction(0);
540 SfxBindings& rBind = GetViewFrame()->GetBindings();
541 rBind.Invalidate( nSlotId );
542 rBind.Update( nSlotId );
545 if(HasCurrentFunction())
547 GetCurrentFunction()->Activate();
548 SetOldFunction( GetCurrentFunction() );
550 SetHelpId( GetCurrentFunction()->GetSlotID() );
553 // Shell wird invalidiert, schneller als einzeln (laut MI)
554 // Jetzt explizit der letzte Slot incl. Update()
555 Invalidate();
557 // #97016# III CTRL-SID_OBJECT_SELECT -> select first draw object if none is selected yet
558 if(SID_OBJECT_SELECT == nSId && HasCurrentFunction() && (rReq.GetModifier() & KEY_MOD1))
560 if(!GetView()->AreObjectsMarked())
562 // select first object
563 GetView()->UnmarkAllObj();
564 GetView()->MarkNextObj(TRUE);
566 // ...and make it visible
567 if(GetView()->AreObjectsMarked())
568 GetView()->MakeVisible(GetView()->GetAllMarkedRect(), *GetActiveWindow());
572 // #97016# with qualifier construct directly
573 if(HasCurrentFunction() && (rReq.GetModifier() & KEY_MOD1))
575 // get SdOptions
576 SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType());
577 sal_uInt32 nDefaultObjectSizeWidth(pOptions->GetDefaultObjectSizeWidth());
578 sal_uInt32 nDefaultObjectSizeHeight(pOptions->GetDefaultObjectSizeHeight());
580 // calc position and size
581 Rectangle aVisArea = GetActiveWindow()->PixelToLogic(Rectangle(Point(0,0), GetActiveWindow()->GetOutputSizePixel()));
582 Point aPagePos = aVisArea.Center();
583 aPagePos.X() -= nDefaultObjectSizeWidth / 2;
584 aPagePos.Y() -= nDefaultObjectSizeHeight / 2;
585 Rectangle aNewObjectRectangle(aPagePos, Size(nDefaultObjectSizeWidth, nDefaultObjectSizeHeight));
586 SdrPageView* pPageView = mpDrawView->GetSdrPageView();
588 if(pPageView)
590 // create the default object
591 SdrObject* pObj = GetCurrentFunction()->CreateDefaultObject(nSId, aNewObjectRectangle);
593 if(pObj)
595 // insert into page
596 GetView()->InsertObjectAtView(pObj, *pPageView);
598 // Now that pFuActual has done what it was created for we
599 // can switch on the edit mode for callout objects.
600 switch (nSId)
602 case SID_DRAW_CAPTION:
603 case SID_DRAW_CAPTION_VERTICAL:
605 // Make FuText the current function.
606 SfxUInt16Item aItem (SID_TEXTEDIT, 1);
607 GetViewFrame()->GetDispatcher()->
608 Execute(SID_TEXTEDIT, SFX_CALLMODE_SYNCHRON |
609 SFX_CALLMODE_RECORD, &aItem, 0L);
610 // Put text object into edit mode.
611 GetView()->SdrBeginTextEdit(static_cast<SdrTextObj*>(pObj), pPageView);
612 break;
620 //////////////////////////////////////////////////////////////////////////////
621 // service routine for Undo/Redo implementation
622 extern SfxUndoManager* ImpGetUndoManagerFromViewShell(DrawViewShell& rDViewShell);
624 /*************************************************************************
626 |* SfxRequests fuer Support-Funktionen
628 \************************************************************************/
630 void DrawViewShell::FuSupport(SfxRequest& rReq)
632 if( rReq.GetSlot() == SID_STYLE_FAMILY && rReq.GetArgs())
633 GetDocSh()->SetStyleFamily(((SfxUInt16Item&)rReq.GetArgs()->Get( SID_STYLE_FAMILY )).GetValue());
635 // Waehrend einer Native-Diashow wird nichts ausgefuehrt!
636 if(SlideShow::IsRunning(GetViewShellBase()) &&
637 (rReq.GetSlot() != SID_PRESENTATION_END &&
638 rReq.GetSlot() != SID_SIZE_PAGE))
639 return;
641 CheckLineTo (rReq);
643 if( !mpDrawView )
644 return;
646 USHORT nSId = rReq.GetSlot();
648 // Slot wird evtl. gemapped (ToolboxImages/-Slots)
649 MapSlot( nSId );
651 switch ( nSId )
653 case SID_CLEAR_UNDO_STACK:
655 GetDocSh()->ClearUndoBuffer();
656 rReq.Ignore ();
658 break;
660 // Slots der ToolboxController gemapped ausfuehren
661 case SID_OBJECT_CHOOSE_MODE:
662 case SID_POSITION:
663 case SID_OBJECT_ALIGN:
664 case SID_ZOOM_TOOLBOX:
665 case SID_DRAWTBX_TEXT:
666 case SID_DRAWTBX_RECTANGLES:
667 case SID_DRAWTBX_ELLIPSES:
668 case SID_DRAWTBX_LINES:
669 case SID_DRAWTBX_ARROWS:
670 case SID_DRAWTBX_3D_OBJECTS:
671 case SID_DRAWTBX_CONNECTORS:
672 case SID_DRAWTBX_INSERT:
674 USHORT nMappedSlot = GetMappedSlot( nSId );
675 if( nMappedSlot > 0 )
677 SfxRequest aReq( nMappedSlot, 0, GetDoc()->GetItemPool() );
678 ExecuteSlot( aReq );
681 break;
683 case SID_PRESENTATION:
684 case SID_REHEARSE_TIMINGS:
686 Reference< XPresentation2 > xPresentation( GetDoc()->getPresentation() );
687 if( xPresentation.is() )
689 if( ( SID_REHEARSE_TIMINGS != rReq.GetSlot() ) )
690 xPresentation->start();
691 else
692 xPresentation->rehearseTimings();
694 rReq.Ignore ();
696 break;
698 case SID_PRESENTATION_END:
700 StopSlideShow(true);
702 rReq.Ignore ();
704 break;
706 case SID_BEZIER_EDIT:
708 mpDrawView->SetFrameDragSingles(!mpDrawView->IsFrameDragSingles());
710 /******************************************************************
711 * ObjectBar einschalten
712 ******************************************************************/
713 if( dynamic_cast< FuSelection* >( GetCurrentFunction().get() ) || dynamic_cast< FuConstructBezierPolygon* >( GetCurrentFunction().get() ) )
715 // Tell the tool bar manager about the context change.
716 GetViewShellBase().GetToolBarManager()->SelectionHasChanged(*this,*mpDrawView);
719 Invalidate(SID_BEZIER_EDIT);
720 rReq.Ignore();
722 break;
724 case SID_OBJECT_CLOSE:
726 const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
727 if ( rMarkList.GetMark(0) && !mpDrawView->IsAction() )
729 SdrPathObj* pPathObj = (SdrPathObj*) rMarkList.GetMark(0)->GetMarkedSdrObj();
730 const bool bUndo = mpDrawView->IsUndoEnabled();
731 if( bUndo )
732 mpDrawView->BegUndo(String(SdResId(STR_UNDO_BEZCLOSE)));
734 mpDrawView->UnmarkAllPoints();
736 if( bUndo )
737 mpDrawView->AddUndo(new SdrUndoGeoObj(*pPathObj));
739 pPathObj->ToggleClosed();
741 if( bUndo )
742 mpDrawView->EndUndo();
744 rReq.Done();
746 break;
748 case SID_CUT:
750 if ( mpDrawView->IsPresObjSelected(FALSE, TRUE, FALSE, TRUE) )
752 ::sd::Window* pWindow = GetActiveWindow();
753 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
755 else
757 if(HasCurrentFunction())
759 GetCurrentFunction()->DoCut();
761 else if(mpDrawView)
763 mpDrawView->DoCut();
766 rReq.Ignore ();
768 break;
770 case SID_COPY:
772 if ( mpDrawView->IsPresObjSelected(FALSE, TRUE, FALSE, TRUE) )
774 ::sd::Window* pWindow = GetActiveWindow();
775 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
777 else
779 if(HasCurrentFunction())
781 GetCurrentFunction()->DoCopy();
783 else if( mpDrawView )
785 mpDrawView->DoCopy();
788 rReq.Ignore ();
790 break;
792 case SID_PASTE:
794 WaitObject aWait( (Window*)GetActiveWindow() );
796 if(HasCurrentFunction())
798 GetCurrentFunction()->DoPaste();
800 else if(mpDrawView)
802 mpDrawView->DoPaste();
805 rReq.Ignore ();
807 break;
809 case SID_CLIPBOARD_FORMAT_ITEMS:
811 WaitObject aWait( (Window*)GetActiveWindow() );
812 TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) );
813 const SfxItemSet* pReqArgs = rReq.GetArgs();
814 UINT32 nFormat = 0;
816 if( pReqArgs )
818 SFX_REQUEST_ARG( rReq, pIsActive, SfxUInt32Item, SID_CLIPBOARD_FORMAT_ITEMS, FALSE );
819 nFormat = pIsActive->GetValue();
823 if( nFormat && aDataHelper.GetTransferable().is() )
825 sal_Int8 nAction = DND_ACTION_COPY;
827 if( !mpDrawView->InsertData( aDataHelper,
828 GetActiveWindow()->PixelToLogic( Rectangle( Point(), GetActiveWindow()->GetOutputSizePixel() ).Center() ),
829 nAction, FALSE, nFormat ) )
831 INetBookmark aINetBookmark( aEmptyStr, aEmptyStr );
833 if( ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK ) &&
834 aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK, aINetBookmark ) ) ||
835 ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR ) &&
836 aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR, aINetBookmark ) ) ||
837 ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR ) &&
838 aDataHelper.GetINetBookmark( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR, aINetBookmark ) ) )
840 InsertURLField( aINetBookmark.GetURL(), aINetBookmark.GetDescription(), aEmptyStr, NULL );
845 break;
847 case SID_DELETE:
849 if ( mpDrawView->IsTextEdit() )
851 OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
853 if (pOLV)
855 KeyCode aKCode(KEY_DELETE);
856 KeyEvent aKEvt( 0, aKCode);
857 pOLV->PostKeyEvent(aKEvt);
860 else if ( mpDrawView->IsPresObjSelected(FALSE, TRUE, FALSE, TRUE) )
862 ::sd::Window* pWindow = GetActiveWindow();
863 InfoBox(pWindow, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
865 else
867 KeyCode aKCode(KEY_DELETE);
868 KeyEvent aKEvt( 0, aKCode);
870 bool bConsumed = mpDrawView && mpDrawView->getSmartTags().KeyInput( aKEvt );
872 if( !bConsumed && HasCurrentFunction() )
873 bConsumed = GetCurrentFunction()->KeyInput(aKEvt);
875 if( !bConsumed && mpDrawView )
876 mpDrawView->DeleteMarked();
878 rReq.Ignore ();
880 break;
882 case SID_NOTESMODE:
883 case SID_HANDOUTMODE:
884 // AutoLayouts have to be ready.
885 GetDoc()->StopWorkStartupDelay();
886 // Fall through to following case statements.
888 case SID_DRAWINGMODE:
889 case SID_DIAMODE:
890 case SID_OUTLINEMODE:
891 // Let the sub-shell manager handle the slot handling.
892 framework::FrameworkHelper::Instance(GetViewShellBase())->HandleModeChangeSlot(
893 nSId,
894 rReq);
895 rReq.Ignore ();
896 break;
898 case SID_MASTERPAGE: // BASIC
899 case SID_SLIDE_MASTERPAGE: // BASIC
900 case SID_TITLE_MASTERPAGE: // BASIC
901 case SID_NOTES_MASTERPAGE: // BASIC
902 case SID_HANDOUT_MASTERPAGE: // BASIC
904 // AutoLayouts muessen fertig sein
905 GetDoc()->StopWorkStartupDelay();
907 const SfxItemSet* pReqArgs = rReq.GetArgs();
909 if ( pReqArgs )
911 SFX_REQUEST_ARG (rReq, pIsActive, SfxBoolItem, SID_MASTERPAGE, FALSE);
912 mbIsLayerModeActive = pIsActive->GetValue ();
915 Broadcast (
916 ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_START));
918 if (nSId == SID_MASTERPAGE ||
919 (nSId == SID_SLIDE_MASTERPAGE && mePageKind == PK_STANDARD) ||
920 (nSId == SID_TITLE_MASTERPAGE && mePageKind == PK_STANDARD) ||
921 (nSId == SID_NOTES_MASTERPAGE && mePageKind == PK_NOTES) ||
922 (nSId == SID_HANDOUT_MASTERPAGE && mePageKind == PK_HANDOUT))
924 if (nSId == SID_TITLE_MASTERPAGE ||
925 nSId == SID_SLIDE_MASTERPAGE)
927 // Gibt es eine Seite mit dem AutoLayout "Titel"?
928 BOOL bFound = FALSE;
929 USHORT i = 0;
930 USHORT nCount = GetDoc()->GetSdPageCount(PK_STANDARD);
932 while (i < nCount && !bFound)
934 SdPage* pPage = GetDoc()->GetSdPage(i, PK_STANDARD);
936 if (nSId == SID_TITLE_MASTERPAGE && pPage->GetAutoLayout() == AUTOLAYOUT_TITLE)
938 bFound = TRUE;
939 SwitchPage((pPage->GetPageNum() - 1) / 2);
941 else if (nSId == SID_SLIDE_MASTERPAGE && pPage->GetAutoLayout() != AUTOLAYOUT_TITLE)
943 bFound = TRUE;
944 SwitchPage((pPage->GetPageNum() - 1) / 2);
947 i++;
951 // Default-Layer der MasterPage einschalten
952 mpDrawView->SetActiveLayer( String( SdResId(STR_LAYER_BCKGRNDOBJ) ) );
954 ChangeEditMode(EM_MASTERPAGE, mbIsLayerModeActive);
956 if(HasCurrentFunction(SID_BEZIER_EDIT))
957 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
959 else
961 // Switch to requested ViewShell.
962 ::OUString sRequestedView;
963 PageKind ePageKind;
964 switch (nSId)
966 case SID_SLIDE_MASTERPAGE:
967 case SID_TITLE_MASTERPAGE:
968 default:
969 sRequestedView = framework::FrameworkHelper::msImpressViewURL;
970 ePageKind = PK_STANDARD;
971 break;
973 case SID_NOTES_MASTERPAGE:
974 sRequestedView = framework::FrameworkHelper::msNotesViewURL;
975 ePageKind = PK_NOTES;
976 break;
978 case SID_HANDOUT_MASTERPAGE:
979 sRequestedView = framework::FrameworkHelper::msHandoutViewURL;
980 ePageKind = PK_HANDOUT;
981 break;
984 mpFrameView->SetViewShEditMode(EM_MASTERPAGE, ePageKind);
985 mpFrameView->SetLayerMode(mbIsLayerModeActive);
986 framework::FrameworkHelper::Instance(GetViewShellBase())->RequestView(
987 sRequestedView,
988 framework::FrameworkHelper::msCenterPaneURL);
990 Broadcast (
991 ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_END));
993 InvalidateWindows();
994 Invalidate();
996 rReq.Done();
998 break;
1001 case SID_CLOSE_MASTER_VIEW:
1003 Broadcast (
1004 ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_START));
1006 // Switch page back to the first one. Not doing so leads to a
1007 // crash. This seems to be some bug in the edit mode switching
1008 // and page switching methods.
1009 SwitchPage (0);
1010 ChangeEditMode(EM_PAGE, IsLayerModeActive());
1011 Broadcast (
1012 ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_END));
1014 if(HasCurrentFunction(SID_BEZIER_EDIT))
1016 GetViewFrame()->GetDispatcher()->Execute(
1017 SID_OBJECT_SELECT,
1018 SFX_CALLMODE_ASYNCHRON);
1022 rReq.Done();
1024 break;
1027 case SID_RULER:
1029 const SfxItemSet* pReqArgs = rReq.GetArgs();
1031 // #97516# Remember old ruler state
1032 BOOL bOldHasRuler(HasRuler());
1034 if ( pReqArgs )
1036 SFX_REQUEST_ARG (rReq, pIsActive, SfxBoolItem, SID_RULER, FALSE);
1037 SetRuler (pIsActive->GetValue ());
1039 else SetRuler (!HasRuler());
1041 // #97516# Did ruler state change? Tell that to SdOptions, too.
1042 BOOL bHasRuler(HasRuler());
1044 if(bOldHasRuler != bHasRuler)
1046 SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType());
1048 if(pOptions && pOptions->IsRulerVisible() != bHasRuler)
1050 pOptions->SetRulerVisible(bHasRuler);
1054 Invalidate (SID_RULER);
1055 Resize();
1056 rReq.Done ();
1058 break;
1060 case SID_SIZE_PAGE:
1061 case SID_SIZE_PAGE_WIDTH: // BASIC
1063 mbZoomOnPage = ( rReq.GetSlot() == SID_SIZE_PAGE );
1065 SdrPageView* pPageView = mpDrawView->GetSdrPageView();
1067 if ( pPageView )
1069 Point aPagePos(0, 0); // = pPageView->GetOffset();
1070 Size aPageSize = pPageView->GetPage()->GetSize();
1072 aPagePos.X() += aPageSize.Width() / 2;
1073 aPageSize.Width() = (long) (aPageSize.Width() * 1.03);
1075 if( rReq.GetSlot() == SID_SIZE_PAGE )
1077 aPagePos.Y() += aPageSize.Height() / 2;
1078 aPageSize.Height() = (long) (aPageSize.Height() * 1.03);
1079 aPagePos.Y() -= aPageSize.Height() / 2;
1081 else
1083 Point aPt = GetActiveWindow()->PixelToLogic( Point( 0, GetActiveWindow()->GetSizePixel().Height() / 2 ) );
1084 aPagePos.Y() += aPt.Y();
1085 aPageSize.Height() = 2;
1088 aPagePos.X() -= aPageSize.Width() / 2;
1090 SetZoomRect( Rectangle( aPagePos, aPageSize ) );
1092 Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
1093 GetActiveWindow()->GetOutputSizePixel()) );
1094 mpZoomList->InsertZoomRect(aVisAreaWin);
1096 Invalidate( SID_ZOOM_IN );
1097 Invalidate( SID_ZOOM_OUT );
1098 Invalidate( SID_ZOOM_PANNING );
1099 Invalidate( SID_ZOOM_TOOLBOX );
1100 rReq.Done ();
1102 break;
1104 case SID_SIZE_REAL: // BASIC
1106 mbZoomOnPage = FALSE;
1107 SetZoom( 100 );
1108 Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
1109 GetActiveWindow()->GetOutputSizePixel()) );
1110 mpZoomList->InsertZoomRect(aVisAreaWin);
1111 Invalidate( SID_ZOOM_IN );
1112 Invalidate( SID_ZOOM_OUT );
1113 Invalidate( SID_ZOOM_PANNING );
1114 Invalidate( SID_ZOOM_TOOLBOX );
1115 rReq.Done ();
1117 break;
1119 case SID_ZOOM_IN: // BASIC
1121 mbZoomOnPage = FALSE;
1122 SetZoom( Max( (long) ( GetActiveWindow()->GetZoom() / 2 ), (long) GetActiveWindow()->GetMinZoom() ) );
1123 Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
1124 GetActiveWindow()->GetOutputSizePixel()) );
1125 mpZoomList->InsertZoomRect(aVisAreaWin);
1126 Invalidate( SID_ZOOM_IN );
1127 Invalidate( SID_ZOOM_OUT );
1128 Invalidate( SID_ZOOM_PANNING );
1129 Invalidate( SID_ZOOM_TOOLBOX );
1130 rReq.Done ();
1132 break;
1134 case SID_SIZE_VISAREA:
1136 Rectangle aVisArea = mpFrameView->GetVisArea();
1137 Size aVisAreaSize = aVisArea.GetSize();
1139 if (aVisAreaSize.Height()!=0 && aVisAreaSize.Width()!=0)
1141 mbZoomOnPage = FALSE;
1142 SetZoomRect(aVisArea);
1143 Invalidate( SID_ZOOM_IN );
1144 Invalidate( SID_ZOOM_OUT );
1145 Invalidate( SID_ZOOM_PANNING );
1146 Invalidate( SID_ZOOM_TOOLBOX );
1148 rReq.Done ();
1150 break;
1152 // Namensverwirrung: SID_SIZE_OPTIMAL -> Zoom auf selektierte Objekte
1153 // --> Wird als Objektzoom im Programm angeboten
1154 case SID_SIZE_OPTIMAL: // BASIC
1156 mbZoomOnPage = FALSE;
1157 if ( mpDrawView->AreObjectsMarked() )
1159 maMarkRect = mpDrawView->GetAllMarkedRect();
1160 long nW = (long) (maMarkRect.GetWidth() * 1.03);
1161 long nH = (long) (maMarkRect.GetHeight() * 1.03);
1162 Point aPos = maMarkRect.Center();
1163 aPos.X() -= nW / 2;
1164 aPos.Y() -= nH / 2;
1165 if ( nW && nH )
1167 SetZoomRect(Rectangle(aPos, Size(nW, nH)));
1169 Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
1170 GetActiveWindow()->GetOutputSizePixel()) );
1171 mpZoomList->InsertZoomRect(aVisAreaWin);
1174 Invalidate( SID_ZOOM_IN );
1175 Invalidate( SID_ZOOM_OUT );
1176 Invalidate( SID_ZOOM_PANNING );
1177 Invalidate( SID_ZOOM_TOOLBOX );
1178 rReq.Done ();
1180 break;
1182 // Namensverwirrung: SID_SIZE_ALL -> Zoom auf alle Objekte
1183 // --> Wird als Optimal im Programm angeboten
1184 case SID_SIZE_ALL: // BASIC
1186 mbZoomOnPage = FALSE;
1187 SdrPageView* pPageView = mpDrawView->GetSdrPageView();
1189 if( pPageView )
1191 Rectangle aBoundRect( pPageView->GetObjList()->GetAllObjBoundRect() );
1193 long nW = (long) (aBoundRect.GetWidth() * 1.03);
1194 long nH = (long) (aBoundRect.GetHeight() * 1.03);
1195 Point aPos = aBoundRect.Center();
1196 aPos.X() -= nW / 2;
1197 aPos.Y() -= nH / 2;
1198 if ( nW && nH )
1200 SetZoomRect( Rectangle( aPos, Size( nW, nH ) ) );
1202 Rectangle aVisAreaWin = GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
1203 GetActiveWindow()->GetOutputSizePixel()) );
1204 mpZoomList->InsertZoomRect(aVisAreaWin);
1207 Invalidate( SID_ZOOM_IN );
1208 Invalidate( SID_ZOOM_OUT );
1209 Invalidate( SID_ZOOM_PANNING );
1210 Invalidate( SID_ZOOM_TOOLBOX );
1212 rReq.Done ();
1214 break;
1216 case SID_ZOOM_PREV:
1218 if (mpDrawView->IsTextEdit())
1220 mpDrawView->SdrEndTextEdit();
1223 if (mpZoomList->IsPreviousPossible())
1225 // Vorheriges ZoomRect einstellen
1226 SetZoomRect(mpZoomList->GetPreviousZoomRect());
1228 rReq.Done ();
1229 Invalidate( SID_ZOOM_TOOLBOX );
1231 break;
1233 case SID_ZOOM_NEXT:
1235 if (mpDrawView->IsTextEdit())
1237 mpDrawView->SdrEndTextEdit();
1240 if (mpZoomList->IsNextPossible())
1242 // Naechstes ZoomRect einstellen
1243 SetZoomRect(mpZoomList->GetNextZoomRect());
1245 rReq.Done ();
1246 Invalidate( SID_ZOOM_TOOLBOX );
1248 break;
1250 case SID_GLUE_INSERT_POINT:
1251 case SID_GLUE_PERCENT:
1252 case SID_GLUE_ESCDIR:
1253 case SID_GLUE_ESCDIR_LEFT:
1254 case SID_GLUE_ESCDIR_RIGHT:
1255 case SID_GLUE_ESCDIR_TOP:
1256 case SID_GLUE_ESCDIR_BOTTOM:
1257 case SID_GLUE_HORZALIGN_CENTER:
1258 case SID_GLUE_HORZALIGN_LEFT:
1259 case SID_GLUE_HORZALIGN_RIGHT:
1260 case SID_GLUE_VERTALIGN_CENTER:
1261 case SID_GLUE_VERTALIGN_TOP:
1262 case SID_GLUE_VERTALIGN_BOTTOM:
1264 FunctionReference xFunc( GetCurrentFunction() );
1265 FuEditGluePoints* pFunc = dynamic_cast< FuEditGluePoints* >( xFunc.get() );
1267 if(pFunc)
1268 pFunc->ReceiveRequest(rReq);
1270 rReq.Done();
1272 break;
1274 #ifdef DBG_UTIL
1275 case SID_SHOW_ITEMBROWSER:
1277 mpDrawView->ShowItemBrowser( !mpDrawView->IsItemBrowserVisible() );
1278 rReq.Done ();
1280 break;
1281 #endif
1283 case SID_AUTOSPELL_CHECK:
1285 BOOL bOnlineSpell = !GetDoc()->GetOnlineSpell();
1286 GetDoc()->SetOnlineSpell(bOnlineSpell);
1288 ::Outliner* pOL = mpDrawView->GetTextEditOutliner();
1290 if (pOL)
1292 ULONG nCntrl = pOL->GetControlWord();
1294 if (bOnlineSpell)
1295 nCntrl |= EE_CNTRL_ONLINESPELLING;
1296 else
1297 nCntrl &= ~EE_CNTRL_ONLINESPELLING;
1299 pOL->SetControlWord(nCntrl);
1302 GetActiveWindow()->Invalidate();
1303 rReq.Done ();
1305 break;
1307 case SID_CONVERT_TO_1BIT_THRESHOLD:
1308 case SID_CONVERT_TO_1BIT_MATRIX:
1309 case SID_CONVERT_TO_4BIT_GRAYS:
1310 case SID_CONVERT_TO_4BIT_COLORS:
1311 case SID_CONVERT_TO_8BIT_GRAYS:
1312 case SID_CONVERT_TO_8BIT_COLORS:
1313 case SID_CONVERT_TO_24BIT:
1315 BmpConversion eBmpConvert = BMP_CONVERSION_NONE;
1317 switch( nSId )
1319 case SID_CONVERT_TO_1BIT_THRESHOLD:
1320 eBmpConvert = BMP_CONVERSION_1BIT_THRESHOLD;
1321 break;
1323 case SID_CONVERT_TO_1BIT_MATRIX:
1324 eBmpConvert = BMP_CONVERSION_1BIT_MATRIX;
1325 break;
1327 case SID_CONVERT_TO_4BIT_GRAYS:
1328 eBmpConvert = BMP_CONVERSION_4BIT_GREYS;
1329 break;
1331 case SID_CONVERT_TO_4BIT_COLORS:
1332 eBmpConvert = BMP_CONVERSION_4BIT_COLORS;
1333 break;
1335 case SID_CONVERT_TO_8BIT_GRAYS:
1336 eBmpConvert = BMP_CONVERSION_8BIT_GREYS;
1337 break;
1339 case SID_CONVERT_TO_8BIT_COLORS:
1340 eBmpConvert = BMP_CONVERSION_8BIT_COLORS;
1341 break;
1343 case SID_CONVERT_TO_24BIT:
1344 eBmpConvert = BMP_CONVERSION_24BIT;
1345 break;
1348 mpDrawView->BegUndo(String(SdResId(STR_UNDO_COLORRESOLUTION)));
1349 const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
1351 for (ULONG i=0; i<rMarkList.GetMarkCount(); i++)
1353 SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
1355 if (pObj->GetObjInventor() == SdrInventor)
1357 if (pObj->GetObjIdentifier() == OBJ_GRAF && !((SdrGrafObj*) pObj)->IsLinkedGraphic())
1359 const Graphic& rGraphic = ((SdrGrafObj*) pObj)->GetGraphic();
1361 if( rGraphic.GetType() == GRAPHIC_BITMAP )
1363 SdrGrafObj* pNewObj = (SdrGrafObj*) pObj->Clone();
1365 if( rGraphic.IsAnimated() )
1367 Animation aAnim( rGraphic.GetAnimation() );
1368 aAnim.Convert( eBmpConvert );
1369 pNewObj->SetGraphic( aAnim );
1371 else
1373 BitmapEx aBmpEx( rGraphic.GetBitmapEx() );
1374 aBmpEx.Convert( eBmpConvert );
1375 pNewObj->SetGraphic( aBmpEx );
1378 mpDrawView->ReplaceObjectAtView( pObj, *mpDrawView->GetSdrPageView(), pNewObj );
1384 mpDrawView->EndUndo();
1385 rReq.Done ();
1387 break;
1389 case SID_TRANSLITERATE_UPPER:
1390 case SID_TRANSLITERATE_LOWER:
1391 case SID_TRANSLITERATE_HALFWIDTH:
1392 case SID_TRANSLITERATE_FULLWIDTH:
1393 case SID_TRANSLITERATE_HIRAGANA:
1394 case SID_TRANSLITERATE_KATAGANA:
1396 OutlinerView* pOLV = GetView()->GetTextEditOutlinerView();
1397 if( pOLV )
1399 using namespace ::com::sun::star::i18n;
1400 sal_Int32 nType = 0;
1402 switch( nSId )
1404 case SID_TRANSLITERATE_UPPER:
1405 nType = TransliterationModules_LOWERCASE_UPPERCASE;
1406 break;
1407 case SID_TRANSLITERATE_LOWER:
1408 nType = TransliterationModules_UPPERCASE_LOWERCASE;
1409 break;
1410 case SID_TRANSLITERATE_HALFWIDTH:
1411 nType = TransliterationModules_FULLWIDTH_HALFWIDTH;
1412 break;
1413 case SID_TRANSLITERATE_FULLWIDTH:
1414 nType = TransliterationModules_HALFWIDTH_FULLWIDTH;
1415 break;
1416 case SID_TRANSLITERATE_HIRAGANA:
1417 nType = TransliterationModules_KATAKANA_HIRAGANA;
1418 break;
1419 case SID_TRANSLITERATE_KATAGANA:
1420 nType = TransliterationModules_HIRAGANA_KATAKANA;
1421 break;
1424 pOLV->TransliterateText( nType );
1427 rReq.Done();
1429 break;
1431 // #UndoRedo#
1432 case SID_UNDO :
1434 // #96090# moved implementation to BaseClass
1435 ImpSidUndo(TRUE, rReq);
1437 break;
1438 case SID_REDO :
1440 // #96090# moved implementation to BaseClass
1441 ImpSidRedo(TRUE, rReq);
1443 break;
1445 default:
1446 break;
1450 /*************************************************************************
1452 |* URL-Feld einfuegen
1454 \************************************************************************/
1456 void DrawViewShell::InsertURLField(const String& rURL, const String& rText,
1457 const String& rTarget, const Point* pPos)
1459 OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
1461 if (pOLV)
1463 ESelection aSel( pOLV->GetSelection() );
1464 SvxFieldItem aURLItem( SvxURLField( rURL, rText, SVXURLFORMAT_REPR ), EE_FEATURE_FIELD );
1465 pOLV->InsertField( aURLItem );
1466 if ( aSel.nStartPos <= aSel.nEndPos )
1467 aSel.nEndPos = aSel.nStartPos + 1;
1468 else
1469 aSel.nStartPos = aSel.nEndPos + 1;
1470 pOLV->SetSelection( aSel );
1472 else
1474 Outliner* pOutl = GetDoc()->GetInternalOutliner();
1475 pOutl->Init( OUTLINERMODE_TEXTOBJECT );
1476 USHORT nOutlMode = pOutl->GetMode();
1478 SvxURLField aURLField(rURL, rText, SVXURLFORMAT_REPR);
1479 aURLField.SetTargetFrame(rTarget);
1480 SvxFieldItem aURLItem(aURLField, EE_FEATURE_FIELD);
1481 pOutl->QuickInsertField( aURLItem, ESelection() );
1482 OutlinerParaObject* pOutlParaObject = pOutl->CreateParaObject();
1484 SdrRectObj* pRectObj = new SdrRectObj(OBJ_TEXT);
1486 pOutl->UpdateFields();
1487 pOutl->SetUpdateMode( TRUE );
1488 Size aSize(pOutl->CalcTextSize());
1489 pOutl->SetUpdateMode( FALSE );
1491 Point aPos;
1493 if (pPos)
1495 aPos = *pPos;
1497 else
1499 Rectangle aRect(aPos, GetActiveWindow()->GetOutputSizePixel() );
1500 aPos = aRect.Center();
1501 aPos = GetActiveWindow()->PixelToLogic(aPos);
1502 aPos.X() -= aSize.Width() / 2;
1503 aPos.Y() -= aSize.Height() / 2;
1506 Rectangle aLogicRect(aPos, aSize);
1507 pRectObj->SetLogicRect(aLogicRect);
1508 pRectObj->SetOutlinerParaObject( pOutlParaObject );
1509 mpDrawView->InsertObjectAtView(pRectObj, *mpDrawView->GetSdrPageView());
1510 pOutl->Init( nOutlMode );
1514 /*************************************************************************
1516 |* URL-Button einfuegen
1518 \************************************************************************/
1520 void DrawViewShell::InsertURLButton(const String& rURL, const String& rText,
1521 const String& rTarget, const Point* pPos)
1523 BOOL bNewObj = TRUE;
1525 const OUString sTargetURL( ::URIHelper::SmartRel2Abs( INetURLObject( GetDocSh()->GetMedium()->GetBaseURL() ), rURL, URIHelper::GetMaybeFileHdl(), true, false,
1526 INetURLObject::WAS_ENCODED,
1527 INetURLObject::DECODE_UNAMBIGUOUS ) );
1528 if (mpDrawView->GetMarkedObjectList().GetMarkCount() > 0)
1530 SdrObject* pMarkedObj = mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
1531 if( pMarkedObj ) try
1533 // change first marked object
1534 if( (FmFormInventor == pMarkedObj->GetObjInventor() && pMarkedObj->GetObjIdentifier() == OBJ_FM_BUTTON) )
1536 bNewObj = FALSE;
1538 SdrUnoObj* pUnoCtrl = static_cast< SdrUnoObj* >( pMarkedObj );
1540 Reference< awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel(), UNO_QUERY_THROW );
1541 Reference< beans::XPropertySet > xPropSet( xControlModel, UNO_QUERY_THROW );
1543 xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Label" )), Any( OUString( rText ) ) );
1544 xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TargetURL" )), Any( sTargetURL ) );
1546 if( rTarget.Len() )
1547 xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TargetFrame" )), Any( OUString( rTarget ) ) );
1549 xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "ButtonType" )), Any( form::FormButtonType_URL ) );
1550 if ( ::avmedia::MediaWindow::isMediaURL( rURL ) )
1552 // #105638# OJ
1553 xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "DispatchURLInternal" )), Any( sal_True ) );
1556 else
1558 // add url as interaction for first selected shape
1559 bNewObj = FALSE;
1561 SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pMarkedObj, true);
1562 pInfo->meClickAction = presentation::ClickAction_DOCUMENT;
1563 pInfo->SetBookmark( sTargetURL );
1566 catch( uno::Exception& )
1571 if (bNewObj) try
1573 SdrUnoObj* pUnoCtrl = static_cast< SdrUnoObj* >( SdrObjFactory::MakeNewObject(FmFormInventor, OBJ_FM_BUTTON,
1574 mpDrawView->GetSdrPageView()->GetPage(), GetDoc()) );
1576 Reference< awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel(), uno::UNO_QUERY_THROW );
1577 Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY_THROW );
1579 xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Label" )), Any( OUString( rText ) ) );
1580 xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TargetURL" )), Any( sTargetURL ) );
1582 if( rTarget.Len() )
1583 xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TargetFrame" )), Any( OUString( rTarget ) ) );
1585 xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "ButtonType" )), Any( form::FormButtonType_URL ) );
1586 // #105638# OJ
1587 if ( ::avmedia::MediaWindow::isMediaURL( rURL ) )
1588 xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "DispatchURLInternal" )), Any( sal_True ) );
1590 Point aPos;
1592 if (pPos)
1594 aPos = *pPos;
1596 else
1598 aPos = Rectangle(aPos, GetActiveWindow()->GetOutputSizePixel()).Center();
1599 aPos = GetActiveWindow()->PixelToLogic(aPos);
1602 Size aSize(4000, 1000);
1603 aPos.X() -= aSize.Width() / 2;
1604 aPos.Y() -= aSize.Height() / 2;
1605 pUnoCtrl->SetLogicRect(Rectangle(aPos, aSize));
1607 ULONG nOptions = SDRINSERT_SETDEFLAYER;
1609 OSL_ASSERT (GetViewShell()!=NULL);
1610 SfxInPlaceClient* pIpClient = GetViewShell()->GetIPClient();
1611 if (pIpClient!=NULL && pIpClient->IsObjectInPlaceActive())
1613 nOptions |= SDRINSERT_DONTMARK;
1616 mpDrawView->InsertObjectAtView(pUnoCtrl, *mpDrawView->GetSdrPageView(), nOptions);
1618 catch( Exception& )
1623 /*************************************************************************
1627 \************************************************************************/
1629 void DrawViewShell::ShowUIControls (bool bVisible)
1631 ViewShell::ShowUIControls (bVisible);
1633 //AF: The LayerDialogChildWindow is not used anymore (I hope).
1634 // GetViewFrame()->SetChildWindow(
1635 // LayerDialogChildWindow::GetChildWindowId(),
1636 // IsLayerModeActive() && bVisible);
1637 maTabControl.Show (bVisible);
1640 void DrawViewShell::StopSlideShow (bool /*bCloseFrame*/)
1642 Reference< XPresentation2 > xPresentation( GetDoc()->getPresentation() );
1643 if(xPresentation.is() && xPresentation->isRunning())
1645 if( mpDrawView->IsTextEdit() )
1646 mpDrawView->SdrEndTextEdit();
1648 xPresentation->end();
1652 #ifdef _MSC_VER
1653 #pragma optimize ( "", on )
1654 #endif
1656 } // end of namespace sd