1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: drviews2.cxx,v $
10 * $Revision: 1.55.68.2 $
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 "DrawViewShell.hxx"
35 #include "ViewShellImplementation.hxx"
36 #include <vcl/waitobj.hxx>
37 #include <svx/svdograf.hxx>
39 #include <svx/svxids.hrc>
41 #include <svx/svdpagv.hxx>
42 #include <svx/svdundo.hxx>
44 #include <svx/zoomitem.hxx>
47 #include <svx/editdata.hxx>
49 #include <basic/sberrors.hxx>
50 #include <vcl/msgbox.hxx>
51 #include <sfx2/request.hxx>
52 #include <sfx2/dispatch.hxx>
53 #include <svx/xfillit0.hxx>
54 #include <svx/xflclit.hxx>
55 #include <svtools/aeitem.hxx>
56 #include <svx/eeitem.hxx>
57 #include <basic/sbstar.hxx>
58 #include <svx/flditem.hxx>
59 #include <svx/xlineit0.hxx>
60 #include <svx/xfillit0.hxx>
61 #include <svx/svdoole2.hxx>
63 #ifndef _SDOUTL_HXX //autogen
64 #include <svx/svdoutl.hxx>
66 #include <svx/xlnwtit.hxx>
67 #include <svx/svdoattr.hxx>
68 #include <svx/xlnstwit.hxx>
69 #include <svx/sdtmfitm.hxx>
70 #include <svx/sdtagitm.hxx>
71 #include <svx/xlnedwit.hxx>
72 #include <svx/fontworkbar.hxx>
74 #include <svx/svxdlg.hxx>
75 #include <svx/dialogs.hrc>
77 #include <sfx2/viewfrm.hxx>
78 #include "sdgrffilter.hxx"
84 #include "drawview.hxx"
86 #include "drawdoc.hxx"
87 #include "DrawDocShell.hxx"
89 #include "fuscale.hxx"
90 #include "sdresid.hxx"
91 #include "GraphicViewShell.hxx"
92 #include "unmodpg.hxx"
93 #include "slideshow.hxx"
95 #include "stlpool.hxx"
98 #include "optsitem.hxx"
99 #include "sdabstdlg.hxx"
100 #include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
101 #include <com/sun/star/drawing/XDrawPages.hpp>
102 #include <com/sun/star/embed/EmbedVerbs.hpp>
104 #include <strings.hrc>
106 using namespace ::com::sun::star
;
107 using namespace ::com::sun::star::uno
;
111 /*************************************************************************
113 |* modal dialog for #90356#
115 \************************************************************************/
117 class ImpUndoDeleteWarning
: public ModalDialog
121 FixedText maWarningFT
;
122 CheckBox maDisableCB
;
124 CancelButton maNoBtn
;
127 ImpUndoDeleteWarning(Window
* pParent
);
128 BOOL
IsWarningDisabled() const { return maDisableCB
.IsChecked(); }
131 ImpUndoDeleteWarning::ImpUndoDeleteWarning(Window
* pParent
)
132 : ModalDialog(pParent
, SdResId(RID_UNDO_DELETE_WARNING
)),
133 maImage(this, SdResId(IMG_UNDO_DELETE_WARNING
)),
134 maWarningFT(this, SdResId(FT_UNDO_DELETE_WARNING
)),
135 maDisableCB(this, SdResId(CB_UNDO_DELETE_DISABLE
)),
136 maYesBtn(this, SdResId(BTN_UNDO_DELETE_YES
)),
137 maNoBtn(this, SdResId(BTN_UNDO_DELETE_NO
))
141 SetHelpId( HID_SD_UNDODELETEWARNING_DLG
);
142 maDisableCB
.SetHelpId( HID_SD_UNDODELETEWARNING_CBX
);
144 maYesBtn
.SetText(Button::GetStandardText(BUTTON_YES
));
145 maNoBtn
.SetText(Button::GetStandardText(BUTTON_NO
));
146 maImage
.SetImage(WarningBox::GetStandardImage());
148 // #93721# Set focus to YES-Button
149 maYesBtn
.GrabFocus();
153 /*************************************************************************
155 |* SfxRequests fuer temporaere Funktionen
157 \************************************************************************/
159 void DrawViewShell::FuTemporary(SfxRequest
& rReq
)
161 // Waehrend einer Native-Diashow wird nichts ausgefuehrt!
162 if(SlideShow::IsRunning( GetViewShellBase() ) && (rReq
.GetSlot() != SID_NAVIGATOR
))
165 DBG_ASSERT( mpDrawView
, "sd::DrawViewShell::FuTemporary(), no draw view!" );
171 DeactivateCurrentFunction();
173 USHORT nSId
= rReq
.GetSlot();
175 // Slot wird gemapped (ToolboxImages/-Slots)
180 case SID_OUTLINE_TEXT_AUTOFIT
:
182 SfxUndoManager
* pUndoManager
= GetDocSh()->GetUndoManager();
183 SdrObject
* pObj
= NULL
;
184 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
185 if( rMarkList
.GetMarkCount() == 1 )
187 pUndoManager
->EnterListAction( String(), String() );
188 mpDrawView
->BegUndo();
190 pObj
= rMarkList
.GetMark(0)->GetMarkedSdrObj();
191 bool bSet
= ((const SdrTextFitToSizeTypeItem
*)pObj
->GetMergedItemSet().GetItem(SDRATTR_TEXT_FITTOSIZE
))->GetValue() != SDRTEXTFIT_NONE
;
193 mpDrawView
->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj
));
195 pObj
->SetMergedItem(SdrTextFitToSizeTypeItem(bSet
? SDRTEXTFIT_NONE
: SDRTEXTFIT_AUTOFIT
));
197 mpDrawView
->EndUndo();
198 pUndoManager
->LeaveListAction();
205 // Flaechen und Linien-Attribute:
206 // Sollten (wie StateMethode) eine eigene
207 // Execute-Methode besitzen
208 case SID_ATTR_FILL_STYLE
:
209 case SID_ATTR_FILL_COLOR
:
210 case SID_ATTR_FILL_GRADIENT
:
211 case SID_ATTR_FILL_HATCH
:
212 case SID_ATTR_FILL_BITMAP
:
213 case SID_ATTR_FILL_SHADOW
:
215 case SID_ATTR_LINE_STYLE
:
216 case SID_ATTR_LINE_DASH
:
217 case SID_ATTR_LINE_WIDTH
:
218 case SID_ATTR_LINE_COLOR
:
219 case SID_ATTR_LINEEND_STYLE
:
221 case SID_ATTR_TEXT_FITTOSIZE
:
225 BOOL bMergeUndo
= FALSE
;
226 SfxUndoManager
* pUndoManager
= GetDocSh()->GetUndoManager();
228 // Anpassungen Start/EndWidth #63083#
229 if(nSId
== SID_ATTR_LINE_WIDTH
)
231 SdrObject
* pObj
= NULL
;
232 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
233 ULONG nCount
= rMarkList
.GetMarkCount();
235 INT32 nNewLineWidth
= ((const XLineWidthItem
&)rReq
.GetArgs()->Get(XATTR_LINEWIDTH
)).GetValue();
237 for (ULONG i
=0; i
<nCount
; i
++)
239 SfxItemSet
aAttr(GetDoc()->GetPool());
240 pObj
= rMarkList
.GetMark(i
)->GetMarkedSdrObj();
241 aAttr
.Put(pObj
->GetMergedItemSet());
243 INT32 nActLineWidth
= ((const XLineWidthItem
&)aAttr
.Get(XATTR_LINEWIDTH
)).GetValue();
245 if(nActLineWidth
!= nNewLineWidth
)
247 BOOL
bSetItemSet(FALSE
);
249 // #86265# do this for SFX_ITEM_DEFAULT and for SFX_ITEM_SET
250 if(SFX_ITEM_DONTCARE
!= aAttr
.GetItemState(XATTR_LINESTARTWIDTH
))
252 INT32 nValAct
= ((const XLineStartWidthItem
&)aAttr
.Get(XATTR_LINESTARTWIDTH
)).GetValue();
253 INT32 nValNew
= nValAct
+ (((nNewLineWidth
- nActLineWidth
) * 15) / 10);
257 aAttr
.Put(XLineStartWidthItem(nValNew
));
260 // #86265# do this for SFX_ITEM_DEFAULT and for SFX_ITEM_SET
261 if(SFX_ITEM_DONTCARE
!= aAttr
.GetItemState(XATTR_LINEENDWIDTH
))
263 INT32 nValAct
= ((const XLineEndWidthItem
&)aAttr
.Get(XATTR_LINEENDWIDTH
)).GetValue();
264 INT32 nValNew
= nValAct
+ (((nNewLineWidth
- nActLineWidth
) * 15) / 10);
268 aAttr
.Put(XLineEndWidthItem(nValNew
));
272 pObj
->SetMergedItemSet(aAttr
);
277 if (nSId
== SID_ATTR_FILL_SHADOW
)
279 // Ggf. werden transparente Objekte wei?gefuellt
280 SdrObject
* pObj
= NULL
;
281 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
282 ULONG nCount
= rMarkList
.GetMarkCount();
284 const bool bUndo
= mpDrawView
->IsUndoEnabled();
286 for (ULONG i
=0; i
<nCount
; i
++)
288 SfxItemSet
aAttr(GetDoc()->GetPool());
289 pObj
= rMarkList
.GetMark(i
)->GetMarkedSdrObj();
292 if(!pObj
->ISA(SdrGrafObj
))
294 aAttr
.Put(pObj
->GetMergedItemSet());
296 const XFillStyleItem
& rFillStyle
=
297 (const XFillStyleItem
&) aAttr
.Get(XATTR_FILLSTYLE
);
299 if (rFillStyle
.GetValue() == XFILL_NONE
)
303 // Vorlage hat keine Fuellung,
304 // daher hart attributieren: Fuellung setzen
308 pUndoManager
->EnterListAction( String(), String() );
309 mpDrawView
->BegUndo();
312 mpDrawView
->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj
));
315 aAttr
.Put(XFillStyleItem(XFILL_SOLID
));
316 aAttr
.Put(XFillColorItem(String(), COL_WHITE
));
318 pObj
->SetMergedItemSet(aAttr
);
325 mpDrawView
->EndUndo();
329 mpDrawView
->SetAttributes(*rReq
.GetArgs());
333 pUndoManager
->LeaveListAction();
340 switch( rReq
.GetSlot() )
342 case SID_ATTR_FILL_SHADOW
:
343 case SID_ATTR_FILL_STYLE
:
344 case SID_ATTR_FILL_COLOR
:
345 case SID_ATTR_FILL_GRADIENT
:
346 case SID_ATTR_FILL_HATCH
:
347 case SID_ATTR_FILL_BITMAP
:
348 GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_AREA
, SFX_CALLMODE_ASYNCHRON
);
350 case SID_ATTR_LINE_STYLE
:
351 case SID_ATTR_LINE_DASH
:
352 case SID_ATTR_LINE_WIDTH
:
353 case SID_ATTR_LINE_COLOR
:
354 GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_LINE
, SFX_CALLMODE_ASYNCHRON
);
356 case SID_ATTR_TEXT_FITTOSIZE
:
357 GetViewFrame()->GetDispatcher()->Execute( SID_TEXTATTR_DLG
, SFX_CALLMODE_ASYNCHRON
);
365 case SID_HYPHENATION
:
367 // const SfxPoolItem* pItem = rReq.GetArg( SID_HYPHENATION );
368 // ^-- Soll so nicht benutzt werden (Defaults sind falsch) !
369 SFX_REQUEST_ARG( rReq
, pItem
, SfxBoolItem
, SID_HYPHENATION
, FALSE
);
373 SfxItemSet
aSet( GetPool(), EE_PARA_HYPHENATE
, EE_PARA_HYPHENATE
);
374 BOOL bValue
= ( (const SfxBoolItem
*) pItem
)->GetValue();
375 aSet
.Put( SfxBoolItem( EE_PARA_HYPHENATE
, bValue
) );
376 mpDrawView
->SetAttributes( aSet
);
380 DBG_ERROR(" Kein Wert fuer Silbentrennung!");
381 SfxItemSet
aSet( GetPool(), EE_PARA_HYPHENATE
, EE_PARA_HYPHENATE
);
383 aSet
.Put( SfxBoolItem( EE_PARA_HYPHENATE
, bValue
) );
384 mpDrawView
->SetAttributes( aSet
);
392 case SID_INSERTPAGE_QUICK
:
393 case SID_DUPLICATE_PAGE
:
395 SdPage
* pNewPage
= CreateOrDuplicatePage (rReq
, mePageKind
, GetActualPage());
397 if(HasCurrentFunction(SID_BEZIER_EDIT
) )
398 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT
, SFX_CALLMODE_ASYNCHRON
);
399 if (pNewPage
!= NULL
)
400 SwitchPage((pNewPage
->GetPageNum()-1)/2);
405 case SID_INSERT_MASTER_PAGE
:
407 // Use the API to create a new page.
408 Reference
<drawing::XMasterPagesSupplier
> xMasterPagesSupplier (
409 GetDoc()->getUnoModel(), UNO_QUERY
);
410 if (xMasterPagesSupplier
.is())
412 Reference
<drawing::XDrawPages
> xMasterPages (
413 xMasterPagesSupplier
->getMasterPages());
414 if (xMasterPages
.is())
416 USHORT nIndex
= GetCurPageId();
417 xMasterPages
->insertNewByIndex (nIndex
);
419 // Create shapes for the default layout.
420 SdPage
* pMasterPage
= GetDoc()->GetMasterSdPage(
421 nIndex
, PK_STANDARD
);
422 pMasterPage
->CreateTitleAndLayout (TRUE
,TRUE
);
427 if(HasCurrentFunction(SID_BEZIER_EDIT
))
428 GetViewFrame()->GetDispatcher()->Execute(
429 SID_OBJECT_SELECT
, SFX_CALLMODE_ASYNCHRON
);
436 if (mePageKind
==PK_STANDARD
|| mePageKind
==PK_NOTES
||
437 (mePageKind
==PK_HANDOUT
&& meEditMode
==EM_MASTERPAGE
) )
439 if ( mpDrawView
->IsTextEdit() )
441 mpDrawView
->SdrEndTextEdit();
443 USHORT nPage
= maTabControl
.GetCurPageId() - 1;
444 mpActualPage
= GetDoc()->GetSdPage(nPage
, mePageKind
);
445 ::sd::ViewShell::mpImpl
->ProcessModifyPageSlot (
456 case SID_ASSIGN_LAYOUT
:
458 if (mePageKind
==PK_STANDARD
459 || mePageKind
==PK_NOTES
460 || (mePageKind
==PK_HANDOUT
&& meEditMode
==EM_MASTERPAGE
))
462 if ( mpDrawView
->IsTextEdit() )
463 mpDrawView
->SdrEndTextEdit();
465 SFX_REQUEST_ARG (rReq
, pWhatPage
, SfxUInt32Item
, ID_VAL_WHATPAGE
, FALSE
);
466 SFX_REQUEST_ARG (rReq
, pWhatLayout
, SfxUInt32Item
, ID_VAL_WHATLAYOUT
, FALSE
);
467 ::sd::ViewShell::mpImpl
->AssignLayout (
468 GetDoc()->GetSdPage((USHORT
)pWhatPage
->GetValue(), mePageKind
),
469 (AutoLayout
)pWhatLayout
->GetValue());
477 case SID_RENAME_MASTER_PAGE
:
479 if (mePageKind
==PK_STANDARD
|| mePageKind
==PK_NOTES
)
481 if ( mpDrawView
->IsTextEdit() )
483 mpDrawView
->SdrEndTextEdit();
486 USHORT nPageId
= maTabControl
.GetCurPageId();
487 SdPage
* pCurrentPage
= ( GetEditMode() == EM_PAGE
)
488 ? GetDoc()->GetSdPage( nPageId
- 1, GetPageKind() )
489 : GetDoc()->GetMasterSdPage( nPageId
- 1, GetPageKind() );
491 String
aTitle( SdResId( STR_TITLE_RENAMESLIDE
) );
492 String
aDescr( SdResId( STR_DESC_RENAMESLIDE
) );
493 String aPageName
= pCurrentPage
->GetName();
495 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
496 DBG_ASSERT(pFact
, "Dialogdiet fail!");
497 AbstractSvxNameDialog
* aNameDlg
= pFact
->CreateSvxNameDialog( GetActiveWindow(), aPageName
, aDescr
, RID_SVXDLG_NAME
);
498 DBG_ASSERT(aNameDlg
, "Dialogdiet fail!");
499 aNameDlg
->SetText( aTitle
);
500 aNameDlg
->SetCheckNameHdl( LINK( this, DrawViewShell
, RenameSlideHdl
), true );
501 aNameDlg
->SetEditHelpId( HID_SD_NAMEDIALOG_PAGE
);
503 if( aNameDlg
->Execute() == RET_OK
)
506 aNameDlg
->GetName( aNewName
);
507 if( ! aNewName
.Equals( aPageName
) )
512 RenameSlide( nPageId
, aNewName
);
513 DBG_ASSERT( bResult
, "Couldn't rename slide" );
524 case SID_RENAMEPAGE_QUICK
:
526 if (mePageKind
==PK_STANDARD
|| mePageKind
==PK_NOTES
)
528 if ( mpDrawView
->IsTextEdit() )
530 mpDrawView
->SdrEndTextEdit();
533 maTabControl
.StartEditMode( maTabControl
.GetCurPageId() );
541 case SID_PAGESIZE
: // entweder dieses (kein menueeintrag o. ae. !!)
543 const SfxItemSet
*pArgs
= rReq
.GetArgs ();
546 if (pArgs
->Count () == 3)
548 SFX_REQUEST_ARG (rReq
, pWidth
, SfxUInt32Item
, ID_VAL_PAGEWIDTH
, FALSE
);
549 SFX_REQUEST_ARG (rReq
, pHeight
, SfxUInt32Item
, ID_VAL_PAGEHEIGHT
, FALSE
);
550 SFX_REQUEST_ARG (rReq
, pScaleAll
, SfxBoolItem
, ID_VAL_SCALEOBJECTS
, FALSE
);
552 Size
aSize (pWidth
->GetValue (), pHeight
->GetValue ());
554 SetupPage (aSize
, 0, 0, 0, 0, TRUE
, FALSE
, pScaleAll
->GetValue ());
559 StarBASIC::FatalError (SbERR_WRONG_ARGS
);
564 case SID_PAGEMARGIN
: // oder dieses (kein menueeintrag o. ae. !!)
566 const SfxItemSet
*pArgs
= rReq
.GetArgs ();
569 if (pArgs
->Count () == 5)
571 SFX_REQUEST_ARG (rReq
, pLeft
, SfxUInt32Item
, ID_VAL_PAGELEFT
, FALSE
);
572 SFX_REQUEST_ARG (rReq
, pRight
, SfxUInt32Item
, ID_VAL_PAGERIGHT
, FALSE
);
573 SFX_REQUEST_ARG (rReq
, pUpper
, SfxUInt32Item
, ID_VAL_PAGETOP
, FALSE
);
574 SFX_REQUEST_ARG (rReq
, pLower
, SfxUInt32Item
, ID_VAL_PAGEBOTTOM
, FALSE
);
575 SFX_REQUEST_ARG (rReq
, pScaleAll
, SfxBoolItem
, ID_VAL_SCALEOBJECTS
, FALSE
);
577 Size
aEmptySize (0, 0);
579 SetupPage (aEmptySize
, pLeft
->GetValue (), pRight
->GetValue (),
580 pUpper
->GetValue (), pLower
->GetValue (),
581 FALSE
, TRUE
, pScaleAll
->GetValue ());
586 StarBASIC::FatalError (SbERR_WRONG_ARGS
);
591 case SID_ATTR_ZOOMSLIDER
:
593 const SfxItemSet
* pArgs
= rReq
.GetArgs();
595 if (pArgs
&& pArgs
->Count () == 1 )
597 SFX_REQUEST_ARG (rReq
, pScale
, SfxUInt16Item
, SID_ATTR_ZOOMSLIDER
, FALSE
);
598 if (CHECK_RANGE (5, pScale
->GetValue (), 3000))
600 SetZoom (pScale
->GetValue ());
602 SfxBindings
& rBindings
= GetViewFrame()->GetBindings();
603 rBindings
.Invalidate( SID_ATTR_ZOOM
);
604 rBindings
.Invalidate( SID_ZOOM_IN
);
605 rBindings
.Invalidate( SID_ZOOM_OUT
);
606 rBindings
.Invalidate( SID_ATTR_ZOOMSLIDER
);
615 case SID_ZOOMING
: // kein Menueintrag, sondern aus dem Zoomdialog generiert
617 const SfxItemSet
* pArgs
= rReq
.GetArgs();
620 if (pArgs
->Count () == 1)
622 SFX_REQUEST_ARG (rReq
, pScale
, SfxUInt32Item
, ID_VAL_ZOOM
, FALSE
);
623 if (CHECK_RANGE (10, pScale
->GetValue (), 1000))
625 SetZoom (pScale
->GetValue ());
627 SfxBindings
& rBindings
= GetViewFrame()->GetBindings();
628 rBindings
.Invalidate( SID_ATTR_ZOOM
);
629 rBindings
.Invalidate( SID_ZOOM_IN
);
630 rBindings
.Invalidate( SID_ZOOM_OUT
);
631 rBindings
.Invalidate( SID_ATTR_ZOOMSLIDER
);
633 else StarBASIC::FatalError (SbERR_BAD_PROP_VALUE
);
639 StarBASIC::FatalError (SbERR_WRONG_ARGS
);
646 const SfxItemSet
* pArgs
= rReq
.GetArgs();
647 mbZoomOnPage
= FALSE
;
651 SvxZoomType eZT
= ( ( const SvxZoomItem
& ) pArgs
->
652 Get( SID_ATTR_ZOOM
) ).GetType();
655 case SVX_ZOOM_PERCENT
:
656 SetZoom( (long) ( ( const SvxZoomItem
& ) pArgs
->
657 Get( SID_ATTR_ZOOM
) ).GetValue() );
660 case SVX_ZOOM_OPTIMAL
:
661 GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_ALL
,
662 SFX_CALLMODE_ASYNCHRON
| SFX_CALLMODE_RECORD
);
665 case SVX_ZOOM_PAGEWIDTH
:
666 GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE_WIDTH
,
667 SFX_CALLMODE_ASYNCHRON
| SFX_CALLMODE_RECORD
);
670 case SVX_ZOOM_WHOLEPAGE
:
671 GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE
,
672 SFX_CALLMODE_ASYNCHRON
| SFX_CALLMODE_RECORD
);
674 case SVX_ZOOM_PAGEWIDTH_NOBORDER
:
675 DBG_ERROR("sd::DrawViewShell::FuTemporary(), SVX_ZOOM_PAGEWIDTH_NOBORDER not handled!" );
682 // hier den Zoom-Dialog oeffnen
683 SetCurrentFunction( FuScale::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
689 case SID_CHANGEBEZIER
:
690 case SID_CHANGEPOLYGON
:
691 if ( mpDrawView
->IsTextEdit() )
693 mpDrawView
->SdrEndTextEdit();
694 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT
, SFX_CALLMODE_ASYNCHRON
);
697 if ( mpDrawView
->IsPresObjSelected() )
699 ::sd::Window
* pWindow
= GetActiveWindow();
700 InfoBox(pWindow
, String(SdResId(STR_ACTION_NOTPOSSIBLE
) ) ).Execute();
704 if( rReq
.GetSlot() == SID_CHANGEBEZIER
)
706 WaitObject
aWait( (Window
*)GetActiveWindow() );
707 mpDrawView
->ConvertMarkedToPathObj(FALSE
);
711 if( mpDrawView
->IsVectorizeAllowed() )
712 SetCurrentFunction( FuVectorize::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
715 WaitObject
aWait( (Window
*)GetActiveWindow() );
716 mpDrawView
->ConvertMarkedToPolyObj(FALSE
);
720 Invalidate(SID_CHANGEBEZIER
);
721 Invalidate(SID_CHANGEPOLYGON
);
725 if( HasCurrentFunction(SID_BEZIER_EDIT
) )
726 { // ggf. die richtige Editfunktion aktivieren
727 GetViewFrame()->GetDispatcher()->Execute(SID_SWITCH_POINTEDIT
,
728 SFX_CALLMODE_ASYNCHRON
| SFX_CALLMODE_RECORD
);
733 case SID_CONVERT_TO_CONTOUR
:
734 if ( mpDrawView
->IsTextEdit() )
736 mpDrawView
->SdrEndTextEdit();
737 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT
, SFX_CALLMODE_ASYNCHRON
);
740 if ( mpDrawView
->IsPresObjSelected() )
742 ::sd::Window
* pWindow
= GetActiveWindow();
743 InfoBox(pWindow
, String(SdResId(STR_ACTION_NOTPOSSIBLE
) ) ).Execute();
747 WaitObject
aWait( (Window
*)GetActiveWindow() );
748 mpDrawView
->ConvertMarkedToPathObj(TRUE
);
750 Invalidate(SID_CONVERT_TO_CONTOUR
);
757 case SID_CONVERT_TO_METAFILE
:
758 case SID_CONVERT_TO_BITMAP
:
760 // End text edit mode when it is active because the metafile or
761 // bitmap that will be created does not support it.
762 if ( mpDrawView
->IsTextEdit() )
764 mpDrawView
->SdrEndTextEdit();
765 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT
, SFX_CALLMODE_ASYNCHRON
);
768 if ( mpDrawView
->IsPresObjSelected(true,true,true) )
770 ::sd::Window
* pWindow
= GetActiveWindow();
771 InfoBox(pWindow
, String(SdResId(STR_ACTION_NOTPOSSIBLE
) ) ).Execute();
775 WaitObject
aWait( (Window
*)GetActiveWindow() );
777 // switch on undo for the next operations
780 SdResId (nSId
==SID_CONVERT_TO_METAFILE
? STR_UNDO_CONVERT_TO_METAFILE
: STR_UNDO_CONVERT_TO_BITMAP
)));
782 // create SdrGrafObj from metafile/bitmap
786 case SID_CONVERT_TO_METAFILE
:
788 GDIMetaFile
aMetaFile(mpDrawView
->GetAllMarkedMetaFile ());
789 aGraphic
= Graphic(aMetaFile
);
792 case SID_CONVERT_TO_BITMAP
:
794 Bitmap
aBitmap (mpDrawView
->GetAllMarkedBitmap ());
795 aGraphic
= Graphic(aBitmap
);
801 SdrGrafObj
* pGraphicObj
= new SdrGrafObj (aGraphic
);
803 // get some necessary info and ensure it
804 const SdrMarkList
& rMarkList(mpDrawView
->GetMarkedObjectList());
805 const sal_uInt32
nMarkCount(rMarkList
.GetMarkCount());
806 SdrPageView
* pPageView
= mpDrawView
->GetSdrPageView();
807 OSL_ENSURE(nMarkCount
, "DrawViewShell::FuTemporary: SID_CONVERT_TO_BITMAP with empty selection (!)");
808 OSL_ENSURE(pPageView
, "DrawViewShell::FuTemporary: SID_CONVERT_TO_BITMAP without SdrPageView (!)");
810 // fit rectangle of new graphic object to selection's mark rect
811 Rectangle aAllMarkedRect
;
812 rMarkList
.TakeBoundRect(pPageView
, aAllMarkedRect
);
813 pGraphicObj
->SetLogicRect(aAllMarkedRect
);
815 // #i71540# to keep the order, it is necessary to replace the lowest object
816 // of the selection with the new object. This also means that with multi
817 // selection, all other objects need to be deleted first
818 SdrMark
* pFirstMark
= rMarkList
.GetMark(0L);
819 SdrObject
* pReplacementCandidate
= pFirstMark
->GetMarkedSdrObj();
823 // take first object out of selection
824 mpDrawView
->MarkObj(pReplacementCandidate
, pPageView
, true, true);
826 // clear remaining selection
827 mpDrawView
->DeleteMarkedObj();
830 // now replace lowest object with new one
831 mpDrawView
->ReplaceObjectAtView(pReplacementCandidate
, *pPageView
, pGraphicObj
);
834 mpDrawView
->EndUndo();
843 case SID_SET_DEFAULT
:
845 SfxItemSet
* pSet
= NULL
;
847 if (mpDrawView
->IsTextEdit())
849 ::Outliner
* pOutl
= mpDrawView
->GetTextEditOutliner();
852 pOutl
->RemoveFields(TRUE
, (TypeId
) SvxURLField::StaticType());
855 pSet
= new SfxItemSet( GetPool(), EE_ITEMS_START
, EE_ITEMS_END
);
856 mpDrawView
->SetAttributes( *pSet
, TRUE
);
860 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
861 ULONG nCount
= rMarkList
.GetMarkCount();
863 // In diese Liste werden fuer jedes Praesentationsobjekt ein SfxItemSet
864 // der harten Attribute sowie der UserCall eingetragen, da diese beim nachfolgenden
865 // mpDrawView->SetAttributes( *pSet, TRUE ) verloren gehen und spaeter restauriert
867 List
* pAttrList
= new List();
868 SdPage
* pPresPage
= (SdPage
*) mpDrawView
->GetSdrPageView()->GetPage();
871 for ( i
= 0; i
< nCount
; i
++ )
873 SdrObject
* pObj
= rMarkList
.GetMark(i
)->GetMarkedSdrObj();
875 if( pPresPage
->IsPresObj( pObj
) )
877 SfxItemSet
* pNewSet
= new SfxItemSet( GetDoc()->GetPool(), SDRATTR_TEXT_MINFRAMEHEIGHT
, SDRATTR_TEXT_AUTOGROWHEIGHT
, 0 );
878 pNewSet
->Put(pObj
->GetMergedItemSet());
879 pAttrList
->Insert( pNewSet
, LIST_APPEND
);
880 pAttrList
->Insert( pObj
->GetUserCall(), LIST_APPEND
);
884 pSet
= new SfxItemSet( GetPool() );
885 mpDrawView
->SetAttributes( *pSet
, TRUE
);
889 for ( i
= 0; i
< nCount
; i
++ )
891 SfxStyleSheet
* pSheet
= NULL
;
892 SdrObject
* pObj
= rMarkList
.GetMark(i
)->GetMarkedSdrObj();
894 if (pObj
->GetObjIdentifier() == OBJ_TITLETEXT
)
896 pSheet
= mpActualPage
->GetStyleSheetForPresObj(PRESOBJ_TITLE
);
898 pObj
->SetStyleSheet(pSheet
, FALSE
);
900 else if(pObj
->GetObjIdentifier() == OBJ_OUTLINETEXT
)
902 for (USHORT nLevel
= 1; nLevel
< 10; nLevel
++)
904 pSheet
= mpActualPage
->GetStyleSheetForPresObj( PRESOBJ_OUTLINE
);
905 DBG_ASSERT(pSheet
, "Vorlage fuer Gliederungsobjekt nicht gefunden");
908 pObj
->StartListening(*pSheet
);
911 // Textrahmen hoert auf StyleSheet der Ebene1
912 pObj
->NbcSetStyleSheet(pSheet
, FALSE
);
918 if( pPresPage
->IsPresObj( pObj
) )
920 SfxItemSet
* pNewSet
= (SfxItemSet
*) pAttrList
->GetObject(j
++);
921 SdrObjUserCall
* pUserCall
= (SdrObjUserCall
*) pAttrList
->GetObject(j
++);
923 if ( pNewSet
&& pNewSet
->GetItemState( SDRATTR_TEXT_MINFRAMEHEIGHT
) == SFX_ITEM_ON
)
925 pObj
->SetMergedItem(pNewSet
->Get(SDRATTR_TEXT_MINFRAMEHEIGHT
));
928 if ( pNewSet
&& pNewSet
->GetItemState( SDRATTR_TEXT_AUTOGROWHEIGHT
) == SFX_ITEM_ON
)
930 pObj
->SetMergedItem(pNewSet
->Get(SDRATTR_TEXT_AUTOGROWHEIGHT
));
934 pObj
->SetUserCall( pUserCall
);
948 case SID_DELETE_SNAPITEM
:
951 Point aMPos
= GetActiveWindow()->PixelToLogic( maMousePos
);
952 USHORT nHitLog
= (USHORT
) GetActiveWindow()->PixelToLogic( Size(
953 FuPoor::HITPIX
, 0 ) ).Width();
956 mbMousePosFreezed
= FALSE
;
958 if( mpDrawView
->PickHelpLine( aMPos
, nHitLog
, *GetActiveWindow(), nHelpLine
, pPV
) )
960 pPV
->DeleteHelpLine( nHelpLine
);
967 case SID_DELETE_PAGE
:
968 case SID_DELETE_MASTER_PAGE
:
974 case SID_DELETE_LAYER
:
980 case SID_ORIGINAL_SIZE
:
981 mpDrawView
->SetMarkedOriginalSize();
986 case SID_DRAW_FONTWORK
:
987 case SID_DRAW_FONTWORK_VERTICAL
:
989 svx::FontworkBar::execute( mpView
, rReq
, GetViewFrame()->GetBindings() ); // SJ: can be removed (I think)
995 case SID_SAVEGRAPHIC
:
997 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
998 if( rMarkList
.GetMarkCount() == 1 )
1000 SdrGrafObj
*pGrafObj
= dynamic_cast< SdrGrafObj
* >( rMarkList
.GetMark( 0 )->GetMarkedSdrObj() );
1003 ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
> xShape( pGrafObj
->getUnoShape(), com::sun::star::uno::UNO_QUERY
);
1004 SdGRFFilter::SaveGraphic( xShape
);
1012 case SID_INPLACE_OBJECT
:
1013 case SID_OUTPLACE_OBJECT
:
1015 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
1016 if( rMarkList
.GetMarkCount() == 1 )
1018 SdrOle2Obj
*pOleObj
= dynamic_cast< SdrOle2Obj
* >( rMarkList
.GetMark( 0 )->GetMarkedSdrObj() );
1019 if( pOleObj
&& !GetDocSh()->IsUIActive() )
1021 if( SID_OUTPLACE_OBJECT
== nSId
)
1022 ActivateObject( pOleObj
, embed::EmbedVerbs::MS_OLEVERB_OPEN
);
1024 ActivateObject( pOleObj
, embed::EmbedVerbs::MS_OLEVERB_PRIMARY
);
1034 // switch Anweisung wegen CLOOKS aufgeteilt. Alle case-Anweisungen die
1035 // eine Fu???? -Funktion aufrufen, sind in die Methode FuTemp01 (drviews8)
1042 if(HasCurrentFunction())
1044 GetCurrentFunction()->Activate();
1051 /** This method consists basically of three parts:
1052 1. Process the arguments of the SFX request.
1053 2. Use the model to create a new page or duplicate an existing one.
1054 3. Update the tab control and switch to the new page.
1056 SdPage
* DrawViewShell::CreateOrDuplicatePage (
1057 SfxRequest
& rRequest
,
1061 SdPage
* pNewPage
= NULL
;
1062 if (ePageKind
== PK_STANDARD
&& meEditMode
!= EM_MASTERPAGE
)
1064 if ( mpDrawView
->IsTextEdit() )
1066 mpDrawView
->SdrEndTextEdit();
1068 pNewPage
= ViewShell::CreateOrDuplicatePage (rRequest
, ePageKind
, pPage
);
1073 } // end of namespace sd