1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
28 #include <comphelper/processfactory.hxx>
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>
63 #include "DrawViewShell.hxx"
64 #include "slideshow.hxx"
65 #include "ViewShellImplementation.hxx"
66 #include "ViewShellHint.hxx"
67 #include "framework/FrameworkHelper.hxx"
70 #include "strings.hrc"
71 #include "res_bmp.hrc"
72 #include "drawdoc.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"
86 #include "FrameView.hxx"
87 #include "zoomlist.hxx"
88 #include "drawview.hxx"
89 #include "DrawDocShell.hxx"
91 #include "ViewShellBase.hxx"
92 #include "ToolBarManager.hxx"
93 #include "anminfo.hxx"
94 #include "optsitem.hxx"
96 #include "fuformatpaintbrush.hxx"
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
;
106 // Permanent Functions
108 void ImpAddPrintableCharactersToTextEdit(SfxRequest
& rReq
, ::sd::View
* pView
)
110 // evtl. feed characters to activated textedit
111 const SfxItemSet
* pSet
= rReq
.GetArgs();
115 OUString aInputString
;
117 if(SfxItemState::SET
== pSet
->GetItemState(SID_ATTR_CHAR
))
118 aInputString
= static_cast<const SfxStringItem
&>(pSet
->Get(SID_ATTR_CHAR
)).GetValue();
120 if(!aInputString
.isEmpty())
122 OutlinerView
* pOLV
= pView
->GetTextEditOutlinerView();
126 for(sal_Int32
a(0); a
< aInputString
.getLength(); a
++)
128 sal_Char aChar
= (sal_Char
)aInputString
[a
];
129 vcl::KeyCode aKeyCode
;
130 KeyEvent
aKeyEvent(aChar
, aKeyCode
);
132 // add actual character
133 pOLV
->PostKeyEvent(aKeyEvent
);
140 void DrawViewShell::FuPermanent(SfxRequest
& rReq
)
142 // We do not execute a thing during a native slide show
144 if (SlideShow::IsRunning(GetViewShellBase()))
147 sal_uInt16 nSId
= rReq
.GetSlot();
149 if( HasCurrentFunction() &&
150 ( nSId
== SID_TEXTEDIT
|| nSId
== SID_ATTR_CHAR
|| nSId
== SID_TEXT_FITTOSIZE
||
151 nSId
== SID_ATTR_CHAR_VERTICAL
|| nSId
== SID_TEXT_FITTOSIZE_VERTICAL
) )
153 rtl::Reference
<FuPoor
> xFunc( GetCurrentFunction() );
155 FuText
* pFuText
= dynamic_cast< FuText
* >( xFunc
.get() );
159 pFuText
->SetPermanent(true);
160 xFunc
->ReceiveRequest( rReq
);
168 // evtl. feed characters to activated textedit
169 if(SID_ATTR_CHAR
== nSId
&& GetView() && GetView()->IsTextEdit())
170 ImpAddPrintableCharactersToTextEdit(rReq
, GetView());
178 sal_uInt16 nOldSId
= 0;
179 bool bPermanent
= false;
184 if(HasCurrentFunction())
186 if( (nSId
== SID_FORMATPAINTBRUSH
) && (GetCurrentFunction()->GetSlotID() == SID_TEXTEDIT
) )
188 // save text edit mode for format paintbrush!
189 SetOldFunction( GetCurrentFunction() );
193 if(GetOldFunction() == GetCurrentFunction())
199 if ( nSId
!= SID_TEXTEDIT
&& nSId
!= SID_ATTR_CHAR
&& nSId
!= SID_TEXT_FITTOSIZE
&&
200 nSId
!= SID_ATTR_CHAR_VERTICAL
&& nSId
!= SID_TEXT_FITTOSIZE_VERTICAL
&&
201 nSId
!= SID_FORMATPAINTBRUSH
&&
202 mpDrawView
->IsTextEdit() )
204 mpDrawView
->SdrEndTextEdit();
207 if( HasCurrentFunction() )
209 nOldSId
= GetCurrentFunction()->GetSlotID();
211 if (nOldSId
== nSId
||
212 ((nOldSId
== SID_TEXTEDIT
|| nOldSId
== SID_ATTR_CHAR
|| nOldSId
== SID_TEXT_FITTOSIZE
||
213 nOldSId
== SID_ATTR_CHAR_VERTICAL
|| nOldSId
== SID_TEXT_FITTOSIZE_VERTICAL
) &&
214 (nSId
== SID_TEXTEDIT
|| nSId
== SID_ATTR_CHAR
|| nSId
== SID_TEXT_FITTOSIZE
||
215 nSId
== SID_ATTR_CHAR_VERTICAL
|| nSId
== SID_TEXT_FITTOSIZE_VERTICAL
)))
220 GetCurrentFunction()->Deactivate();
223 SetCurrentFunction(0);
225 SfxBindings
& rBind
= GetViewFrame()->GetBindings();
226 rBind
.Invalidate(nOldSId
);
227 rBind
.Update(nOldSId
);
230 // map Slot (ToolboxImages/-Slots)
235 case SID_TEXTEDIT
: // BASIC ???
237 case SID_ATTR_CHAR_VERTICAL
:
238 case SID_TEXT_FITTOSIZE
:
239 case SID_TEXT_FITTOSIZE_VERTICAL
:
241 SetCurrentFunction( FuText::Create(this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
242 GetCurrentFunction()->DoExecute(rReq
);
244 SfxBindings
& rBindings
= GetViewFrame()->GetBindings();
245 rBindings
.Invalidate( SID_ATTR_CHAR
);
246 rBindings
.Invalidate( SID_ATTR_CHAR_VERTICAL
);
247 rBindings
.Invalidate( SID_TEXT_FITTOSIZE
);
248 rBindings
.Invalidate( SID_TEXT_FITTOSIZE_VERTICAL
);
250 // evtl. feed characters to activated textedit
251 if(SID_ATTR_CHAR
== nSId
&& GetView() && GetView()->IsTextEdit())
252 ImpAddPrintableCharactersToTextEdit(rReq
, GetView());
258 case SID_FM_CREATE_CONTROL
:
260 SetCurrentFunction( FuConstructUnoControl::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
, bPermanent
) );
265 case SID_FM_CREATE_FIELDCONTROL
:
267 SFX_REQUEST_ARG( rReq
, pDescriptorItem
, SfxUnoAnyItem
, SID_FM_DATACCESS_DESCRIPTOR
, false );
268 DBG_ASSERT( pDescriptorItem
, "DrawViewShell::FuPermanent(SID_FM_CREATE_FIELDCONTROL): invalid request args!" );
273 FmFormView
* pFormView
= PTR_CAST(FmFormView
, mpDrawView
);
274 SdrPageView
* pPageView
= pFormView
? pFormView
->GetSdrPageView() : NULL
;
278 svx::ODataAccessDescriptor
aDescriptor(pDescriptorItem
->GetValue());
279 SdrObject
* pNewDBField
= pFormView
->CreateFieldControl(aDescriptor
);
283 Rectangle aVisArea
= GetActiveWindow()->PixelToLogic(Rectangle(Point(0,0), GetActiveWindow()->GetOutputSizePixel()));
284 Point
aObjPos(aVisArea
.Center());
285 Size
aObjSize(pNewDBField
->GetLogicRect().GetSize());
286 aObjPos
.X() -= aObjSize
.Width() / 2;
287 aObjPos
.Y() -= aObjSize
.Height() / 2;
288 Rectangle
aNewObjectRectangle(aObjPos
, aObjSize
);
290 pNewDBField
->SetLogicRect(aNewObjectRectangle
);
292 GetView()->InsertObjectAtView(pNewDBField
, *pPageView
);
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
:
312 short nSlotId
= rReq
.GetSlot();
314 if( nSlotId
== SID_OBJECT_ROTATE
)
317 if( nOldSId
== nSlotId
)
319 nSlotId
= SID_OBJECT_SELECT
;
320 rReq
.SetSlot( nSlotId
);
324 if (nSlotId
== SID_OBJECT_CROOK_ROTATE
||
325 nSlotId
== SID_OBJECT_CROOK_SLANT
||
326 nSlotId
== SID_OBJECT_CROOK_STRETCH
)
328 if ( mpDrawView
->GetMarkedObjectList().GetMarkCount() > 0 &&
329 !mpDrawView
->IsCrookAllowed( mpDrawView
->IsCrookNoContortion() ) )
331 if ( mpDrawView
->IsPresObjSelected() )
333 ::sd::Window
* pWindow
= GetActiveWindow();
334 ScopedVclPtr
<InfoBox
>::Create(pWindow
, SD_RESSTR(STR_ACTION_NOTPOSSIBLE
) )->Execute();
336 else if ( ScopedVclPtr
<QueryBox
>::Create(GetActiveWindow(), WB_YES_NO
,
337 SD_RESSTR(STR_ASK_FOR_CONVERT_TO_BEZIER
)
338 )->Execute() == RET_YES
)
340 // implicit transformation into bezier
341 WaitObject
aWait( (Window
*)GetActiveWindow() );
342 mpDrawView
->ConvertMarkedToPathObj(false);
346 else if (nSlotId
== SID_OBJECT_SHEAR
)
349 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
350 const size_t nMarkCnt
= rMarkList
.GetMarkCount();
351 bool b3DObjMarked
= false;
353 while (i
< nMarkCnt
&& !b3DObjMarked
)
355 if (rMarkList
.GetMark(i
)->GetMarkedSdrObj()->ISA(E3dObject
))
365 if ( nMarkCnt
> 0 && !b3DObjMarked
&&
366 (!mpDrawView
->IsShearAllowed() || !mpDrawView
->IsDistortAllowed()) )
368 if ( mpDrawView
->IsPresObjSelected() )
370 ::sd::Window
* pWindow
= GetActiveWindow();
371 ScopedVclPtr
<InfoBox
>::Create(pWindow
, SD_RESSTR(STR_ACTION_NOTPOSSIBLE
) )->Execute();
373 else if ( ScopedVclPtr
<QueryBox
>::Create(GetActiveWindow(), WB_YES_NO
,
374 SD_RESSTR(STR_ASK_FOR_CONVERT_TO_BEZIER
)
375 )->Execute() == RET_YES
)
377 // implicit transformation into bezier
378 WaitObject
aWait( (Window
*)GetActiveWindow() );
379 mpDrawView
->ConvertMarkedToPathObj(false);
384 SetCurrentFunction( FuSelection::Create(this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
386 Invalidate( SID_OBJECT_SELECT
);
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
:
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
:
444 SetCurrentFunction( FuConstructRectangle::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
, bPermanent
) );
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
457 SetCurrentFunction( FuConstructBezierPolygon::Create(this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
, bPermanent
) );
462 case SID_GLUE_EDITMODE
:
464 if (nOldSId
!= SID_GLUE_EDITMODE
)
466 SetCurrentFunction( FuEditGluePoints::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
, bPermanent
) );
470 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT
, SfxCallMode::ASYNCHRON
);
478 case SID_DRAW_CIRCLEARC
:
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
:
488 SetCurrentFunction( FuConstructArc::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
, bPermanent
) );
497 case SID_3D_HALF_SPHERE
:
498 case SID_3D_CYLINDER
:
502 SetCurrentFunction( FuConstruct3dObject::Create(this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
, bPermanent
) );
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
:
515 SetCurrentFunction( FuConstructCustomShape::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
, bPermanent
) );
518 if ( nSId
!= SID_DRAW_CS_ID
)
520 SfxBindings
& rBind
= GetViewFrame()->GetBindings();
521 rBind
.Invalidate( nSId
);
522 rBind
.Update( nSId
);
527 case SID_FORMATPAINTBRUSH
:
529 SetCurrentFunction( FuFormatPaintBrush::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
531 SfxBindings
& rBind
= GetViewFrame()->GetBindings();
532 rBind
.Invalidate( nSId
);
533 rBind
.Update( nSId
);
538 case SID_ZOOM_PANNING
:
540 mbZoomOnPage
= false;
541 SetCurrentFunction( FuZoom::Create(this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
552 sal_uInt16 nSlotId
= GetOldFunction()->GetSlotID();
554 GetOldFunction()->Deactivate();
557 SfxBindings
& rBind
= GetViewFrame()->GetBindings();
558 rBind
.Invalidate( nSlotId
);
559 rBind
.Update( nSlotId
);
562 if(HasCurrentFunction())
564 GetCurrentFunction()->Activate();
565 SetOldFunction( GetCurrentFunction() );
567 SetHelpId( GetCurrentFunction()->GetSlotID() );
570 // invalidate shell, is faster than every individually (says MI)
571 // now explicit the last slot incl. Update()
574 // CTRL-SID_OBJECT_SELECT -> select first draw object if none is selected yet
575 if(SID_OBJECT_SELECT
== nSId
&& HasCurrentFunction() && (rReq
.GetModifier() & KEY_MOD1
))
577 if(!GetView()->AreObjectsMarked())
579 // select first object
580 GetView()->UnmarkAllObj();
581 GetView()->MarkNextObj(true);
583 // ...and make it visible
584 if(GetView()->AreObjectsMarked())
585 GetView()->MakeVisible(GetView()->GetAllMarkedRect(), *GetActiveWindow());
589 // with qualifier construct directly
590 if(HasCurrentFunction() && (rReq
.GetModifier() & KEY_MOD1
))
593 SdOptions
* pOptions
= SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType());
594 sal_uInt32
nDefaultObjectSizeWidth(pOptions
->GetDefaultObjectSizeWidth());
595 sal_uInt32
nDefaultObjectSizeHeight(pOptions
->GetDefaultObjectSizeHeight());
597 // calc position and size
598 Rectangle aVisArea
= GetActiveWindow()->PixelToLogic(Rectangle(Point(0,0), GetActiveWindow()->GetOutputSizePixel()));
599 Point aPagePos
= aVisArea
.Center();
600 aPagePos
.X() -= nDefaultObjectSizeWidth
/ 2;
601 aPagePos
.Y() -= nDefaultObjectSizeHeight
/ 2;
602 Rectangle
aNewObjectRectangle(aPagePos
, Size(nDefaultObjectSizeWidth
, nDefaultObjectSizeHeight
));
603 SdrPageView
* pPageView
= mpDrawView
->GetSdrPageView();
607 // create the default object
608 SdrObject
* pObj
= GetCurrentFunction()->CreateDefaultObject(nSId
, aNewObjectRectangle
);
613 GetView()->InsertObjectAtView(pObj
, *pPageView
);
615 // Now that pFuActual has done what it was created for we
616 // can switch on the edit mode for callout objects.
619 case SID_DRAW_CAPTION
:
620 case SID_DRAW_CAPTION_VERTICAL
:
622 // Make FuText the current function.
623 SfxUInt16Item
aItem (SID_TEXTEDIT
, 1);
624 GetViewFrame()->GetDispatcher()->
625 Execute(SID_TEXTEDIT
, SfxCallMode::SYNCHRON
|
626 SfxCallMode::RECORD
, &aItem
, 0L);
627 // Put text object into edit mode.
628 GetView()->SdrBeginTextEdit(static_cast<SdrTextObj
*>(pObj
), pPageView
);
637 void DrawViewShell::FuDeleteSelectedObjects()
642 bool bConsumed
= false;
644 //if any placeholders are selected
645 if (mpDrawView
->IsPresObjSelected(false, true, false, false))
647 //If there are placeholders in the list which can be toggled
648 //off in edit->master->master elements then do that here,
649 std::vector
<SdrObject
*> aPresMarksToRemove
;
650 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
651 for (size_t i
=0; i
< rMarkList
.GetMarkCount(); ++i
)
653 SdrObject
* pObj
= rMarkList
.GetMark(i
)->GetMarkedSdrObj();
654 SdPage
* pPage
= static_cast<SdPage
*>(pObj
->GetPage());
655 PresObjKind eKind
= pPage
->GetPresObjKind(pObj
);
656 if (eKind
== PRESOBJ_FOOTER
|| eKind
== PRESOBJ_HEADER
||
657 eKind
== PRESOBJ_DATETIME
|| eKind
== PRESOBJ_SLIDENUMBER
)
659 aPresMarksToRemove
.push_back(pObj
);
663 for (SdrObject
* pObj
: aPresMarksToRemove
)
666 mpDrawView
->MarkObj(pObj
, mpDrawView
->GetSdrPageView(), true);
667 SdPage
* pPage
= static_cast<SdPage
*>(pObj
->GetPage());
668 //remove placeholder from master page
669 pPage
->DestroyDefaultPresObj(pPage
->GetPresObjKind(pObj
));
675 // placeholders which cannot be deleted selected
676 if (mpDrawView
->IsPresObjSelected(false, true, false, true))
678 ::sd::Window
* pWindow
= GetActiveWindow();
679 ScopedVclPtr
<InfoBox
>::Create(pWindow
, SD_RESSTR(STR_ACTION_NOTPOSSIBLE
) )->Execute();
685 vcl::KeyCode
aKCode(KEY_DELETE
);
686 KeyEvent
aKEvt( 0, aKCode
);
688 bConsumed
= mpDrawView
->getSmartTags().KeyInput( aKEvt
);
690 if (!bConsumed
&& HasCurrentFunction())
691 bConsumed
= GetCurrentFunction()->KeyInput(aKEvt
);
694 mpDrawView
->DeleteMarked();
698 void DrawViewShell::FuSupport(SfxRequest
& rReq
)
700 if( rReq
.GetSlot() == SID_STYLE_FAMILY
&& rReq
.GetArgs())
701 GetDocSh()->SetStyleFamily(static_cast<const SfxUInt16Item
&>(rReq
.GetArgs()->Get( SID_STYLE_FAMILY
)).GetValue());
703 // We do not execute a thing during a native slide show
704 if(SlideShow::IsRunning(GetViewShellBase()) &&
705 (rReq
.GetSlot() != SID_PRESENTATION_END
&&
706 rReq
.GetSlot() != SID_SIZE_PAGE
))
714 sal_uInt16 nSId
= rReq
.GetSlot();
716 // maybe we map the slot (ToolboxImages/-Slots)
721 case SID_CLEAR_UNDO_STACK
:
723 GetDocSh()->ClearUndoBuffer();
728 // execute slots of ToolboxController mapped
729 case SID_OBJECT_CHOOSE_MODE
:
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
:
742 sal_uInt16 nMappedSlot
= GetMappedSlot( nSId
);
743 if( nMappedSlot
> 0 )
745 SfxRequest
aReq( nMappedSlot
, SfxCallMode::SLOT
, GetDoc()->GetItemPool() );
751 case SID_PRESENTATION
:
752 case SID_PRESENTATION_CURRENT_SLIDE
:
753 case SID_REHEARSE_TIMINGS
:
760 case SID_PRESENTATION_END
:
768 case SID_BEZIER_EDIT
:
770 mpDrawView
->SetFrameDragSingles(!mpDrawView
->IsFrameDragSingles());
772 /******************************************************************
774 ******************************************************************/
775 if( dynamic_cast< FuSelection
* >( GetCurrentFunction().get() ) || dynamic_cast< FuConstructBezierPolygon
* >( GetCurrentFunction().get() ) )
777 // Tell the tool bar manager about the context change.
778 GetViewShellBase().GetToolBarManager()->SelectionHasChanged(*this,*mpDrawView
);
781 Invalidate(SID_BEZIER_EDIT
);
786 case SID_OBJECT_CLOSE
:
788 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
789 if ( rMarkList
.GetMark(0) && !mpDrawView
->IsAction() )
791 SdrPathObj
* pPathObj
= static_cast<SdrPathObj
*>( rMarkList
.GetMark(0)->GetMarkedSdrObj());
792 const bool bUndo
= mpDrawView
->IsUndoEnabled();
794 mpDrawView
->BegUndo(SD_RESSTR(STR_UNDO_BEZCLOSE
));
796 mpDrawView
->UnmarkAllPoints();
799 mpDrawView
->AddUndo(new SdrUndoGeoObj(*pPathObj
));
801 pPathObj
->ToggleClosed();
804 mpDrawView
->EndUndo();
812 if ( mpDrawView
->IsPresObjSelected(false, true, false, true) )
814 ::sd::Window
* pWindow
= GetActiveWindow();
815 ScopedVclPtr
<InfoBox
>::Create(pWindow
, SD_RESSTR(STR_ACTION_NOTPOSSIBLE
) )->Execute();
819 if(HasCurrentFunction())
821 GetCurrentFunction()->DoCut();
834 if ( mpDrawView
->IsPresObjSelected(false, true, false, true) )
836 ::sd::Window
* pWindow
= GetActiveWindow();
837 ScopedVclPtr
<InfoBox
>::Create(pWindow
, SD_RESSTR(STR_ACTION_NOTPOSSIBLE
) )->Execute();
841 if(HasCurrentFunction())
843 GetCurrentFunction()->DoCopy();
845 else if( mpDrawView
)
847 mpDrawView
->DoCopy();
856 WaitObject
aWait( (Window
*)GetActiveWindow() );
858 if(HasCurrentFunction())
860 GetCurrentFunction()->DoPaste();
864 mpDrawView
->DoPaste();
871 case SID_PASTE_UNFORMATTED
:
873 WaitObject
aWait( (Window
*)GetActiveWindow() );
875 if(HasCurrentFunction())
877 GetCurrentFunction()->DoPasteUnformatted();
881 sal_Int8 nAction
= DND_ACTION_COPY
;
882 TransferableDataHelper
aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) );
883 if (aDataHelper
.GetTransferable().is())
885 mpDrawView
->InsertData( aDataHelper
,
886 GetActiveWindow()->PixelToLogic( Rectangle( Point(), GetActiveWindow()->GetOutputSizePixel() ).Center() ),
887 nAction
, false, SotClipboardFormatId::STRING
);
895 case SID_CLIPBOARD_FORMAT_ITEMS
:
897 WaitObject
aWait( (Window
*)GetActiveWindow() );
898 TransferableDataHelper
aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( GetActiveWindow() ) );
899 const SfxItemSet
* pReqArgs
= rReq
.GetArgs();
900 SotClipboardFormatId nFormat
= SotClipboardFormatId::NONE
;
904 SFX_REQUEST_ARG( rReq
, pIsActive
, SfxUInt32Item
, SID_CLIPBOARD_FORMAT_ITEMS
, false );
905 nFormat
= static_cast<SotClipboardFormatId
>(pIsActive
->GetValue());
908 if( nFormat
!= SotClipboardFormatId::NONE
&& aDataHelper
.GetTransferable().is() )
910 sal_Int8 nAction
= DND_ACTION_COPY
;
912 if( !mpDrawView
->InsertData( aDataHelper
,
913 GetActiveWindow()->PixelToLogic( Rectangle( Point(), GetActiveWindow()->GetOutputSizePixel() ).Center() ),
914 nAction
, false, nFormat
) )
916 INetBookmark
aINetBookmark( aEmptyStr
, aEmptyStr
);
918 if( ( aDataHelper
.HasFormat( SotClipboardFormatId::NETSCAPE_BOOKMARK
) &&
919 aDataHelper
.GetINetBookmark( SotClipboardFormatId::NETSCAPE_BOOKMARK
, aINetBookmark
) ) ||
920 ( aDataHelper
.HasFormat( SotClipboardFormatId::FILEGRPDESCRIPTOR
) &&
921 aDataHelper
.GetINetBookmark( SotClipboardFormatId::FILEGRPDESCRIPTOR
, aINetBookmark
) ) ||
922 ( aDataHelper
.HasFormat( SotClipboardFormatId::UNIFORMRESOURCELOCATOR
) &&
923 aDataHelper
.GetINetBookmark( SotClipboardFormatId::UNIFORMRESOURCELOCATOR
, aINetBookmark
) ) )
925 InsertURLField( aINetBookmark
.GetURL(), aINetBookmark
.GetDescription(), aEmptyStr
, NULL
);
934 if ( mpDrawView
->IsTextEdit() )
936 OutlinerView
* pOLV
= mpDrawView
->GetTextEditOutlinerView();
940 vcl::KeyCode
aKCode(KEY_DELETE
);
941 KeyEvent
aKEvt( 0, aKCode
);
942 pOLV
->PostKeyEvent(aKEvt
);
947 FuDeleteSelectedObjects();
954 case SID_HANDOUTMODE
:
955 // AutoLayouts have to be ready.
956 GetDoc()->StopWorkStartupDelay();
957 // Fall through to following case statements.
959 case SID_DRAWINGMODE
:
961 case SID_OUTLINEMODE
:
962 // Let the sub-shell manager handle the slot handling.
963 framework::FrameworkHelper::Instance(GetViewShellBase())->HandleModeChangeSlot(
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
975 // AutoLayouts needs to be finished
976 GetDoc()->StopWorkStartupDelay();
978 const SfxItemSet
* pReqArgs
= rReq
.GetArgs();
982 SFX_REQUEST_ARG (rReq
, pIsActive
, SfxBoolItem
, SID_MASTERPAGE
, false);
983 mbIsLayerModeActive
= pIsActive
->GetValue ();
987 ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_START
));
989 if (nSId
== SID_MASTERPAGE
||
990 (nSId
== SID_SLIDE_MASTERPAGE
&& mePageKind
== PK_STANDARD
) ||
991 (nSId
== SID_TITLE_MASTERPAGE
&& mePageKind
== PK_STANDARD
) ||
992 (nSId
== SID_NOTES_MASTERPAGE
&& mePageKind
== PK_NOTES
) ||
993 (nSId
== SID_HANDOUT_MASTERPAGE
&& mePageKind
== PK_HANDOUT
))
995 if (nSId
== SID_TITLE_MASTERPAGE
||
996 nSId
== SID_SLIDE_MASTERPAGE
)
998 // Is there a page with the AutoLayout "Title"?
1001 sal_uInt16 nCount
= GetDoc()->GetSdPageCount(PK_STANDARD
);
1003 while (i
< nCount
&& !bFound
)
1005 SdPage
* pPage
= GetDoc()->GetSdPage(i
, PK_STANDARD
);
1007 if (nSId
== SID_TITLE_MASTERPAGE
&& pPage
->GetAutoLayout() == AUTOLAYOUT_TITLE
)
1010 SwitchPage((pPage
->GetPageNum() - 1) / 2);
1012 else if (nSId
== SID_SLIDE_MASTERPAGE
&& pPage
->GetAutoLayout() != AUTOLAYOUT_TITLE
)
1015 SwitchPage((pPage
->GetPageNum() - 1) / 2);
1022 // turn on default layer of MasterPage
1023 mpDrawView
->SetActiveLayer( SD_RESSTR(STR_LAYER_BCKGRNDOBJ
) );
1025 ChangeEditMode(EM_MASTERPAGE
, mbIsLayerModeActive
);
1027 if(HasCurrentFunction(SID_BEZIER_EDIT
))
1028 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT
, SfxCallMode::ASYNCHRON
);
1032 // Switch to requested ViewShell.
1033 ::OUString sRequestedView
;
1037 case SID_SLIDE_MASTERPAGE
:
1038 case SID_TITLE_MASTERPAGE
:
1040 sRequestedView
= framework::FrameworkHelper::msImpressViewURL
;
1041 ePageKind
= PK_STANDARD
;
1044 case SID_NOTES_MASTERPAGE
:
1045 sRequestedView
= framework::FrameworkHelper::msNotesViewURL
;
1046 ePageKind
= PK_NOTES
;
1049 case SID_HANDOUT_MASTERPAGE
:
1050 sRequestedView
= framework::FrameworkHelper::msHandoutViewURL
;
1051 ePageKind
= PK_HANDOUT
;
1055 mpFrameView
->SetViewShEditMode(EM_MASTERPAGE
, ePageKind
);
1056 mpFrameView
->SetLayerMode(mbIsLayerModeActive
);
1057 framework::FrameworkHelper::Instance(GetViewShellBase())->RequestView(
1059 framework::FrameworkHelper::msCenterPaneURL
);
1062 ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_END
));
1064 InvalidateWindows();
1071 case SID_CLOSE_MASTER_VIEW
:
1074 ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_START
));
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.
1080 ChangeEditMode(EM_PAGE
, IsLayerModeActive());
1082 ViewShellHint(ViewShellHint::HINT_CHANGE_EDIT_MODE_END
));
1084 if(HasCurrentFunction(SID_BEZIER_EDIT
))
1086 GetViewFrame()->GetDispatcher()->Execute(
1088 SfxCallMode::ASYNCHRON
);
1097 const SfxItemSet
* pReqArgs
= rReq
.GetArgs();
1099 // Remember old ruler state
1100 bool bOldHasRuler(HasRuler());
1104 SFX_REQUEST_ARG (rReq
, pIsActive
, SfxBoolItem
, SID_RULER
, false);
1105 SetRuler (pIsActive
->GetValue ());
1107 else SetRuler (!HasRuler());
1109 // Did ruler state change? Tell that to SdOptions, too.
1110 bool bHasRuler(HasRuler());
1112 if(bOldHasRuler
!= bHasRuler
)
1114 SdOptions
* pOptions
= SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType());
1116 if(pOptions
&& pOptions
->IsRulerVisible() != bHasRuler
)
1118 pOptions
->SetRulerVisible(bHasRuler
);
1122 Invalidate (SID_RULER
);
1129 case SID_SIZE_PAGE_WIDTH
: // BASIC
1131 mbZoomOnPage
= ( rReq
.GetSlot() == SID_SIZE_PAGE
);
1133 SdrPageView
* pPageView
= mpDrawView
->GetSdrPageView();
1137 Point
aPagePos(0, 0); // = pPageView->GetOffset();
1138 Size aPageSize
= pPageView
->GetPage()->GetSize();
1140 aPagePos
.X() += aPageSize
.Width() / 2;
1141 aPageSize
.Width() = (long) (aPageSize
.Width() * 1.03);
1143 if( rReq
.GetSlot() == SID_SIZE_PAGE
)
1145 aPagePos
.Y() += aPageSize
.Height() / 2;
1146 aPageSize
.Height() = (long) (aPageSize
.Height() * 1.03);
1147 aPagePos
.Y() -= aPageSize
.Height() / 2;
1151 Point aPt
= GetActiveWindow()->PixelToLogic( Point( 0, GetActiveWindow()->GetSizePixel().Height() / 2 ) );
1152 aPagePos
.Y() += aPt
.Y();
1153 aPageSize
.Height() = 2;
1156 aPagePos
.X() -= aPageSize
.Width() / 2;
1158 SetZoomRect( Rectangle( aPagePos
, aPageSize
) );
1160 Rectangle aVisAreaWin
= GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
1161 GetActiveWindow()->GetOutputSizePixel()) );
1162 mpZoomList
->InsertZoomRect(aVisAreaWin
);
1164 Invalidate( SID_ZOOM_IN
);
1165 Invalidate( SID_ZOOM_OUT
);
1166 Invalidate( SID_ZOOM_PANNING
);
1167 Invalidate( SID_ZOOM_TOOLBOX
);
1172 case SID_SIZE_REAL
: // BASIC
1174 mbZoomOnPage
= false;
1176 Rectangle aVisAreaWin
= GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
1177 GetActiveWindow()->GetOutputSizePixel()) );
1178 mpZoomList
->InsertZoomRect(aVisAreaWin
);
1179 Invalidate( SID_ZOOM_IN
);
1180 Invalidate( SID_ZOOM_OUT
);
1181 Invalidate( SID_ZOOM_PANNING
);
1182 Invalidate( SID_ZOOM_TOOLBOX
);
1187 case SID_ZOOM_IN
: // BASIC
1189 mbZoomOnPage
= false;
1190 SetZoom( std::max( (long) ( GetActiveWindow()->GetZoom() / 2 ), (long) GetActiveWindow()->GetMinZoom() ) );
1191 Rectangle aVisAreaWin
= GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
1192 GetActiveWindow()->GetOutputSizePixel()) );
1193 mpZoomList
->InsertZoomRect(aVisAreaWin
);
1194 Invalidate( SID_ZOOM_IN
);
1195 Invalidate( SID_ZOOM_OUT
);
1196 Invalidate( SID_ZOOM_PANNING
);
1197 Invalidate( SID_ZOOM_TOOLBOX
);
1204 mbZoomOnPage
= false;
1205 SetZoom( std::min( (long) ( GetActiveWindow()->GetZoom() * 2 ), (long) GetActiveWindow()->GetMaxZoom() ) );
1206 Rectangle aVisAreaWin
= GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
1207 GetActiveWindow()->GetOutputSizePixel()) );
1208 mpZoomList
->InsertZoomRect(aVisAreaWin
);
1209 Invalidate( SID_ZOOM_IN
);
1210 Invalidate( SID_ZOOM_PANNING
);
1211 Invalidate( SID_ZOOM_TOOLBOX
);
1216 case SID_SIZE_VISAREA
:
1218 Rectangle aVisArea
= mpFrameView
->GetVisArea();
1219 Size aVisAreaSize
= aVisArea
.GetSize();
1221 if (aVisAreaSize
.Height()!=0 && aVisAreaSize
.Width()!=0)
1223 mbZoomOnPage
= false;
1224 SetZoomRect(aVisArea
);
1225 Invalidate( SID_ZOOM_IN
);
1226 Invalidate( SID_ZOOM_OUT
);
1227 Invalidate( SID_ZOOM_PANNING
);
1228 Invalidate( SID_ZOOM_TOOLBOX
);
1234 // name confusion: SID_SIZE_OPTIMAL -> Zoom onto selected objects
1235 // --> Is offered as object zoom in program
1236 case SID_SIZE_OPTIMAL
: // BASIC
1238 mbZoomOnPage
= false;
1239 if ( mpDrawView
->AreObjectsMarked() )
1241 maMarkRect
= mpDrawView
->GetAllMarkedRect();
1242 long nW
= (long) (maMarkRect
.GetWidth() * 1.03);
1243 long nH
= (long) (maMarkRect
.GetHeight() * 1.03);
1244 Point aPos
= maMarkRect
.Center();
1249 SetZoomRect(Rectangle(aPos
, Size(nW
, nH
)));
1251 Rectangle aVisAreaWin
= GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
1252 GetActiveWindow()->GetOutputSizePixel()) );
1253 mpZoomList
->InsertZoomRect(aVisAreaWin
);
1256 Invalidate( SID_ZOOM_IN
);
1257 Invalidate( SID_ZOOM_OUT
);
1258 Invalidate( SID_ZOOM_PANNING
);
1259 Invalidate( SID_ZOOM_TOOLBOX
);
1264 // name confusion: SID_SIZE_ALL -> Zoom onto all objects
1265 // --> Is offered as optimal in program
1266 case SID_SIZE_ALL
: // BASIC
1268 mbZoomOnPage
= false;
1269 SdrPageView
* pPageView
= mpDrawView
->GetSdrPageView();
1273 Rectangle
aBoundRect( pPageView
->GetObjList()->GetAllObjBoundRect() );
1275 long nW
= (long) (aBoundRect
.GetWidth() * 1.03);
1276 long nH
= (long) (aBoundRect
.GetHeight() * 1.03);
1277 Point aPos
= aBoundRect
.Center();
1282 SetZoomRect( Rectangle( aPos
, Size( nW
, nH
) ) );
1284 Rectangle aVisAreaWin
= GetActiveWindow()->PixelToLogic( Rectangle( Point(0,0),
1285 GetActiveWindow()->GetOutputSizePixel()) );
1286 mpZoomList
->InsertZoomRect(aVisAreaWin
);
1289 Invalidate( SID_ZOOM_IN
);
1290 Invalidate( SID_ZOOM_OUT
);
1291 Invalidate( SID_ZOOM_PANNING
);
1292 Invalidate( SID_ZOOM_TOOLBOX
);
1300 if (mpDrawView
->IsTextEdit())
1302 mpDrawView
->SdrEndTextEdit();
1305 if (mpZoomList
->IsPreviousPossible())
1307 // set previous ZoomRect
1308 SetZoomRect(mpZoomList
->GetPreviousZoomRect());
1311 Invalidate( SID_ZOOM_TOOLBOX
);
1317 if (mpDrawView
->IsTextEdit())
1319 mpDrawView
->SdrEndTextEdit();
1322 if (mpZoomList
->IsNextPossible())
1324 // set next ZoomRect
1325 SetZoomRect(mpZoomList
->GetNextZoomRect());
1328 Invalidate( SID_ZOOM_TOOLBOX
);
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
:
1346 rtl::Reference
<FuPoor
> xFunc( GetCurrentFunction() );
1347 FuEditGluePoints
* pFunc
= dynamic_cast< FuEditGluePoints
* >( xFunc
.get() );
1350 pFunc
->ReceiveRequest(rReq
);
1357 case SID_SHOW_ITEMBROWSER
:
1359 mpDrawView
->ShowItemBrowser( !mpDrawView
->IsItemBrowserVisible() );
1365 case SID_AUTOSPELL_CHECK
:
1367 bool bOnlineSpell
= !GetDoc()->GetOnlineSpell();
1368 GetDoc()->SetOnlineSpell(bOnlineSpell
);
1370 ::Outliner
* pOL
= mpDrawView
->GetTextEditOutliner();
1374 EEControlBits nCntrl
= pOL
->GetControlWord();
1377 nCntrl
|= EEControlBits::ONLINESPELLING
;
1379 nCntrl
&= ~EEControlBits::ONLINESPELLING
;
1381 pOL
->SetControlWord(nCntrl
);
1384 GetActiveWindow()->Invalidate();
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
:
1397 BmpConversion eBmpConvert
= BMP_CONVERSION_NONE
;
1401 case SID_CONVERT_TO_1BIT_THRESHOLD
:
1402 eBmpConvert
= BMP_CONVERSION_1BIT_THRESHOLD
;
1405 case SID_CONVERT_TO_1BIT_MATRIX
:
1406 eBmpConvert
= BMP_CONVERSION_1BIT_MATRIX
;
1409 case SID_CONVERT_TO_4BIT_GRAYS
:
1410 eBmpConvert
= BMP_CONVERSION_4BIT_GREYS
;
1413 case SID_CONVERT_TO_4BIT_COLORS
:
1414 eBmpConvert
= BMP_CONVERSION_4BIT_COLORS
;
1417 case SID_CONVERT_TO_8BIT_GRAYS
:
1418 eBmpConvert
= BMP_CONVERSION_8BIT_GREYS
;
1421 case SID_CONVERT_TO_8BIT_COLORS
:
1422 eBmpConvert
= BMP_CONVERSION_8BIT_COLORS
;
1425 case SID_CONVERT_TO_24BIT
:
1426 eBmpConvert
= BMP_CONVERSION_24BIT
;
1430 mpDrawView
->BegUndo(SD_RESSTR(STR_UNDO_COLORRESOLUTION
));
1431 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
1433 for (size_t i
=0; i
<rMarkList
.GetMarkCount(); ++i
)
1435 SdrObject
* pObj
= rMarkList
.GetMark(i
)->GetMarkedSdrObj();
1437 if (pObj
->GetObjInventor() == SdrInventor
)
1439 if (pObj
->GetObjIdentifier() == OBJ_GRAF
&& !static_cast<SdrGrafObj
*>(pObj
)->IsLinkedGraphic())
1441 const Graphic
& rGraphic
= static_cast<SdrGrafObj
*>(pObj
)->GetGraphic();
1443 if( rGraphic
.GetType() == GRAPHIC_BITMAP
)
1445 SdrGrafObj
* pNewObj
= static_cast<SdrGrafObj
*>( pObj
->Clone() );
1447 if( rGraphic
.IsAnimated() )
1449 Animation
aAnim( rGraphic
.GetAnimation() );
1450 aAnim
.Convert( eBmpConvert
);
1451 pNewObj
->SetGraphic( aAnim
);
1455 BitmapEx
aBmpEx( rGraphic
.GetBitmapEx() );
1456 aBmpEx
.Convert( eBmpConvert
);
1457 pNewObj
->SetGraphic( aBmpEx
);
1460 mpDrawView
->ReplaceObjectAtView( pObj
, *mpDrawView
->GetSdrPageView(), pNewObj
);
1466 mpDrawView
->EndUndo();
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
:
1481 OutlinerView
* pOLV
= GetView()->GetTextEditOutlinerView();
1484 using namespace ::com::sun::star::i18n
;
1485 sal_Int32 nType
= 0;
1489 case SID_TRANSLITERATE_SENTENCE_CASE
:
1490 nType
= TransliterationModulesExtra::SENTENCE_CASE
;
1492 case SID_TRANSLITERATE_TITLE_CASE
:
1493 nType
= TransliterationModulesExtra::TITLE_CASE
;
1495 case SID_TRANSLITERATE_TOGGLE_CASE
:
1496 nType
= TransliterationModulesExtra::TOGGLE_CASE
;
1498 case SID_TRANSLITERATE_UPPER
:
1499 nType
= TransliterationModules_LOWERCASE_UPPERCASE
;
1501 case SID_TRANSLITERATE_LOWER
:
1502 nType
= TransliterationModules_UPPERCASE_LOWERCASE
;
1504 case SID_TRANSLITERATE_HALFWIDTH
:
1505 nType
= TransliterationModules_FULLWIDTH_HALFWIDTH
;
1507 case SID_TRANSLITERATE_FULLWIDTH
:
1508 nType
= TransliterationModules_HALFWIDTH_FULLWIDTH
;
1510 case SID_TRANSLITERATE_HIRAGANA
:
1511 nType
= TransliterationModules_KATAKANA_HIRAGANA
;
1513 case SID_TRANSLITERATE_KATAGANA
:
1514 nType
= TransliterationModules_HIRAGANA_KATAKANA
;
1518 pOLV
->TransliterateText( nType
);
1528 // moved implementation to BaseClass
1529 ImpSidUndo(true, rReq
);
1534 // moved implementation to BaseClass
1535 ImpSidRedo(true, rReq
);
1544 void DrawViewShell::FuSupportRotate(SfxRequest
&rReq
)
1546 if( rReq
.GetSlot() == SID_TRANSLITERATE_ROTATE_CASE
)
1548 ::sd::View
* pView
= GetView();
1553 OutlinerView
* pOLV
= pView
->GetTextEditOutlinerView();
1558 pOLV
->TransliterateText( m_aRotateCase
.getNextMode() );
1562 void DrawViewShell::InsertURLField(const OUString
& rURL
, const OUString
& rText
,
1563 const OUString
& rTarget
, const Point
* pPos
)
1565 OutlinerView
* pOLV
= mpDrawView
->GetTextEditOutlinerView();
1569 ESelection
aSel( pOLV
->GetSelection() );
1570 SvxFieldItem
aURLItem( SvxURLField( rURL
, rText
, SVXURLFORMAT_REPR
), EE_FEATURE_FIELD
);
1571 pOLV
->InsertField( aURLItem
);
1572 if ( aSel
.nStartPos
<= aSel
.nEndPos
)
1573 aSel
.nEndPos
= aSel
.nStartPos
+ 1;
1575 aSel
.nStartPos
= aSel
.nEndPos
+ 1;
1576 pOLV
->SetSelection( aSel
);
1580 Outliner
* pOutl
= GetDoc()->GetInternalOutliner();
1581 pOutl
->Init( OUTLINERMODE_TEXTOBJECT
);
1582 sal_uInt16 nOutlMode
= pOutl
->GetMode();
1584 SvxURLField
aURLField(rURL
, rText
, SVXURLFORMAT_REPR
);
1585 aURLField
.SetTargetFrame(rTarget
);
1586 SvxFieldItem
aURLItem(aURLField
, EE_FEATURE_FIELD
);
1587 pOutl
->QuickInsertField( aURLItem
, ESelection() );
1588 OutlinerParaObject
* pOutlParaObject
= pOutl
->CreateParaObject();
1590 SdrRectObj
* pRectObj
= new SdrRectObj(OBJ_TEXT
);
1592 pOutl
->UpdateFields();
1593 pOutl
->SetUpdateMode( true );
1594 Size
aSize(pOutl
->CalcTextSize());
1595 pOutl
->SetUpdateMode( false );
1605 Rectangle
aRect(aPos
, GetActiveWindow()->GetOutputSizePixel() );
1606 aPos
= aRect
.Center();
1607 aPos
= GetActiveWindow()->PixelToLogic(aPos
);
1608 aPos
.X() -= aSize
.Width() / 2;
1609 aPos
.Y() -= aSize
.Height() / 2;
1612 Rectangle
aLogicRect(aPos
, aSize
);
1613 pRectObj
->SetLogicRect(aLogicRect
);
1614 pRectObj
->SetOutlinerParaObject( pOutlParaObject
);
1615 mpDrawView
->InsertObjectAtView(pRectObj
, *mpDrawView
->GetSdrPageView());
1616 pOutl
->Init( nOutlMode
);
1620 void DrawViewShell::InsertURLButton(const OUString
& rURL
, const OUString
& rText
,
1621 const OUString
& rTarget
, const Point
* pPos
)
1623 bool bNewObj
= true;
1625 const OUString
sTargetURL( ::URIHelper::SmartRel2Abs( INetURLObject( GetDocSh()->GetMedium()->GetBaseURL() ), rURL
, URIHelper::GetMaybeFileHdl(), true, false,
1626 INetURLObject::WAS_ENCODED
,
1627 INetURLObject::DECODE_UNAMBIGUOUS
) );
1628 if (mpDrawView
->GetMarkedObjectList().GetMarkCount() > 0)
1630 SdrObject
* pMarkedObj
= mpDrawView
->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
1631 if( pMarkedObj
) try
1633 // change first marked object
1634 if( (FmFormInventor
== pMarkedObj
->GetObjInventor() && pMarkedObj
->GetObjIdentifier() == OBJ_FM_BUTTON
) )
1638 SdrUnoObj
* pUnoCtrl
= static_cast< SdrUnoObj
* >( pMarkedObj
);
1640 Reference
< awt::XControlModel
> xControlModel( pUnoCtrl
->GetUnoControlModel(), UNO_QUERY_THROW
);
1641 Reference
< beans::XPropertySet
> xPropSet( xControlModel
, UNO_QUERY_THROW
);
1643 xPropSet
->setPropertyValue("Label" , Any( rText
) );
1644 xPropSet
->setPropertyValue("TargetURL" , Any( sTargetURL
) );
1646 if( !rTarget
.isEmpty() )
1647 xPropSet
->setPropertyValue("TargetFrame" , Any( rTarget
) );
1649 xPropSet
->setPropertyValue( "ButtonType" , Any( form::FormButtonType_URL
) );
1650 if ( ::avmedia::MediaWindow::isMediaURL( rURL
, ""/*TODO?*/ ) )
1652 xPropSet
->setPropertyValue( "DispatchURLInternal" , Any( sal_True
) );
1657 // add url as interaction for first selected shape
1660 SdAnimationInfo
* pInfo
= SdDrawDocument::GetShapeUserData(*pMarkedObj
, true);
1661 pInfo
->meClickAction
= presentation::ClickAction_DOCUMENT
;
1662 pInfo
->SetBookmark( sTargetURL
);
1665 catch( uno::Exception
& )
1672 SdrUnoObj
* pUnoCtrl
= static_cast< SdrUnoObj
* >( SdrObjFactory::MakeNewObject(FmFormInventor
, OBJ_FM_BUTTON
,
1673 mpDrawView
->GetSdrPageView()->GetPage(), GetDoc()) );
1675 Reference
< awt::XControlModel
> xControlModel( pUnoCtrl
->GetUnoControlModel(), uno::UNO_QUERY_THROW
);
1676 Reference
< beans::XPropertySet
> xPropSet( xControlModel
, uno::UNO_QUERY_THROW
);
1678 xPropSet
->setPropertyValue( "Label" , Any( OUString( rText
) ) );
1679 xPropSet
->setPropertyValue( "TargetURL" , Any( sTargetURL
) );
1681 if( !rTarget
.isEmpty() )
1682 xPropSet
->setPropertyValue( "TargetFrame" , Any( rTarget
) );
1684 xPropSet
->setPropertyValue( "ButtonType" , Any( form::FormButtonType_URL
) );
1685 if ( ::avmedia::MediaWindow::isMediaURL( rURL
, ""/*TODO?*/ ) )
1686 xPropSet
->setPropertyValue( "DispatchURLInternal" , Any( sal_True
) );
1696 aPos
= Rectangle(aPos
, GetActiveWindow()->GetOutputSizePixel()).Center();
1697 aPos
= GetActiveWindow()->PixelToLogic(aPos
);
1700 Size
aSize(4000, 1000);
1701 aPos
.X() -= aSize
.Width() / 2;
1702 aPos
.Y() -= aSize
.Height() / 2;
1703 pUnoCtrl
->SetLogicRect(Rectangle(aPos
, aSize
));
1705 SdrInsertFlags nOptions
= SdrInsertFlags::SETDEFLAYER
;
1707 OSL_ASSERT (GetViewShell()!=NULL
);
1708 SfxInPlaceClient
* pIpClient
= GetViewShell()->GetIPClient();
1709 if (pIpClient
!=NULL
&& pIpClient
->IsObjectInPlaceActive())
1711 nOptions
|= SdrInsertFlags::DONTMARK
;
1714 mpDrawView
->InsertObjectAtView(pUnoCtrl
, *mpDrawView
->GetSdrPageView(), nOptions
);
1721 void DrawViewShell::ShowUIControls (bool bVisible
)
1723 ViewShell::ShowUIControls (bVisible
);
1724 maTabControl
->Show (bVisible
);
1727 namespace slideshowhelp
1729 void ShowSlideShow(SfxRequest
& rReq
, SdDrawDocument
&rDoc
)
1731 Reference
< XPresentation2
> xPresentation( rDoc
.getPresentation() );
1732 if( xPresentation
.is() )
1734 if (SID_REHEARSE_TIMINGS
== rReq
.GetSlot())
1735 xPresentation
->rehearseTimings();
1736 else if (rDoc
.getPresentationSettings().mbCustomShow
)
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 xPresentation
->start();
1743 else if (SID_PRESENTATION_CURRENT_SLIDE
== rReq
.GetSlot())
1745 //If there is no custom show set, start will automatically
1746 //start at the current page
1747 xPresentation
->start();
1751 //Start at page 0, this would blow away any custom
1752 //show settings if any were set
1753 Sequence
< PropertyValue
> aArguments(1);
1754 PropertyValue aPage
;
1755 OUString
sValue("0");
1757 aPage
.Name
= "FirstPage";
1758 aPage
.Value
<<= sValue
;
1760 aArguments
[0] = aPage
;
1762 xPresentation
->startWithArguments( aArguments
);
1768 void DrawViewShell::ShowSlideShow(SfxRequest
& rReq
)
1770 slideshowhelp::ShowSlideShow(rReq
, *GetDoc());
1773 void DrawViewShell::StopSlideShow (bool /*bCloseFrame*/)
1775 Reference
< XPresentation2
> xPresentation( GetDoc()->getPresentation() );
1776 if(xPresentation
.is() && xPresentation
->isRunning())
1778 if( mpDrawView
->IsTextEdit() )
1779 mpDrawView
->SdrEndTextEdit();
1781 xPresentation
->end();
1785 } // end of namespace sd
1787 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */