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 <config_features.h>
22 #include <avmedia/mediaplayer.hxx>
24 #include <basic/sberrors.hxx>
25 #include <basic/sbstar.hxx>
27 #include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
28 #include <com/sun/star/drawing/XDrawPages.hpp>
29 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
30 #include <com/sun/star/ui/dialogs/XSLTFilterDialog.hpp>
31 #include <com/sun/star/frame/XDispatchProvider.hpp>
32 #include <com/sun/star/util/URLTransformer.hpp>
33 #include <com/sun/star/util/XURLTransformer.hpp>
35 #include <comphelper/processfactory.hxx>
37 #include <editeng/editdata.hxx>
38 #include <editeng/eeitem.hxx>
39 #include <editeng/flditem.hxx>
41 #include <sfx2/bindings.hxx>
42 #include <sfx2/dispatch.hxx>
43 #include <sfx2/docfile.hxx>
44 #include <sfx2/msgpool.hxx>
45 #include <sfx2/request.hxx>
46 #include <sfx2/viewfrm.hxx>
47 #include <sfx2/zoomitem.hxx>
49 #include <svl/aeitem.hxx>
51 #include <svx/SpellDialogChildWindow.hxx>
52 #include <svx/compressgraphicdialog.hxx>
53 #include <svx/dialogs.hrc>
54 #include <svx/bmpmask.hxx>
55 #include <svx/colrctrl.hxx>
56 #include <svx/extedit.hxx>
57 #include <svx/extrusionbar.hxx>
58 #include <svx/f3dchild.hxx>
59 #include <svx/fontwork.hxx>
60 #include <svx/fontworkbar.hxx>
61 #include <svx/graphichelper.hxx>
62 #include <svx/hlnkitem.hxx>
63 #include <svx/imapdlg.hxx>
64 #include <svx/sdtagitm.hxx>
65 #include <svx/sdtmfitm.hxx>
66 #include <svx/svdoattr.hxx>
67 #include <svx/svdograf.hxx>
68 #include <svx/svdoole2.hxx>
69 #include <svx/svdoutl.hxx>
70 #include <svx/svdpagv.hxx>
71 #include <svx/svdundo.hxx>
72 #include <svx/svxdlg.hxx>
73 #include <svx/svxids.hrc>
74 #include <svx/xfillit0.hxx>
75 #include <svx/xflclit.hxx>
76 #include <svx/xlineit0.hxx>
77 #include <svx/xlnedwit.hxx>
78 #include <svx/xlnstwit.hxx>
79 #include <svx/xlnwtit.hxx>
81 #include <tools/diagnose_ex.h>
83 #include <unotools/useroptions.hxx>
85 #include <vcl/graph.hxx>
86 #include <vcl/msgbox.hxx>
87 #include <vcl/svapp.hxx>
88 #include <vcl/waitobj.hxx>
90 #include <editeng/escapementitem.hxx>
91 #include <editeng/kernitem.hxx>
92 #include <editeng/wghtitem.hxx>
93 #include <editeng/postitem.hxx>
94 #include <editeng/udlnitem.hxx>
95 #include <editeng/crossedoutitem.hxx>
96 #include <editeng/contouritem.hxx>
97 #include <editeng/shdditem.hxx>
98 #include <svx/xtable.hxx>
99 #include <svx/svdobj.hxx>
100 #include <svx/SvxColorChildWindow.hxx>
101 #include <editeng/outlobj.hxx>
102 #include <editeng/flstitem.hxx>
103 #include <editeng/scripttypeitem.hxx>
104 #include <editeng/fontitem.hxx>
105 #include <editeng/fhgtitem.hxx>
106 #include <editeng/colritem.hxx>
107 #include <editeng/brushitem.hxx>
109 #include <svl/whiter.hxx>
113 #include "strings.hrc"
115 #include "framework/FrameworkHelper.hxx"
117 #include "AnimationChildWindow.hxx"
118 #include "DrawDocShell.hxx"
119 #include "DrawViewShell.hxx"
120 #include "GraphicViewShell.hxx"
121 #include "LayerTabBar.hxx"
122 #include "Outliner.hxx"
123 #include "ViewShellHint.hxx"
124 #include "ViewShellImplementation.hxx"
125 #include "Window.hxx"
126 #include "drawdoc.hxx"
127 #include "drawview.hxx"
128 #include "fuarea.hxx"
129 #include "fubullet.hxx"
130 #include "fuchar.hxx"
131 #include "fucushow.hxx"
132 #include "fuconnct.hxx"
133 #include "fucopy.hxx"
134 #include "fudspord.hxx"
135 #include "fuexpand.hxx"
136 #include "fuinsert.hxx"
137 #include "fuinsfil.hxx"
138 #include "fuline.hxx"
139 #include "fulinend.hxx"
140 #include "fulink.hxx"
141 #include "fumeasur.hxx"
142 #include "fumorph.hxx"
143 #include "fuoaprms.hxx"
144 #include "fuolbull.hxx"
145 #include "fupage.hxx"
146 #include "fuparagr.hxx"
147 #include "fuprlout.hxx"
148 #include "fuscale.hxx"
150 #include "fusldlg.hxx"
151 #include "fusnapln.hxx"
152 #include "fusumry.hxx"
153 #include "futempl.hxx"
154 #include "futhes.hxx"
155 #include "futransf.hxx"
156 #include "futxtatt.hxx"
157 #include "fuvect.hxx"
158 #include "futext.hxx"
160 #include "optsitem.hxx"
161 #include "sdabstdlg.hxx"
162 #include "sdattr.hxx"
163 #include "sdgrffilter.hxx"
164 #include "sdpage.hxx"
165 #include "sdresid.hxx"
166 #include "slideshow.hxx"
167 #include "stlpool.hxx"
168 #include "undolayer.hxx"
169 #include "unmodpg.hxx"
170 #include <sfx2/sidebar/Sidebar.hxx>
172 #include "ViewShellBase.hxx"
173 #include <boost/scoped_ptr.hpp>
176 const char CustomAnimationPanelId
[] = "CustomAnimationPanel";
177 const char SlideTransitionPanelId
[] = "SlideTransitionPanel";
178 const char GalleryPanelId
[] = "GalleryPanel";
181 using namespace ::com::sun::star
;
182 using namespace ::com::sun::star::uno
;
184 #define MIN_ACTIONS_FOR_DIALOG 5000 ///< if there are more meta objects, we show a dialog during the break up
189 * SfxRequests for temporary actions
192 void DrawViewShell::FuTemporary(SfxRequest
& rReq
)
194 // during a native slide show nothing gets executed!
195 if(SlideShow::IsRunning( GetViewShellBase() ) && (rReq
.GetSlot() != SID_NAVIGATOR
))
198 DBG_ASSERT( mpDrawView
, "sd::DrawViewShell::FuTemporary(), no draw view!" );
204 DeactivateCurrentFunction();
206 sal_uInt16 nSId
= rReq
.GetSlot();
208 // Slot gets mapped (ToolboxImages/-Slots)
213 case SID_OUTLINE_TEXT_AUTOFIT
:
215 ::svl::IUndoManager
* pUndoManager
= GetDocSh()->GetUndoManager();
216 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
217 if( rMarkList
.GetMarkCount() == 1 )
219 pUndoManager
->EnterListAction("", "");
220 mpDrawView
->BegUndo();
222 SdrObject
* pObj
= rMarkList
.GetMark(0)->GetMarkedSdrObj();
223 bool bSet
= static_cast<const SdrTextFitToSizeTypeItem
*>(pObj
->GetMergedItemSet().GetItem(SDRATTR_TEXT_FITTOSIZE
))->GetValue() != SDRTEXTFIT_NONE
;
225 mpDrawView
->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj
));
227 pObj
->SetMergedItem(SdrTextFitToSizeTypeItem(bSet
? SDRTEXTFIT_NONE
: SDRTEXTFIT_AUTOFIT
));
229 mpDrawView
->EndUndo();
230 pUndoManager
->LeaveListAction();
237 // area and line attributes: shall have
238 // an own Execute method (like StateMethode)
239 case SID_ATTR_FILL_STYLE
:
240 case SID_ATTR_FILL_COLOR
:
241 case SID_ATTR_FILL_GRADIENT
:
242 case SID_ATTR_FILL_HATCH
:
243 case SID_ATTR_FILL_BITMAP
:
244 case SID_ATTR_FILL_SHADOW
:
245 case SID_ATTR_FILL_TRANSPARENCE
:
246 case SID_ATTR_FILL_FLOATTRANSPARENCE
:
248 case SID_ATTR_LINE_STYLE
:
249 case SID_ATTR_LINE_DASH
:
250 case SID_ATTR_LINE_WIDTH
:
251 case SID_ATTR_LINE_COLOR
:
252 case SID_ATTR_LINEEND_STYLE
:
253 case SID_ATTR_LINE_START
:
254 case SID_ATTR_LINE_END
:
255 case SID_ATTR_LINE_TRANSPARENCE
:
256 case SID_ATTR_LINE_JOINT
:
257 case SID_ATTR_LINE_CAP
:
259 case SID_ATTR_TEXT_FITTOSIZE
:
263 mpDrawView
->SetAttributes(*rReq
.GetArgs());
268 switch( rReq
.GetSlot() )
270 case SID_ATTR_FILL_SHADOW
:
271 case SID_ATTR_FILL_STYLE
:
272 case SID_ATTR_FILL_COLOR
:
273 case SID_ATTR_FILL_GRADIENT
:
274 case SID_ATTR_FILL_HATCH
:
275 case SID_ATTR_FILL_BITMAP
:
276 case SID_ATTR_FILL_TRANSPARENCE
:
277 case SID_ATTR_FILL_FLOATTRANSPARENCE
:
278 GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_AREA
, SfxCallMode::ASYNCHRON
);
280 case SID_ATTR_LINE_STYLE
:
281 case SID_ATTR_LINE_DASH
:
282 case SID_ATTR_LINE_WIDTH
:
283 case SID_ATTR_LINE_COLOR
:
284 case SID_ATTR_LINE_TRANSPARENCE
:
285 case SID_ATTR_LINE_JOINT
:
286 case SID_ATTR_LINE_CAP
:
287 GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_LINE
, SfxCallMode::ASYNCHRON
);
289 case SID_ATTR_TEXT_FITTOSIZE
:
290 GetViewFrame()->GetDispatcher()->Execute( SID_TEXTATTR_DLG
, SfxCallMode::ASYNCHRON
);
298 case SID_HYPHENATION
:
300 // const SfxPoolItem* pItem = rReq.GetArg( SID_HYPHENATION );
301 // ^-- should not be used (defaults are wrong) !
302 SFX_REQUEST_ARG( rReq
, pItem
, SfxBoolItem
, SID_HYPHENATION
, false);
306 SfxItemSet
aSet( GetPool(), EE_PARA_HYPHENATE
, EE_PARA_HYPHENATE
);
307 bool bValue
= pItem
->GetValue();
308 aSet
.Put( SfxBoolItem( EE_PARA_HYPHENATE
, bValue
) );
309 mpDrawView
->SetAttributes( aSet
);
311 else // only for testing purpose
313 OSL_FAIL(" no value for hyphenation!");
314 SfxItemSet
aSet( GetPool(), EE_PARA_HYPHENATE
, EE_PARA_HYPHENATE
);
316 aSet
.Put( SfxBoolItem( EE_PARA_HYPHENATE
, bValue
) );
317 mpDrawView
->SetAttributes( aSet
);
325 case SID_INSERTPAGE_QUICK
:
326 case SID_DUPLICATE_PAGE
:
328 SdPage
* pNewPage
= CreateOrDuplicatePage (rReq
, mePageKind
, GetActualPage());
330 if(HasCurrentFunction(SID_BEZIER_EDIT
) )
331 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT
, SfxCallMode::ASYNCHRON
);
332 if (pNewPage
!= NULL
)
333 SwitchPage((pNewPage
->GetPageNum()-1)/2);
338 case SID_INSERT_MASTER_PAGE
:
340 // Use the API to create a new page.
341 Reference
<drawing::XMasterPagesSupplier
> xMasterPagesSupplier (
342 GetDoc()->getUnoModel(), UNO_QUERY
);
343 if (xMasterPagesSupplier
.is())
345 Reference
<drawing::XDrawPages
> xMasterPages (
346 xMasterPagesSupplier
->getMasterPages());
347 if (xMasterPages
.is())
349 sal_uInt16 nIndex
= GetCurPageId();
350 xMasterPages
->insertNewByIndex (nIndex
);
352 // Create shapes for the default layout.
353 SdPage
* pMasterPage
= GetDoc()->GetMasterSdPage(
354 nIndex
, PK_STANDARD
);
355 pMasterPage
->CreateTitleAndLayout (true,true);
360 if(HasCurrentFunction(SID_BEZIER_EDIT
))
361 GetViewFrame()->GetDispatcher()->Execute(
362 SID_OBJECT_SELECT
, SfxCallMode::ASYNCHRON
);
369 if (mePageKind
==PK_STANDARD
|| mePageKind
==PK_NOTES
||
370 (mePageKind
==PK_HANDOUT
&& meEditMode
==EM_MASTERPAGE
) )
372 if ( mpDrawView
->IsTextEdit() )
374 mpDrawView
->SdrEndTextEdit();
376 sal_uInt16 nPage
= maTabControl
->GetCurPageId() - 1;
377 mpActualPage
= GetDoc()->GetSdPage(nPage
, mePageKind
);
378 ::sd::ViewShell::mpImpl
->ProcessModifyPageSlot (
389 case SID_ASSIGN_LAYOUT
:
391 if (mePageKind
==PK_STANDARD
|| mePageKind
==PK_NOTES
|| (mePageKind
==PK_HANDOUT
&& meEditMode
==EM_MASTERPAGE
))
393 if ( mpDrawView
->IsTextEdit() )
394 mpDrawView
->SdrEndTextEdit();
396 ::sd::ViewShell::mpImpl
->AssignLayout(rReq
, mePageKind
);
404 case SID_RENAME_MASTER_PAGE
:
406 if (mePageKind
==PK_STANDARD
|| mePageKind
==PK_NOTES
)
408 if ( mpDrawView
->IsTextEdit() )
410 mpDrawView
->SdrEndTextEdit();
413 sal_uInt16 nPageId
= maTabControl
->GetCurPageId();
414 SdPage
* pCurrentPage
= ( GetEditMode() == EM_PAGE
)
415 ? GetDoc()->GetSdPage( nPageId
- 1, GetPageKind() )
416 : GetDoc()->GetMasterSdPage( nPageId
- 1, GetPageKind() );
418 OUString aTitle
= SD_RESSTR(STR_TITLE_RENAMESLIDE
);
419 OUString aDescr
= SD_RESSTR(STR_DESC_RENAMESLIDE
);
420 OUString aPageName
= pCurrentPage
->GetName();
422 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
423 DBG_ASSERT(pFact
, "Dialog creation failed!");
424 boost::scoped_ptr
<AbstractSvxNameDialog
> aNameDlg(pFact
->CreateSvxNameDialog( GetActiveWindow(), aPageName
, aDescr
));
425 DBG_ASSERT(aNameDlg
, "Dialog creation failed!");
426 aNameDlg
->SetText( aTitle
);
427 aNameDlg
->SetCheckNameHdl( LINK( this, DrawViewShell
, RenameSlideHdl
), true );
428 aNameDlg
->SetEditHelpId( HID_SD_NAMEDIALOG_PAGE
);
430 if( aNameDlg
->Execute() == RET_OK
)
433 aNameDlg
->GetName( aNewName
);
434 if (aNewName
!= aPageName
)
439 RenameSlide( nPageId
, aNewName
);
440 DBG_ASSERT( bResult
, "Couldn't rename slide" );
450 case SID_RENAMEPAGE_QUICK
:
452 if (mePageKind
==PK_STANDARD
|| mePageKind
==PK_NOTES
)
454 if ( mpDrawView
->IsTextEdit() )
456 mpDrawView
->SdrEndTextEdit();
459 maTabControl
->StartEditMode( maTabControl
->GetCurPageId() );
467 case SID_PAGESIZE
: // either this (no menu entries or something else!)
469 const SfxItemSet
*pArgs
= rReq
.GetArgs ();
472 if (pArgs
->Count () == 3)
474 SFX_REQUEST_ARG (rReq
, pWidth
, SfxUInt32Item
, ID_VAL_PAGEWIDTH
, false);
475 SFX_REQUEST_ARG (rReq
, pHeight
, SfxUInt32Item
, ID_VAL_PAGEHEIGHT
, false);
476 SFX_REQUEST_ARG (rReq
, pScaleAll
, SfxBoolItem
, ID_VAL_SCALEOBJECTS
, false);
478 Size
aSize (pWidth
->GetValue (), pHeight
->GetValue ());
480 SetupPage (aSize
, 0, 0, 0, 0, true, false, pScaleAll
->GetValue ());
484 #if HAVE_FEATURE_SCRIPTING
485 StarBASIC::FatalError (SbERR_WRONG_ARGS
);
491 case SID_PAGEMARGIN
: // or this (no menu entries or something else!)
493 const SfxItemSet
*pArgs
= rReq
.GetArgs ();
496 if (pArgs
->Count () == 5)
498 SFX_REQUEST_ARG (rReq
, pLeft
, SfxUInt32Item
, ID_VAL_PAGELEFT
, false);
499 SFX_REQUEST_ARG (rReq
, pRight
, SfxUInt32Item
, ID_VAL_PAGERIGHT
, false);
500 SFX_REQUEST_ARG (rReq
, pUpper
, SfxUInt32Item
, ID_VAL_PAGETOP
, false);
501 SFX_REQUEST_ARG (rReq
, pLower
, SfxUInt32Item
, ID_VAL_PAGEBOTTOM
, false);
502 SFX_REQUEST_ARG (rReq
, pScaleAll
, SfxBoolItem
, ID_VAL_SCALEOBJECTS
, false);
504 Size
aEmptySize (0, 0);
506 SetupPage (aEmptySize
, pLeft
->GetValue (), pRight
->GetValue (),
507 pUpper
->GetValue (), pLower
->GetValue (),
508 false, true, pScaleAll
->GetValue ());
512 #if HAVE_FEATURE_SCRIPTING
513 StarBASIC::FatalError (SbERR_WRONG_ARGS
);
519 case SID_ATTR_ZOOMSLIDER
:
521 const SfxItemSet
* pArgs
= rReq
.GetArgs();
523 if (pArgs
&& pArgs
->Count () == 1 )
525 SFX_REQUEST_ARG (rReq
, pScale
, SfxUInt16Item
, SID_ATTR_ZOOMSLIDER
, false);
526 if (CHECK_RANGE (5, pScale
->GetValue (), 3000))
528 SetZoom (pScale
->GetValue ());
530 SfxBindings
& rBindings
= GetViewFrame()->GetBindings();
531 rBindings
.Invalidate( SID_ATTR_ZOOM
);
532 rBindings
.Invalidate( SID_ZOOM_IN
);
533 rBindings
.Invalidate( SID_ZOOM_OUT
);
534 rBindings
.Invalidate( SID_ATTR_ZOOMSLIDER
);
543 case SID_ZOOMING
: // no menu entry, but generated from zoom dialog
545 const SfxItemSet
* pArgs
= rReq
.GetArgs();
548 if (pArgs
->Count () == 1)
550 SFX_REQUEST_ARG (rReq
, pScale
, SfxUInt32Item
, ID_VAL_ZOOM
, false);
551 if (CHECK_RANGE (10, pScale
->GetValue (), 1000))
553 SetZoom (pScale
->GetValue ());
555 SfxBindings
& rBindings
= GetViewFrame()->GetBindings();
556 rBindings
.Invalidate( SID_ATTR_ZOOM
);
557 rBindings
.Invalidate( SID_ZOOM_IN
);
558 rBindings
.Invalidate( SID_ZOOM_OUT
);
559 rBindings
.Invalidate( SID_ATTR_ZOOMSLIDER
);
561 #if HAVE_FEATURE_SCRIPTING
562 else StarBASIC::FatalError (SbERR_BAD_PROP_VALUE
);
567 #if HAVE_FEATURE_SCRIPTING
568 StarBASIC::FatalError (SbERR_WRONG_ARGS
);
576 const SfxItemSet
* pArgs
= rReq
.GetArgs();
577 mbZoomOnPage
= false;
581 SvxZoomType eZT
= static_cast<const SvxZoomItem
&>( pArgs
->
582 Get( SID_ATTR_ZOOM
) ).GetType();
585 case SvxZoomType::PERCENT
:
586 SetZoom( (long) static_cast<const SvxZoomItem
&>( pArgs
->
587 Get( SID_ATTR_ZOOM
) ).GetValue() );
590 case SvxZoomType::OPTIMAL
:
591 GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_ALL
,
592 SfxCallMode::ASYNCHRON
| SfxCallMode::RECORD
);
595 case SvxZoomType::PAGEWIDTH
:
596 GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE_WIDTH
,
597 SfxCallMode::ASYNCHRON
| SfxCallMode::RECORD
);
600 case SvxZoomType::WHOLEPAGE
:
601 GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE
,
602 SfxCallMode::ASYNCHRON
| SfxCallMode::RECORD
);
604 case SvxZoomType::PAGEWIDTH_NOBORDER
:
605 OSL_FAIL("sd::DrawViewShell::FuTemporary(), SvxZoomType::PAGEWIDTH_NOBORDER not handled!" );
613 SetCurrentFunction( FuScale::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
619 case SID_CHANGEBEZIER
:
620 case SID_CHANGEPOLYGON
:
621 if ( mpDrawView
->IsTextEdit() )
623 mpDrawView
->SdrEndTextEdit();
624 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT
, SfxCallMode::ASYNCHRON
);
627 if ( mpDrawView
->IsPresObjSelected() )
629 ::sd::Window
* pWindow
= GetActiveWindow();
630 ScopedVclPtr
<InfoBox
>::Create(pWindow
, SD_RESSTR(STR_ACTION_NOTPOSSIBLE
))->Execute();
634 if( rReq
.GetSlot() == SID_CHANGEBEZIER
)
636 WaitObject
aWait( (Window
*)GetActiveWindow() );
637 mpDrawView
->ConvertMarkedToPathObj(false);
641 if( mpDrawView
->IsVectorizeAllowed() )
643 SetCurrentFunction( FuVectorize::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
647 WaitObject
aWait( (Window
*)GetActiveWindow() );
648 mpDrawView
->ConvertMarkedToPolyObj(false);
652 Invalidate(SID_CHANGEBEZIER
);
653 Invalidate(SID_CHANGEPOLYGON
);
657 if( HasCurrentFunction(SID_BEZIER_EDIT
) )
658 { // where applicable, activate right edit action
659 GetViewFrame()->GetDispatcher()->Execute(SID_SWITCH_POINTEDIT
,
660 SfxCallMode::ASYNCHRON
| SfxCallMode::RECORD
);
665 case SID_CONVERT_TO_CONTOUR
:
666 if ( mpDrawView
->IsTextEdit() )
668 mpDrawView
->SdrEndTextEdit();
669 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT
, SfxCallMode::ASYNCHRON
);
672 if ( mpDrawView
->IsPresObjSelected() )
674 ::sd::Window
* pWindow
= GetActiveWindow();
675 ScopedVclPtr
<InfoBox
>::Create(pWindow
, SD_RESSTR(STR_ACTION_NOTPOSSIBLE
))->Execute();
679 WaitObject
aWait( (Window
*)GetActiveWindow() );
680 mpDrawView
->ConvertMarkedToPathObj(true);
682 Invalidate(SID_CONVERT_TO_CONTOUR
);
689 case SID_CONVERT_TO_METAFILE
:
690 case SID_CONVERT_TO_BITMAP
:
692 // End text edit mode when it is active because the metafile or
693 // bitmap that will be created does not support it.
694 if ( mpDrawView
->IsTextEdit() )
696 mpDrawView
->SdrEndTextEdit();
697 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT
, SfxCallMode::ASYNCHRON
);
700 if ( mpDrawView
->IsPresObjSelected(true,true,true) )
702 ::sd::Window
* pWindow
= GetActiveWindow();
703 ScopedVclPtr
<InfoBox
>::Create(pWindow
, SD_RESSTR(STR_ACTION_NOTPOSSIBLE
))->Execute();
707 WaitObject
aWait( (Window
*)GetActiveWindow() );
709 // create SdrGrafObj from metafile/bitmap
713 case SID_CONVERT_TO_METAFILE
:
715 // switch on undo for the next operations
716 mpDrawView
->BegUndo(SD_RESSTR(STR_UNDO_CONVERT_TO_METAFILE
));
717 GDIMetaFile
aMetaFile(mpDrawView
->GetMarkedObjMetaFile());
718 aGraphic
= Graphic(aMetaFile
);
721 case SID_CONVERT_TO_BITMAP
:
723 // switch on undo for the next operations
724 mpDrawView
->BegUndo(SD_RESSTR(STR_UNDO_CONVERT_TO_BITMAP
));
727 // I have to get the image here directly since GetMarkedObjBitmapEx works
728 // based on Bitmaps, but not on BitmapEx, thus throwing away the alpha
729 // channel. Argh! GetMarkedObjBitmapEx itself is too widely used to safely
730 // change that, e.g. in the exchange formats. For now I can only add this
731 // exception to get good results for Svgs. This is how the code gets more
732 // and more crowded, at last I made a remark for myself to change this
733 // as one of the next tasks.
734 if(1 == mpDrawView
->GetMarkedObjectCount())
736 const SdrGrafObj
* pSdrGrafObj
= dynamic_cast< const SdrGrafObj
* >(mpDrawView
->GetMarkedObjectByIndex(0));
738 if(pSdrGrafObj
&& pSdrGrafObj
->isEmbeddedSvg())
740 aGraphic
= Graphic(pSdrGrafObj
->GetGraphic().getSvgData()->getReplacement());
747 aGraphic
= Graphic(mpDrawView
->GetMarkedObjBitmapEx());
754 SdrGrafObj
* pGraphicObj
= new SdrGrafObj (aGraphic
);
756 // get some necessary info and ensure it
757 const SdrMarkList
& rMarkList(mpDrawView
->GetMarkedObjectList());
758 const size_t nMarkCount(rMarkList
.GetMarkCount());
759 SdrPageView
* pPageView
= mpDrawView
->GetSdrPageView();
760 OSL_ENSURE(nMarkCount
, "DrawViewShell::FuTemporary: SID_CONVERT_TO_BITMAP with empty selection (!)");
761 OSL_ENSURE(pPageView
, "DrawViewShell::FuTemporary: SID_CONVERT_TO_BITMAP without SdrPageView (!)");
763 // fit rectangle of new graphic object to selection's mark rect
764 Rectangle aAllMarkedRect
;
765 rMarkList
.TakeBoundRect(pPageView
, aAllMarkedRect
);
766 pGraphicObj
->SetLogicRect(aAllMarkedRect
);
768 // #i71540# to keep the order, it is necessary to replace the lowest object
769 // of the selection with the new object. This also means that with multi
770 // selection, all other objects need to be deleted first
771 SdrMark
* pFirstMark
= rMarkList
.GetMark(0);
772 SdrObject
* pReplacementCandidate
= pFirstMark
->GetMarkedSdrObj();
776 // take first object out of selection
777 mpDrawView
->MarkObj(pReplacementCandidate
, pPageView
, true, true);
779 // clear remaining selection
780 mpDrawView
->DeleteMarkedObj();
783 // #i124816# copy layer from lowest object which gets replaced
784 pGraphicObj
->SetLayer(pReplacementCandidate
->GetLayer());
786 // now replace lowest object with new one
787 mpDrawView
->ReplaceObjectAtView(pReplacementCandidate
, *pPageView
, pGraphicObj
);
790 mpDrawView
->EndUndo();
799 case SID_SET_DEFAULT
:
801 boost::scoped_ptr
<SfxItemSet
> pSet
;
803 if (mpDrawView
->IsTextEdit())
805 ::Outliner
* pOutl
= mpDrawView
->GetTextEditOutliner();
808 pOutl
->RemoveFields(true, SvxURLField::StaticType());
811 pSet
.reset(new SfxItemSet( GetPool(), EE_ITEMS_START
, EE_ITEMS_END
));
812 mpDrawView
->SetAttributes( *pSet
, true );
816 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
817 const size_t nCount
= rMarkList
.GetMarkCount();
819 // For every presentation object a SfxItemSet of hard attributes
820 // and the UserCall is stored in this list. This is because
821 // at the following mpDrawView->SetAttributes( *pSet, sal_True )
822 // they get lost and have to be restored.
823 std::vector
<std::pair
<SfxItemSet
*,SdrObjUserCall
*> > aAttrList
;
824 SdPage
* pPresPage
= static_cast<SdPage
*>( mpDrawView
->GetSdrPageView()->GetPage() );
826 for ( size_t i
= 0; i
< nCount
; ++i
)
828 SdrObject
* pObj
= rMarkList
.GetMark(i
)->GetMarkedSdrObj();
830 if( pPresPage
->IsPresObj( pObj
) )
832 SfxItemSet
* pNewSet
= new SfxItemSet( GetDoc()->GetPool(), SDRATTR_TEXT_MINFRAMEHEIGHT
, SDRATTR_TEXT_AUTOGROWHEIGHT
, 0 );
833 pNewSet
->Put(pObj
->GetMergedItemSet());
834 aAttrList
.push_back(std::make_pair(pNewSet
, pObj
->GetUserCall()));
838 pSet
.reset(new SfxItemSet( GetPool() ));
839 mpDrawView
->SetAttributes( *pSet
, true );
843 for ( size_t i
= 0; i
< nCount
; ++i
)
845 SfxStyleSheet
* pSheet
= NULL
;
846 SdrObject
* pObj
= rMarkList
.GetMark(i
)->GetMarkedSdrObj();
848 if (pObj
->GetObjIdentifier() == OBJ_TITLETEXT
)
850 pSheet
= mpActualPage
->GetStyleSheetForPresObj(PRESOBJ_TITLE
);
852 pObj
->SetStyleSheet(pSheet
, false);
854 else if(pObj
->GetObjIdentifier() == OBJ_OUTLINETEXT
)
856 for (sal_uInt16 nLevel
= 1; nLevel
< 10; nLevel
++)
858 pSheet
= mpActualPage
->GetStyleSheetForPresObj( PRESOBJ_OUTLINE
);
859 DBG_ASSERT(pSheet
, "Template for outline object not found");
862 pObj
->StartListening(*pSheet
);
865 // text frame listens on StyleSheet of level1
866 pObj
->NbcSetStyleSheet(pSheet
, false);
872 if( pPresPage
->IsPresObj( pObj
) )
874 std::pair
<SfxItemSet
*,SdrObjUserCall
*> &rAttr
= aAttrList
[j
++];
876 boost::scoped_ptr
<SfxItemSet
> pNewSet(rAttr
.first
);
877 SdrObjUserCall
* pUserCall
= rAttr
.second
;
879 if ( pNewSet
&& pNewSet
->GetItemState( SDRATTR_TEXT_MINFRAMEHEIGHT
) == SfxItemState::SET
)
881 pObj
->SetMergedItem(pNewSet
->Get(SDRATTR_TEXT_MINFRAMEHEIGHT
));
884 if ( pNewSet
&& pNewSet
->GetItemState( SDRATTR_TEXT_AUTOGROWHEIGHT
) == SfxItemState::SET
)
886 pObj
->SetMergedItem(pNewSet
->Get(SDRATTR_TEXT_AUTOGROWHEIGHT
));
890 pObj
->SetUserCall( pUserCall
);
900 case SID_DELETE_SNAPITEM
:
903 Point aMPos
= GetActiveWindow()->PixelToLogic( maMousePos
);
904 sal_uInt16 nHitLog
= (sal_uInt16
) GetActiveWindow()->PixelToLogic( Size(
905 FuPoor::HITPIX
, 0 ) ).Width();
906 sal_uInt16 nHelpLine
;
908 mbMousePosFreezed
= false;
910 if( mpDrawView
->PickHelpLine( aMPos
, nHitLog
, *GetActiveWindow(), nHelpLine
, pPV
) )
912 pPV
->DeleteHelpLine( nHelpLine
);
919 case SID_DELETE_PAGE
:
920 case SID_DELETE_MASTER_PAGE
:
926 case SID_DELETE_LAYER
:
932 case SID_ORIGINAL_SIZE
:
933 mpDrawView
->SetMarkedOriginalSize();
938 case SID_DRAW_FONTWORK
:
939 case SID_DRAW_FONTWORK_VERTICAL
:
941 svx::FontworkBar::execute( mpView
, rReq
, GetViewFrame()->GetBindings() ); // SJ: can be removed (I think)
947 case SID_SAVE_GRAPHIC
:
949 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
950 if( rMarkList
.GetMarkCount() == 1 )
952 SdrObject
* pObj
= rMarkList
.GetMark( 0 )->GetMarkedSdrObj();
953 if( pObj
&& pObj
->ISA( SdrGrafObj
) && static_cast<SdrGrafObj
*>(pObj
)->GetGraphicType() == GRAPHIC_BITMAP
)
955 GraphicObject
aGraphicObject( static_cast<SdrGrafObj
*>( pObj
)->GetGraphicObject() );
957 GraphicHelper::ExportGraphic( aGraphicObject
.GetGraphic(), "" );
966 case SID_EXTERNAL_EDIT
:
968 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
969 if( rMarkList
.GetMarkCount() == 1 )
971 SdrObject
* pObj
= rMarkList
.GetMark( 0 )->GetMarkedSdrObj();
972 if( pObj
&& pObj
->ISA( SdrGrafObj
) && static_cast<SdrGrafObj
*>(pObj
)->GetGraphicType() == GRAPHIC_BITMAP
)
974 GraphicObject
aGraphicObject( static_cast<SdrGrafObj
*>(pObj
)->GetGraphicObject() );
975 m_ExternalEdits
.push_back(
976 std::unique_ptr
<SdrExternalToolEdit
>(
977 new SdrExternalToolEdit(mpDrawView
, pObj
)));
978 m_ExternalEdits
.back()->Edit( &aGraphicObject
);
986 case SID_COMPRESS_GRAPHIC
:
988 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
989 if( rMarkList
.GetMarkCount() == 1 )
991 SdrObject
* pObj
= rMarkList
.GetMark( 0 )->GetMarkedSdrObj();
993 if( pObj
&& pObj
->ISA( SdrGrafObj
) && static_cast<SdrGrafObj
*>(pObj
)->GetGraphicType() == GRAPHIC_BITMAP
)
995 SdrGrafObj
* pGraphicObj
= static_cast<SdrGrafObj
*>(pObj
);
996 ScopedVclPtrInstance
< CompressGraphicsDialog
> dialog( GetParentWindow(), pGraphicObj
, GetViewFrame()->GetBindings() );
997 if ( dialog
->Execute() == RET_OK
)
999 SdrGrafObj
* pNewObject
= dialog
->GetCompressedSdrGrafObj();
1000 SdrPageView
* pPageView
= mpDrawView
->GetSdrPageView();
1001 OUString aUndoString
= mpDrawView
->GetDescriptionOfMarkedObjects();
1002 aUndoString
+= " Compress";
1003 mpDrawView
->BegUndo( aUndoString
);
1004 mpDrawView
->ReplaceObjectAtView( pObj
, *pPageView
, pNewObject
);
1005 mpDrawView
->EndUndo();
1014 case SID_ATTRIBUTES_LINE
: // BASIC
1016 SetCurrentFunction( FuLine::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1021 case SID_ATTRIBUTES_AREA
: // BASIC
1023 SetCurrentFunction( FuArea::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1028 case SID_ATTR_TRANSFORM
:
1030 SetCurrentFunction( FuTransform::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1031 Invalidate(SID_RULER_OBJECT
);
1036 case SID_CHAR_DLG_EFFECT
:
1037 case SID_CHAR_DLG
: // BASIC
1039 SetCurrentFunction( FuChar::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1046 SetCurrentFunction( FuParagraph::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1051 case FN_NUM_BULLET_ON
:
1053 // The value (sal_uInt16)0xFFFF means set bullet on/off.
1054 SfxUInt16Item
aItem(FN_SVX_SET_BULLET
, (sal_uInt16
)0xFFFF);
1055 GetViewFrame()->GetDispatcher()->Execute( FN_SVX_SET_BULLET
, SfxCallMode::RECORD
, &aItem
, 0L );
1059 case FN_NUM_NUMBERING_ON
:
1061 // The value (sal_uInt16)0xFFFF means set bullet on/off.
1062 SfxUInt16Item
aItem(FN_SVX_SET_NUMBER
, (sal_uInt16
)0xFFFF);
1063 GetViewFrame()->GetDispatcher()->Execute( FN_SVX_SET_NUMBER
, SfxCallMode::RECORD
, &aItem
, 0L );
1067 case SID_OUTLINE_BULLET
:
1068 case FN_SVX_SET_BULLET
:
1069 case FN_SVX_SET_NUMBER
:
1071 SetCurrentFunction( FuOutlineBullet::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1076 case FN_INSERT_SOFT_HYPHEN
:
1077 case FN_INSERT_HARDHYPHEN
:
1078 case FN_INSERT_HARD_SPACE
:
1079 case SID_INSERT_RLM
:
1080 case SID_INSERT_LRM
:
1081 case SID_INSERT_ZWNBSP
:
1082 case SID_INSERT_ZWSP
:
1085 SetCurrentFunction( FuBullet::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1090 case SID_PRESENTATION_LAYOUT
:
1092 SetCurrentFunction( FuPresentationLayout::Create(this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1097 case SID_PASTE_SPECIAL
:
1099 SetCurrentFunction( FuInsertClipboard::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1105 case SID_CHANGE_PICTURE
:
1106 case SID_INSERT_GRAPHIC
:
1108 SetCurrentFunction( FuInsertGraphic::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1111 Invalidate(SID_DRAWTBX_INSERT
);
1115 case SID_INSERT_AVMEDIA
:
1117 SetCurrentFunction( FuInsertAVMedia::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1122 Invalidate(SID_DRAWTBX_INSERT
);
1126 case SID_INSERT_OBJECT
:
1127 case SID_INSERT_PLUGIN
:
1128 case SID_INSERT_SOUND
:
1129 case SID_INSERT_VIDEO
:
1130 case SID_INSERT_FLOATINGFRAME
:
1131 case SID_INSERT_MATH
:
1132 case SID_INSERT_DIAGRAM
:
1133 case SID_ATTR_TABLE
:
1135 SetCurrentFunction( FuInsertOLE::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1136 // Set the selection tool as the old one. This in particular important for the
1137 // zoom function, in which clicking without dragging zooms as well, and that
1138 // makes exiting the object editing mode impossible.
1139 SetOldFunction( FuSelection::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1143 Invalidate(SID_DRAWTBX_INSERT
);
1146 #if HAVE_FEATURE_GLTF
1147 case SID_INSERT_3DMODEL
:
1149 SetCurrentFunction( FuInsert3DModel::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1154 Invalidate(SID_DRAWTBX_INSERT
);
1159 case SID_COPYOBJECTS
:
1161 if ( mpDrawView
->IsPresObjSelected(false, true) )
1163 ::sd::Window
* pWindow
= GetActiveWindow();
1164 ScopedVclPtr
<InfoBox
>::Create(pWindow
, SD_RESSTR(STR_ACTION_NOTPOSSIBLE
))->Execute();
1168 if ( mpDrawView
->IsTextEdit() )
1170 mpDrawView
->SdrEndTextEdit();
1173 SetCurrentFunction( FuCopy::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1180 case SID_INSERTFILE
: // BASIC
1182 Broadcast (ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_START
));
1183 SetCurrentFunction( FuInsertFile::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1184 Broadcast (ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_END
));
1188 Invalidate(SID_DRAWTBX_INSERT
);
1192 case SID_SELECT_BACKGROUND
:
1193 case SID_PAGESETUP
: // BASIC ??
1195 SetCurrentFunction( FuPage::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1197 rReq
.Ignore (); // we generate independent macros !!
1201 case SID_BEFORE_OBJ
:
1202 case SID_BEHIND_OBJ
:
1204 SetCurrentFunction( FuDisplayOrder::Create(this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1205 Invalidate( SID_POSITION
);
1207 // finishes itself, no Cancel() needed!
1211 case SID_REVERSE_ORDER
: // BASIC
1213 mpDrawView
->ReverseOrderOfMarked();
1214 Invalidate( SID_POSITION
);
1220 case SID_ANIMATION_EFFECTS
:
1222 SetCurrentFunction( FuObjectAnimationParameters::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1227 case SID_LINEEND_POLYGON
:
1229 SetCurrentFunction( FuLineEnd::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1234 case SID_CAPTUREPOINT
:
1235 // negative value to signal call from menu
1236 maMousePos
= Point(-1,-1);
1238 case SID_SET_SNAPITEM
:
1240 SetCurrentFunction( FuSnapLine::Create(this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1245 case SID_MANAGE_LINKS
:
1247 SetCurrentFunction( FuLink::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1255 SetCurrentFunction( FuThesaurus::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1261 case SID_TEXTATTR_DLG
:
1263 SetCurrentFunction( FuTextAttrDlg::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1269 case SID_MEASURE_DLG
:
1271 SetCurrentFunction( FuMeasureDlg::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1277 case SID_CONNECTION_DLG
:
1279 SetCurrentFunction( FuConnectionDlg::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1285 case SID_CONNECTION_NEW_ROUTING
:
1287 SfxItemSet
aDefAttr( GetPool(), SDRATTR_EDGELINE1DELTA
, SDRATTR_EDGELINE3DELTA
);
1288 GetView()->SetAttributes( aDefAttr
, true ); // (ReplaceAll)
1295 case SID_TWAIN_SELECT
:
1297 if( mxScannerManager
.is() )
1301 const ::com::sun::star::uno::Sequence
< ::com::sun::star::scanner::ScannerContext
>
1302 aContexts( mxScannerManager
->getAvailableScanners() );
1304 if( aContexts
.getLength() )
1306 ::com::sun::star::scanner::ScannerContext
aContext( aContexts
.getConstArray()[ 0 ] );
1307 mxScannerManager
->configureScannerAndScan( aContext
, mxScannerListener
);
1320 case SID_TWAIN_TRANSFER
:
1324 if( mxScannerManager
.is() )
1328 const ::com::sun::star::uno::Sequence
< ::com::sun::star::scanner::ScannerContext
> aContexts( mxScannerManager
->getAvailableScanners() );
1330 if( aContexts
.getLength() )
1332 mxScannerManager
->startScan( aContexts
.getConstArray()[ 0 ], mxScannerListener
);
1344 const sal_uInt16 nId
= STR_TWAIN_NO_SOURCE
;
1346 const sal_uInt16 nId
= STR_TWAIN_NO_SOURCE_UNX
;
1349 ::sd::Window
* pWindow
= GetActiveWindow();
1350 ScopedVclPtr
<InfoBox
>::Create(pWindow
, SD_RESSTR(nId
))->Execute();
1354 SfxBindings
& rBindings
= GetViewFrame()->GetBindings();
1355 rBindings
.Invalidate( SID_TWAIN_SELECT
);
1356 rBindings
.Invalidate( SID_TWAIN_TRANSFER
);
1364 case SID_POLYGON_MORPHING
:
1366 SetCurrentFunction( FuMorph::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1373 SetCurrentFunction( FuVectorize::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1378 case SID_INSERTLAYER
:
1380 if ( mpDrawView
->IsTextEdit() )
1382 mpDrawView
->SdrEndTextEdit();
1385 SdrLayerAdmin
& rLayerAdmin
= GetDoc()->GetLayerAdmin();
1386 sal_uInt16 nLayerCnt
= rLayerAdmin
.GetLayerCount();
1387 sal_uInt16 nLayer
= nLayerCnt
- 2 + 1;
1388 OUString aLayerName
= SD_RESSTR(STR_LAYER
) + OUString::number(nLayer
);
1389 OUString aLayerTitle
, aLayerDesc
;
1390 bool bIsVisible
= false;
1391 bool bIsLocked
= false;
1392 bool bIsPrintable
= false;
1394 const SfxItemSet
* pArgs
= rReq
.GetArgs();
1398 SfxItemSet
aNewAttr( GetDoc()->GetPool(), ATTR_LAYER_START
, ATTR_LAYER_END
);
1400 aNewAttr
.Put( SdAttrLayerName( aLayerName
) );
1401 aNewAttr
.Put( SdAttrLayerTitle() );
1402 aNewAttr
.Put( SdAttrLayerDesc() );
1403 aNewAttr
.Put( SdAttrLayerVisible() );
1404 aNewAttr
.Put( SdAttrLayerPrintable() );
1405 aNewAttr
.Put( SdAttrLayerLocked() );
1406 aNewAttr
.Put( SdAttrLayerThisPage() );
1408 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
1409 boost::scoped_ptr
<AbstractSdInsertLayerDlg
> pDlg(pFact
? pFact
->CreateSdInsertLayerDlg(NULL
, aNewAttr
, true, SD_RESSTR(STR_INSERTLAYER
)) : 0);
1412 pDlg
->SetHelpId( SD_MOD()->GetSlotPool()->GetSlot( SID_INSERTLAYER
)->GetCommand() );
1414 // test for already existing names
1416 while( bLoop
&& pDlg
->Execute() == RET_OK
)
1418 pDlg
->GetAttr( aNewAttr
);
1419 aLayerName
= static_cast<const SdAttrLayerName
&>( aNewAttr
.Get (ATTR_LAYER_NAME
)).GetValue ();
1421 if( rLayerAdmin
.GetLayer( aLayerName
, false )
1422 || aLayerName
.isEmpty() )
1424 // name already exists
1425 ScopedVclPtrInstance
<WarningBox
> aWarningBox (
1428 SD_RESSTR(STR_WARN_NAME_DUPLICATE
));
1429 aWarningBox
->Execute();
1434 if( bLoop
) // was canceled
1443 aLayerTitle
= static_cast<const SdAttrLayerTitle
&>( aNewAttr
.Get (ATTR_LAYER_TITLE
)).GetValue ();
1444 aLayerDesc
= static_cast<const SdAttrLayerDesc
&>( aNewAttr
.Get (ATTR_LAYER_DESC
)).GetValue ();
1445 bIsVisible
= static_cast<const SdAttrLayerVisible
&>( aNewAttr
.Get (ATTR_LAYER_VISIBLE
)).GetValue ();
1446 bIsLocked
= static_cast<const SdAttrLayerLocked
&>( aNewAttr
.Get (ATTR_LAYER_LOCKED
)).GetValue () ;
1447 bIsPrintable
= static_cast<const SdAttrLayerPrintable
&>( aNewAttr
.Get (ATTR_LAYER_PRINTABLE
)).GetValue () ;
1451 else if (pArgs
->Count () != 4)
1453 #if HAVE_FEATURE_SCRIPTING
1454 StarBASIC::FatalError (SbERR_WRONG_ARGS
);
1462 SFX_REQUEST_ARG (rReq
, pLayerName
, SfxStringItem
, ID_VAL_LAYERNAME
, false);
1463 SFX_REQUEST_ARG (rReq
, pIsVisible
, SfxBoolItem
, ID_VAL_ISVISIBLE
, false);
1464 SFX_REQUEST_ARG (rReq
, pIsLocked
, SfxBoolItem
, ID_VAL_ISLOCKED
, false);
1465 SFX_REQUEST_ARG (rReq
, pIsPrintable
, SfxBoolItem
, ID_VAL_ISPRINTABLE
, false);
1467 aLayerName
= pLayerName
->GetValue ();
1468 bIsVisible
= pIsVisible
->GetValue ();
1469 bIsLocked
= pIsLocked
->GetValue ();
1470 bIsPrintable
= pIsPrintable
->GetValue ();
1473 OUString aPrevLayer
= mpDrawView
->GetActiveLayer();
1475 sal_uInt16 nPrevLayer
= 0;
1476 nLayerCnt
= rLayerAdmin
.GetLayerCount();
1478 for ( nLayer
= 0; nLayer
< nLayerCnt
; nLayer
++ )
1480 pLayer
= rLayerAdmin
.GetLayer(nLayer
);
1481 OUString aName
= pLayer
->GetName();
1483 if ( aPrevLayer
== aName
)
1485 nPrevLayer
= std::max(nLayer
, (sal_uInt16
) 4);
1489 mpDrawView
->InsertNewLayer(aLayerName
, nPrevLayer
+ 1);
1490 pLayer
= rLayerAdmin
.GetLayer(aLayerName
, false);
1493 pLayer
->SetTitle( aLayerTitle
);
1494 pLayer
->SetDescription( aLayerDesc
);
1497 mpDrawView
->SetLayerVisible( aLayerName
, bIsVisible
);
1498 mpDrawView
->SetLayerLocked( aLayerName
, bIsLocked
);
1499 mpDrawView
->SetLayerPrintable(aLayerName
, bIsPrintable
);
1501 mpDrawView
->SetActiveLayer(aLayerName
);
1505 GetDoc()->SetChanged(true);
1507 GetViewFrame()->GetDispatcher()->Execute(SID_SWITCHLAYER
,
1508 SfxCallMode::ASYNCHRON
| SfxCallMode::RECORD
);
1515 case SID_MODIFYLAYER
:
1517 if(!GetLayerTabControl()) // #i87182#
1519 OSL_ENSURE(false, "No LayerTabBar (!)");
1525 if ( mpDrawView
->IsTextEdit() )
1527 mpDrawView
->SdrEndTextEdit();
1530 SdrLayerAdmin
& rLayerAdmin
= GetDoc()->GetLayerAdmin();
1531 sal_uInt16 nCurPage
= GetLayerTabControl()->GetCurPageId();
1532 OUString aLayerName
= GetLayerTabControl()->GetPageText(nCurPage
);
1533 SdrLayer
* pLayer
= rLayerAdmin
.GetLayer(aLayerName
, false);
1535 OUString aLayerTitle
= pLayer
->GetTitle();
1536 OUString aLayerDesc
= pLayer
->GetDescription();
1538 OUString
aOldLayerName(aLayerName
);
1539 OUString
aOldLayerTitle(aLayerTitle
);
1540 OUString
aOldLayerDesc(aLayerDesc
);
1542 bool bIsVisible
, bIsLocked
, bIsPrintable
;
1543 bool bOldIsVisible
= bIsVisible
= mpDrawView
->IsLayerVisible(aLayerName
);
1544 bool bOldIsLocked
= bIsLocked
= mpDrawView
->IsLayerLocked(aLayerName
);
1545 bool bOldIsPrintable
= bIsPrintable
= mpDrawView
->IsLayerPrintable(aLayerName
);
1547 const SfxItemSet
* pArgs
= rReq
.GetArgs();
1548 // is it allowed to delete the layer?
1549 bool bDelete
= true;
1551 OUString aLayoutLayer
= SD_RESSTR(STR_LAYER_LAYOUT
);
1552 OUString aControlsLayer
= SD_RESSTR(STR_LAYER_CONTROLS
);
1553 OUString aMeasureLinesLayer
= SD_RESSTR(STR_LAYER_MEASURELINES
);
1554 OUString aBackgroundLayer
= SD_RESSTR(STR_LAYER_BCKGRND
);
1555 OUString aBackgroundObjLayer
= SD_RESSTR(STR_LAYER_BCKGRNDOBJ
);
1557 if( aLayerName
== aLayoutLayer
|| aLayerName
== aControlsLayer
||
1558 aLayerName
== aMeasureLinesLayer
||
1559 aLayerName
== aBackgroundLayer
|| aLayerName
== aBackgroundObjLayer
)
1566 SfxItemSet
aNewAttr( GetDoc()->GetPool(), ATTR_LAYER_START
, ATTR_LAYER_END
);
1568 aNewAttr
.Put( SdAttrLayerName( aLayerName
) );
1569 aNewAttr
.Put( SdAttrLayerTitle( aLayerTitle
) );
1570 aNewAttr
.Put( SdAttrLayerDesc( aLayerDesc
) );
1571 aNewAttr
.Put( SdAttrLayerVisible( bIsVisible
) );
1572 aNewAttr
.Put( SdAttrLayerLocked( bIsLocked
) );
1573 aNewAttr
.Put( SdAttrLayerPrintable( bIsPrintable
) );
1574 aNewAttr
.Put( SdAttrLayerThisPage() );
1576 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
1577 boost::scoped_ptr
<AbstractSdInsertLayerDlg
> pDlg(pFact
? pFact
->CreateSdInsertLayerDlg(NULL
, aNewAttr
, bDelete
, SD_RESSTR(STR_MODIFYLAYER
)) : 0);
1580 pDlg
->SetHelpId( SD_MOD()->GetSlotPool()->GetSlot( SID_MODIFYLAYER
)->GetCommand() );
1582 // test for already existing names
1584 sal_uInt16 nRet
= 0;
1585 while( bLoop
&& ( (nRet
= pDlg
->Execute()) == RET_OK
) )
1587 pDlg
->GetAttr( aNewAttr
);
1588 aLayerName
= static_cast<const SdAttrLayerName
&>( aNewAttr
.Get (ATTR_LAYER_NAME
)).GetValue ();
1590 if( (rLayerAdmin
.GetLayer( aLayerName
, false ) &&
1591 aLayerName
!= aOldLayerName
) || aLayerName
.isEmpty() )
1593 // name already exists
1594 ScopedVclPtrInstance
<WarningBox
> aWarningBox (
1597 SD_RESSTR(STR_WARN_NAME_DUPLICATE
));
1598 aWarningBox
->Execute();
1606 aLayerTitle
= static_cast<const SdAttrLayerTitle
&>( aNewAttr
.Get (ATTR_LAYER_TITLE
)).GetValue ();
1607 aLayerDesc
= static_cast<const SdAttrLayerDesc
&>( aNewAttr
.Get (ATTR_LAYER_DESC
)).GetValue ();
1608 bIsVisible
= static_cast<const SdAttrLayerVisible
&>( aNewAttr
.Get (ATTR_LAYER_VISIBLE
)).GetValue ();
1609 bIsLocked
= static_cast<const SdAttrLayerLocked
&>( aNewAttr
.Get (ATTR_LAYER_LOCKED
)).GetValue ();
1610 bIsPrintable
= static_cast<const SdAttrLayerLocked
&>( aNewAttr
.Get (ATTR_LAYER_PRINTABLE
)).GetValue ();
1621 else if (pArgs
->Count () == 4)
1623 SFX_REQUEST_ARG (rReq
, pLayerName
, SfxStringItem
, ID_VAL_LAYERNAME
, false);
1624 SFX_REQUEST_ARG (rReq
, pIsVisible
, SfxBoolItem
, ID_VAL_ISVISIBLE
, false);
1625 SFX_REQUEST_ARG (rReq
, pIsLocked
, SfxBoolItem
, ID_VAL_ISLOCKED
, false);
1626 SFX_REQUEST_ARG (rReq
, pIsPrintable
, SfxBoolItem
, ID_VAL_ISPRINTABLE
, false);
1628 aLayerName
= pLayerName
->GetValue ();
1629 bIsVisible
= pIsVisible
->GetValue ();
1630 bIsLocked
= pIsLocked
->GetValue ();
1631 bIsPrintable
= pIsPrintable
->GetValue ();
1635 #if HAVE_FEATURE_SCRIPTING
1636 StarBASIC::FatalError (SbERR_WRONG_ARGS
);
1643 ::svl::IUndoManager
* pManager
= GetDoc()->GetDocSh()->GetUndoManager();
1644 SdLayerModifyUndoAction
* pAction
= new SdLayerModifyUndoAction(
1662 pManager
->AddUndoAction( pAction
);
1664 ModifyLayer( pLayer
, aLayerName
, aLayerTitle
, aLayerDesc
, bIsVisible
, bIsLocked
, bIsPrintable
);
1671 case SID_RENAMELAYER
:
1673 if ( mpDrawView
->IsTextEdit() )
1675 mpDrawView
->SdrEndTextEdit();
1678 if(GetLayerTabControl()) // #i87182#
1680 GetLayerTabControl()->StartEditMode(GetLayerTabControl()->GetCurPageId());
1684 OSL_ENSURE(false, "No LayerTabBar (!)");
1692 case SID_EDIT_HYPERLINK
:
1694 GetViewFrame()->GetDispatcher()->Execute( SID_HYPERLINK_DIALOG
);
1701 case SID_OPEN_HYPERLINK
:
1703 OutlinerView
* pOutView
= mpDrawView
->GetTextEditOutlinerView();
1706 const SvxFieldItem
* pFieldItem
= pOutView
->GetFieldAtSelection();
1709 const SvxFieldData
* pField
= pFieldItem
->GetField();
1710 if( pField
&& pField
->ISA( SvxURLField
) )
1712 const SvxURLField
* pURLField
= static_cast< const SvxURLField
* >( pField
);
1714 SfxStringItem
aUrl( SID_FILE_NAME
, pURLField
->GetURL() );
1715 SfxStringItem
aTarget( SID_TARGETNAME
, pURLField
->GetTargetFrame() );
1717 OUString aReferName
;
1718 SfxViewFrame
* pFrame
= GetViewFrame();
1719 SfxMedium
* pMed
= pFrame
->GetObjectShell()->GetMedium();
1721 aReferName
= pMed
->GetName();
1723 SfxFrameItem
aFrm( SID_DOCFRAME
, pFrame
);
1724 SfxStringItem
aReferer( SID_REFERER
, aReferName
);
1726 SfxBoolItem
aNewView( SID_OPEN_NEW_VIEW
, false );
1727 SfxBoolItem
aBrowsing( SID_BROWSE
, true );
1729 SfxViewFrame
* pViewFrm
= SfxViewFrame::Current();
1731 pViewFrm
->GetDispatcher()->Execute( SID_OPENDOC
,
1732 SfxCallMode::ASYNCHRON
| SfxCallMode::RECORD
,
1735 &aNewView
, &aBrowsing
,
1745 case SID_HYPERLINK_SETLINK
:
1747 const SfxItemSet
* pReqArgs
= rReq
.GetArgs();
1751 const SvxHyperlinkItem
* pHLItem
=
1752 static_cast<const SvxHyperlinkItem
*>( &pReqArgs
->Get(SID_HYPERLINK_SETLINK
) );
1754 if (pHLItem
->GetInsertMode() == HLINK_FIELD
)
1756 InsertURLField(pHLItem
->GetURL(), pHLItem
->GetName(),
1757 pHLItem
->GetTargetFrame(), NULL
);
1759 else if (pHLItem
->GetInsertMode() == HLINK_BUTTON
)
1761 InsertURLButton(pHLItem
->GetURL(), pHLItem
->GetName(),
1762 pHLItem
->GetTargetFrame(), NULL
);
1764 else if (pHLItem
->GetInsertMode() == HLINK_DEFAULT
)
1766 OutlinerView
* pOlView
= mpDrawView
->GetTextEditOutlinerView();
1770 InsertURLField(pHLItem
->GetURL(), pHLItem
->GetName(),
1771 pHLItem
->GetTargetFrame(), NULL
);
1775 InsertURLButton(pHLItem
->GetURL(), pHLItem
->GetName(),
1776 pHLItem
->GetTargetFrame(), NULL
);
1786 case SID_HIDE_LAST_LEVEL
:
1789 // fdo#78151 editing a PRESOBJ_OUTLINE in a master page ?
1790 ::Outliner
* pOL
= GetOutlinerForMasterPageOutlineTextObj(aSel
);
1793 //we are on the last paragraph
1795 if (aSel
.nEndPara
== pOL
->GetParagraphCount() - 1)
1797 sal_uInt16 nDepth
= pOL
->GetDepth(aSel
.nEndPara
);
1798 //there exists a previous numbering level
1799 if (nDepth
!= sal_uInt16(-1) && nDepth
> 0)
1801 Paragraph
* pPara
= pOL
->GetParagraph(aSel
.nEndPara
);
1802 pOL
->Remove(pPara
, 1);
1811 case SID_SHOW_NEXT_LEVEL
:
1814 // fdo#78151 editing a PRESOBJ_OUTLINE in a master page ?
1815 ::Outliner
* pOL
= GetOutlinerForMasterPageOutlineTextObj(aSel
);
1818 //we are on the last paragraph
1820 if (aSel
.nEndPara
== pOL
->GetParagraphCount() - 1)
1822 sal_uInt16 nDepth
= pOL
->GetDepth(aSel
.nEndPara
);
1823 //there exists a previous numbering level
1824 if (nDepth
!= sal_uInt16(-1) && nDepth
< 8)
1826 sal_uInt16 nNewDepth
= nDepth
+1;
1827 pOL
->Insert(SD_RESSTR(STR_PRESOBJ_MPOUTLINE
+nNewDepth
), EE_PARA_APPEND
, nNewDepth
);
1836 case SID_INSERT_FLD_DATE_FIX
:
1837 case SID_INSERT_FLD_DATE_VAR
:
1838 case SID_INSERT_FLD_TIME_FIX
:
1839 case SID_INSERT_FLD_TIME_VAR
:
1840 case SID_INSERT_FLD_AUTHOR
:
1841 case SID_INSERT_FLD_PAGE
:
1842 case SID_INSERT_FLD_PAGE_TITLE
:
1843 case SID_INSERT_FLD_PAGES
:
1844 case SID_INSERT_FLD_FILE
:
1846 sal_uInt16 nMul
= 1;
1847 boost::scoped_ptr
<SvxFieldItem
> pFieldItem
;
1851 case SID_INSERT_FLD_DATE_FIX
:
1852 pFieldItem
.reset(new SvxFieldItem(
1853 SvxDateField( Date( Date::SYSTEM
), SVXDATETYPE_FIX
), EE_FEATURE_FIELD
));
1856 case SID_INSERT_FLD_DATE_VAR
:
1857 pFieldItem
.reset(new SvxFieldItem( SvxDateField(), EE_FEATURE_FIELD
));
1860 case SID_INSERT_FLD_TIME_FIX
:
1861 pFieldItem
.reset(new SvxFieldItem(
1862 SvxExtTimeField( ::tools::Time( ::tools::Time::SYSTEM
), SVXTIMETYPE_FIX
), EE_FEATURE_FIELD
));
1865 case SID_INSERT_FLD_TIME_VAR
:
1866 pFieldItem
.reset(new SvxFieldItem( SvxExtTimeField(), EE_FEATURE_FIELD
));
1869 case SID_INSERT_FLD_AUTHOR
:
1871 SvtUserOptions aUserOptions
;
1872 pFieldItem
.reset(new SvxFieldItem(
1874 aUserOptions
.GetFirstName(), aUserOptions
.GetLastName(), aUserOptions
.GetID() ), EE_FEATURE_FIELD
));
1878 case SID_INSERT_FLD_PAGE
:
1880 pFieldItem
.reset(new SvxFieldItem( SvxPageField(), EE_FEATURE_FIELD
));
1885 case SID_INSERT_FLD_PAGE_TITLE
:
1887 pFieldItem
.reset(new SvxFieldItem( SvxPageTitleField(), EE_FEATURE_FIELD
));
1892 case SID_INSERT_FLD_PAGES
:
1894 pFieldItem
.reset(new SvxFieldItem( SvxPagesField(), EE_FEATURE_FIELD
));
1899 case SID_INSERT_FLD_FILE
:
1902 if( GetDocSh()->HasName() )
1903 aName
= GetDocSh()->GetMedium()->GetName();
1904 pFieldItem
.reset(new SvxFieldItem( SvxExtFileField( aName
), EE_FEATURE_FIELD
));
1909 OutlinerView
* pOLV
= mpDrawView
->GetTextEditOutlinerView();
1913 const SvxFieldItem
* pOldFldItem
= pOLV
->GetFieldAtSelection();
1915 if( pOldFldItem
&& ( pOldFldItem
->GetField()->ISA( SvxURLField
) ||
1916 pOldFldItem
->GetField()->ISA( SvxDateField
) ||
1917 pOldFldItem
->GetField()->ISA( SvxTimeField
) ||
1918 pOldFldItem
->GetField()->ISA( SvxExtTimeField
) ||
1919 pOldFldItem
->GetField()->ISA( SvxExtFileField
) ||
1920 pOldFldItem
->GetField()->ISA( SvxAuthorField
) ||
1921 pOldFldItem
->GetField()->ISA( SvxPageField
) ) )
1923 // select field, then it will be deleted when inserting
1924 ESelection aSel
= pOLV
->GetSelection();
1925 if( aSel
.nStartPos
== aSel
.nEndPos
)
1927 pOLV
->SetSelection( aSel
);
1931 pOLV
->InsertField( *pFieldItem
);
1935 Outliner
* pOutl
= GetDoc()->GetInternalOutliner();
1936 pOutl
->Init( OUTLINERMODE_TEXTOBJECT
);
1937 sal_uInt16 nOutlMode
= pOutl
->GetMode();
1938 pOutl
->SetStyleSheet( 0, NULL
);
1939 pOutl
->QuickInsertField( *pFieldItem
, ESelection() );
1940 OutlinerParaObject
* pOutlParaObject
= pOutl
->CreateParaObject();
1942 SdrRectObj
* pRectObj
= new SdrRectObj( OBJ_TEXT
);
1943 pRectObj
->SetMergedItem(makeSdrTextAutoGrowWidthItem(true));
1945 pOutl
->UpdateFields();
1946 pOutl
->SetUpdateMode( true );
1947 Size
aSize( pOutl
->CalcTextSize() );
1948 aSize
.Width() *= nMul
;
1949 pOutl
->SetUpdateMode( false );
1952 Rectangle
aRect( aPos
, GetActiveWindow()->GetOutputSizePixel() );
1953 aPos
= aRect
.Center();
1954 aPos
= GetActiveWindow()->PixelToLogic(aPos
);
1955 aPos
.X() -= aSize
.Width() / 2;
1956 aPos
.Y() -= aSize
.Height() / 2;
1958 Rectangle
aLogicRect(aPos
, aSize
);
1959 pRectObj
->SetLogicRect(aLogicRect
);
1960 pRectObj
->SetOutlinerParaObject( pOutlParaObject
);
1961 mpDrawView
->InsertObjectAtView(pRectObj
, *mpDrawView
->GetSdrPageView());
1962 pOutl
->Init( nOutlMode
);
1972 case SID_MODIFY_FIELD
:
1974 OutlinerView
* pOLV
= mpDrawView
->GetTextEditOutlinerView();
1978 const SvxFieldItem
* pFldItem
= pOLV
->GetFieldAtSelection();
1980 if( pFldItem
&& (pFldItem
->GetField()->ISA( SvxDateField
) ||
1981 pFldItem
->GetField()->ISA( SvxAuthorField
) ||
1982 pFldItem
->GetField()->ISA( SvxExtFileField
) ||
1983 pFldItem
->GetField()->ISA( SvxExtTimeField
) ) )
1986 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
1987 boost::scoped_ptr
<AbstractSdModifyFieldDlg
> pDlg(pFact
? pFact
->CreateSdModifyFieldDlg(GetActiveWindow(), pFldItem
->GetField(), pOLV
->GetAttribs() ) : 0);
1988 if( pDlg
&& pDlg
->Execute() == RET_OK
)
1990 // To make a correct SetAttribs() call at the utlinerView
1991 // it is necessary to split the actions here
1992 boost::scoped_ptr
<SvxFieldData
> pField(pDlg
->GetField());
1993 ESelection aSel
= pOLV
->GetSelection();
1994 bool bSelectionWasModified(false);
1998 SvxFieldItem
aFieldItem( *pField
, EE_FEATURE_FIELD
);
2000 if( aSel
.nStartPos
== aSel
.nEndPos
)
2002 bSelectionWasModified
= true;
2004 pOLV
->SetSelection( aSel
);
2007 pOLV
->InsertField( aFieldItem
);
2009 // select again for eventual SetAttribs call
2010 pOLV
->SetSelection( aSel
);
2013 SfxItemSet
aSet( pDlg
->GetItemSet() );
2017 pOLV
->SetAttribs( aSet
);
2019 ::Outliner
* pOutliner
= pOLV
->GetOutliner();
2021 pOutliner
->UpdateFields();
2026 // restore selection to original
2027 if(bSelectionWasModified
)
2030 pOLV
->SetSelection( aSel
);
2042 case SID_OPEN_XML_FILTERSETTINGS
:
2046 css::uno::Reference
< css::ui::dialogs::XExecutableDialog
> xDialog
= css::ui::dialogs::XSLTFilterDialog::create( ::comphelper::getProcessComponentContext() );
2049 catch( ::com::sun::star::uno::RuntimeException
& )
2051 DBG_UNHANDLED_EXCEPTION();
2059 case SID_GROUP
: // BASIC
2061 if ( mpDrawView
->IsPresObjSelected( true, true, true ) )
2063 ::sd::Window
* pWindow
= GetActiveWindow();
2064 ScopedVclPtr
<InfoBox
>::Create(pWindow
, SD_RESSTR(STR_ACTION_NOTPOSSIBLE
))->Execute();
2068 mpDrawView
->GroupMarked();
2075 case SID_UNGROUP
: // BASIC
2077 mpDrawView
->UnGroupMarked();
2083 case SID_NAME_GROUP
:
2085 // only allow for single object selection since the name of an object needs
2087 if(1 == mpDrawView
->GetMarkedObjectCount())
2090 SdrObject
* pSelected
= mpDrawView
->GetMarkedObjectByIndex(0);
2091 OSL_ENSURE(pSelected
, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
2092 OUString
aName(pSelected
->GetName());
2094 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
2095 OSL_ENSURE(pFact
, "Dialog creation failed!");
2096 boost::scoped_ptr
<AbstractSvxObjectNameDialog
> pDlg(pFact
->CreateSvxObjectNameDialog(NULL
, aName
));
2097 OSL_ENSURE(pDlg
, "Dialog creation failed!");
2099 pDlg
->SetCheckNameHdl(LINK(this, DrawViewShell
, NameObjectHdl
));
2101 if(RET_OK
== pDlg
->Execute())
2103 pDlg
->GetName(aName
);
2104 pSelected
->SetName(aName
);
2108 SfxBindings
& rBindings
= GetViewFrame()->GetBindings();
2109 rBindings
.Invalidate( SID_NAVIGATOR_STATE
, true, false );
2110 rBindings
.Invalidate( SID_CONTEXT
);
2118 case SID_OBJECT_TITLE_DESCRIPTION
:
2120 if(1 == mpDrawView
->GetMarkedObjectCount())
2122 SdrObject
* pSelected
= mpDrawView
->GetMarkedObjectByIndex(0);
2123 OSL_ENSURE(pSelected
, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
2124 OUString
aTitle(pSelected
->GetTitle());
2125 OUString
aDescription(pSelected
->GetDescription());
2127 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
2128 OSL_ENSURE(pFact
, "Dialog creation failed!");
2129 boost::scoped_ptr
<AbstractSvxObjectTitleDescDialog
> pDlg(pFact
->CreateSvxObjectTitleDescDialog(NULL
, aTitle
, aDescription
));
2130 OSL_ENSURE(pDlg
, "Dialog creation failed!");
2132 if(RET_OK
== pDlg
->Execute())
2134 pDlg
->GetTitle(aTitle
);
2135 pDlg
->GetDescription(aDescription
);
2136 pSelected
->SetTitle(aTitle
);
2137 pSelected
->SetDescription(aDescription
);
2141 SfxBindings
& rBindings
= GetViewFrame()->GetBindings();
2142 rBindings
.Invalidate( SID_NAVIGATOR_STATE
, true, false );
2143 rBindings
.Invalidate( SID_CONTEXT
);
2150 case SID_ENTER_GROUP
: // BASIC
2152 mpDrawView
->EnterMarkedGroup();
2158 case SID_LEAVE_GROUP
: // BASIC
2160 mpDrawView
->LeaveOneGroup();
2166 case SID_LEAVE_ALL_GROUPS
: // BASIC
2168 mpDrawView
->LeaveAllGroup();
2174 case SID_COMBINE
: // BASIC
2176 // End text edit to avoid conflicts
2177 if(mpDrawView
->IsTextEdit())
2178 mpDrawView
->SdrEndTextEdit();
2180 if ( mpDrawView
->IsPresObjSelected() )
2182 ::sd::Window
* pWindow
= GetActiveWindow();
2183 ScopedVclPtr
<InfoBox
>::Create(pWindow
, SD_RESSTR(STR_ACTION_NOTPOSSIBLE
))->Execute();
2187 WaitObject
aWait( (Window
*)GetActiveWindow() );
2188 mpDrawView
->CombineMarkedObjects(false);
2195 case SID_DISTRIBUTE_DLG
:
2197 if ( mpDrawView
->IsPresObjSelected() )
2199 ::sd::Window
* pWindow
= GetActiveWindow();
2200 ScopedVclPtr
<InfoBox
>::Create(pWindow
, SD_RESSTR(STR_ACTION_NOTPOSSIBLE
))->Execute();
2204 mpDrawView
->DistributeMarkedObjects();
2211 case SID_POLY_MERGE
:
2213 // End text edit to avoid conflicts
2214 if(mpDrawView
->IsTextEdit())
2215 mpDrawView
->SdrEndTextEdit();
2217 if ( mpDrawView
->IsPresObjSelected() )
2219 ::sd::Window
* pWindow
= GetActiveWindow();
2220 ScopedVclPtr
<InfoBox
>::Create(pWindow
, SD_RESSTR(STR_ACTION_NOTPOSSIBLE
))->Execute();
2224 WaitObject
aWait( (Window
*)GetActiveWindow() );
2225 mpDrawView
->MergeMarkedObjects(SDR_MERGE_MERGE
);
2232 case SID_POLY_SUBSTRACT
:
2234 // End text edit to avoid conflicts
2235 if(mpDrawView
->IsTextEdit())
2236 mpDrawView
->SdrEndTextEdit();
2238 if ( mpDrawView
->IsPresObjSelected() )
2240 ::sd::Window
* pWindow
= GetActiveWindow();
2241 ScopedVclPtr
<InfoBox
>::Create(pWindow
, SD_RESSTR(STR_ACTION_NOTPOSSIBLE
))->Execute();
2245 WaitObject
aWait( (Window
*)GetActiveWindow() );
2246 mpDrawView
->MergeMarkedObjects(SDR_MERGE_SUBSTRACT
);
2253 case SID_POLY_INTERSECT
:
2255 // End text edit to avoid conflicts
2256 if(mpDrawView
->IsTextEdit())
2257 mpDrawView
->SdrEndTextEdit();
2259 if ( mpDrawView
->IsPresObjSelected() )
2261 ::sd::Window
* pWindow
= GetActiveWindow();
2262 ScopedVclPtr
<InfoBox
>::Create(pWindow
, SD_RESSTR(STR_ACTION_NOTPOSSIBLE
))->Execute();
2266 WaitObject
aWait( (Window
*)GetActiveWindow() );
2267 mpDrawView
->MergeMarkedObjects(SDR_MERGE_INTERSECT
);
2274 case SID_DISMANTLE
: // BASIC
2276 if ( mpDrawView
->IsDismantlePossible(false) )
2278 WaitObject
aWait( (Window
*)GetActiveWindow() );
2279 mpDrawView
->DismantleMarkedObjects(false);
2286 case SID_CONNECT
: // BASIC
2288 if ( mpDrawView
->IsPresObjSelected() )
2290 ::sd::Window
* pWindow
= GetActiveWindow();
2291 ScopedVclPtr
<InfoBox
>::Create(pWindow
, SD_RESSTR(STR_ACTION_NOTPOSSIBLE
))->Execute();
2295 WaitObject
aWait( (Window
*)GetActiveWindow() );
2296 mpDrawView
->CombineMarkedObjects(true);
2303 case SID_BREAK
: // BASIC
2305 if ( mpDrawView
->IsTextEdit() )
2307 mpDrawView
->SdrEndTextEdit();
2310 if ( mpDrawView
->IsBreak3DObjPossible() )
2312 WaitObject
aWait( (Window
*)GetActiveWindow() );
2313 mpDrawView
->Break3DObj();
2315 else if ( mpDrawView
->IsDismantlePossible(true) )
2317 WaitObject
aWait( (Window
*)GetActiveWindow() );
2318 mpDrawView
->DismantleMarkedObjects(true);
2320 else if ( mpDrawView
->IsImportMtfPossible() )
2322 WaitObject
aWait( (Window
*)GetActiveWindow() );
2323 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
2324 const size_t nAnz
=rMarkList
.GetMarkCount();
2326 // determine the sum of meta objects of all selected meta files
2327 sal_uLong nCount
= 0;
2328 for(size_t nm
=0; nm
<nAnz
; ++nm
)
2330 SdrMark
* pM
=rMarkList
.GetMark(nm
);
2331 SdrObject
* pObj
=pM
->GetMarkedSdrObj();
2332 SdrGrafObj
* pGraf
=PTR_CAST(SdrGrafObj
,pObj
);
2333 SdrOle2Obj
* pOle2
=PTR_CAST(SdrOle2Obj
,pObj
);
2337 if(pGraf
->HasGDIMetaFile())
2339 nCount
+= pGraf
->GetGraphic().GetGDIMetaFile().GetActionSize();
2341 else if(pGraf
->isEmbeddedSvg())
2343 nCount
+= pGraf
->getMetafileFromEmbeddedSvg().GetActionSize();
2347 if(pOle2
&& pOle2
->GetGraphic())
2349 nCount
+= pOle2
->GetGraphic()->GetGDIMetaFile().GetActionSize();
2353 // decide with the sum of all meta objects if we should show a dialog
2354 if(nCount
< MIN_ACTIONS_FOR_DIALOG
)
2357 mpDrawView
->DoImportMarkedMtf();
2361 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
2364 boost::scoped_ptr
<VclAbstractDialog
> pDlg(pFact
->CreateBreakDlg(GetActiveWindow(), mpDrawView
, GetDocSh(), nCount
, static_cast<sal_uLong
>(nAnz
) ));
2378 case SID_CONVERT_TO_3D
:
2380 if ( mpDrawView
->IsPresObjSelected() )
2382 ::sd::Window
* pWindow
= GetActiveWindow();
2383 ScopedVclPtr
<InfoBox
>::Create(pWindow
, SD_RESSTR(STR_ACTION_NOTPOSSIBLE
))->Execute();
2387 if (mpDrawView
->IsConvertTo3DObjPossible())
2389 if (mpDrawView
->IsTextEdit())
2391 mpDrawView
->SdrEndTextEdit();
2394 WaitObject
aWait( (Window
*)GetActiveWindow() );
2395 mpDrawView
->ConvertMarkedObjTo3D(true);
2404 case SID_FRAME_TO_TOP
: // BASIC
2406 mpDrawView
->PutMarkedToTop();
2408 Invalidate( SID_POSITION
);
2413 case SID_MOREFRONT
: // BASIC
2415 mpDrawView
->MovMarkedToTop();
2417 Invalidate( SID_POSITION
);
2422 case SID_MOREBACK
: // BASIC
2424 mpDrawView
->MovMarkedToBtm();
2426 Invalidate( SID_POSITION
);
2431 case SID_FRAME_TO_BOTTOM
: // BASIC
2433 mpDrawView
->PutMarkedToBtm();
2435 Invalidate( SID_POSITION
);
2440 case SID_HORIZONTAL
: // BASIC
2441 case SID_FLIP_HORIZONTAL
:
2443 mpDrawView
->MirrorAllMarkedHorizontal();
2449 case SID_VERTICAL
: // BASIC
2450 case SID_FLIP_VERTICAL
:
2452 mpDrawView
->MirrorAllMarkedVertical();
2458 case SID_OBJECT_ALIGN_LEFT
: // BASIC
2460 mpDrawView
->AlignMarkedObjects(SDRHALIGN_LEFT
, SDRVALIGN_NONE
);
2466 case SID_OBJECT_ALIGN_CENTER
: // BASIC
2468 mpDrawView
->AlignMarkedObjects(SDRHALIGN_CENTER
, SDRVALIGN_NONE
);
2474 case SID_OBJECT_ALIGN_RIGHT
: // BASIC
2476 mpDrawView
->AlignMarkedObjects(SDRHALIGN_RIGHT
, SDRVALIGN_NONE
);
2482 case SID_OBJECT_ALIGN_UP
: // BASIC
2484 mpDrawView
->AlignMarkedObjects(SDRHALIGN_NONE
, SDRVALIGN_TOP
);
2490 case SID_OBJECT_ALIGN_MIDDLE
: // BASIC
2492 mpDrawView
->AlignMarkedObjects(SDRHALIGN_NONE
, SDRVALIGN_CENTER
);
2498 case SID_OBJECT_ALIGN_DOWN
: // BASIC
2500 mpDrawView
->AlignMarkedObjects(SDRHALIGN_NONE
, SDRVALIGN_BOTTOM
);
2506 case SID_SELECTALL
: // BASIC
2508 if( (dynamic_cast<FuSelection
*>( GetOldFunction().get() ) != 0) &&
2509 !GetView()->IsFrameDragSingles() && GetView()->HasMarkablePoints())
2511 if ( !mpDrawView
->IsAction() )
2512 mpDrawView
->MarkAllPoints();
2515 mpDrawView
->SelectAll();
2522 case SID_STYLE_NEW
: // BASIC ???
2523 case SID_STYLE_APPLY
:
2524 case SID_STYLE_EDIT
:
2525 case SID_STYLE_DELETE
:
2526 case SID_STYLE_HIDE
:
2527 case SID_STYLE_SHOW
:
2528 case SID_STYLE_FAMILY
:
2529 case SID_STYLE_WATERCAN
:
2530 case SID_STYLE_UPDATE_BY_EXAMPLE
:
2531 case SID_STYLE_NEW_BY_EXAMPLE
:
2533 if( rReq
.GetSlot() == SID_STYLE_EDIT
&& !rReq
.GetArgs() )
2535 SfxStyleSheet
* pStyleSheet
= mpDrawView
->GetStyleSheet();
2536 if( pStyleSheet
&& pStyleSheet
->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE
)
2537 pStyleSheet
= static_cast<SdStyleSheet
*>(pStyleSheet
)->GetPseudoStyleSheet();
2539 if( (pStyleSheet
== NULL
) && GetView()->IsTextEdit() )
2541 GetView()->SdrEndTextEdit();
2543 pStyleSheet
= mpDrawView
->GetStyleSheet();
2544 if(pStyleSheet
&& pStyleSheet
->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE
)
2545 pStyleSheet
= static_cast<SdStyleSheet
*>(pStyleSheet
)->GetPseudoStyleSheet();
2548 if( pStyleSheet
== NULL
)
2554 SfxAllItemSet
aSet(GetDoc()->GetPool());
2556 SfxStringItem
aStyleNameItem( SID_STYLE_EDIT
, pStyleSheet
->GetName() );
2557 aSet
.Put(aStyleNameItem
);
2559 SfxUInt16Item
aStyleFamilyItem( SID_STYLE_FAMILY
, (sal_uInt16
)pStyleSheet
->GetFamily() );
2560 aSet
.Put(aStyleFamilyItem
);
2565 if( rReq
.GetArgs() )
2567 SetCurrentFunction( FuTemplate::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
2568 if( rReq
.GetSlot() == SID_STYLE_APPLY
)
2569 GetViewFrame()->GetBindings().Invalidate( SID_STYLE_APPLY
);
2572 else if( rReq
.GetSlot() == SID_STYLE_APPLY
)
2573 GetViewFrame()->GetDispatcher()->Execute( SID_STYLE_DESIGNER
, SfxCallMode::ASYNCHRON
);
2580 sal_uInt16 nId
= SvxIMapDlgChildWindow::GetChildWindowId();
2582 GetViewFrame()->ToggleChildWindow( nId
);
2583 GetViewFrame()->GetBindings().Invalidate( SID_IMAP
);
2585 if ( GetViewFrame()->HasChildWindow( nId
)
2586 && ( ( ViewShell::Implementation::GetImageMapDialog() ) != NULL
) )
2588 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
2590 if ( rMarkList
.GetMarkCount() == 1 )
2591 UpdateIMapDlg( rMarkList
.GetMark( 0 )->GetMarkedSdrObj() );
2599 case SID_GRID_FRONT
:
2601 mpDrawView
->SetGridFront( !mpDrawView
->IsGridFront() );
2607 case SID_HELPLINES_FRONT
:
2609 mpDrawView
->SetHlplFront( !mpDrawView
->IsHlplFront() );
2617 if ( rReq
.GetArgs() )
2619 GetViewFrame()->SetChildWindow(SvxFontWorkChildWindow::GetChildWindowId(),
2620 static_cast<const SfxBoolItem
&>(rReq
.GetArgs()->
2621 Get(SID_FONTWORK
)).GetValue());
2625 GetViewFrame()->ToggleChildWindow( SvxFontWorkChildWindow::GetChildWindowId() );
2628 GetViewFrame()->GetBindings().Invalidate(SID_FONTWORK
);
2634 case SID_COLOR_CONTROL
:
2636 if ( rReq
.GetArgs() )
2637 GetViewFrame()->SetChildWindow(SvxColorChildWindow::GetChildWindowId(),
2638 static_cast<const SfxBoolItem
&>(rReq
.GetArgs()->
2639 Get(SID_COLOR_CONTROL
)).GetValue());
2641 GetViewFrame()->ToggleChildWindow(SvxColorChildWindow::GetChildWindowId() );
2643 GetViewFrame()->GetBindings().Invalidate(SID_COLOR_CONTROL
);
2649 case SID_EXTRUSION_TOOGLE
:
2650 case SID_EXTRUSION_TILT_DOWN
:
2651 case SID_EXTRUSION_TILT_UP
:
2652 case SID_EXTRUSION_TILT_LEFT
:
2653 case SID_EXTRUSION_TILT_RIGHT
:
2654 case SID_EXTRUSION_3D_COLOR
:
2655 case SID_EXTRUSION_DEPTH
:
2656 case SID_EXTRUSION_DIRECTION
:
2657 case SID_EXTRUSION_PROJECTION
:
2658 case SID_EXTRUSION_LIGHTING_DIRECTION
:
2659 case SID_EXTRUSION_LIGHTING_INTENSITY
:
2660 case SID_EXTRUSION_SURFACE
:
2661 case SID_EXTRUSION_DEPTH_FLOATER
:
2662 case SID_EXTRUSION_DIRECTION_FLOATER
:
2663 case SID_EXTRUSION_LIGHTING_FLOATER
:
2664 case SID_EXTRUSION_SURFACE_FLOATER
:
2665 case SID_EXTRUSION_DEPTH_DIALOG
:
2666 svx::ExtrusionBar::execute( mpDrawView
, rReq
, GetViewFrame()->GetBindings() );
2671 case SID_FONTWORK_SHAPE
:
2672 case SID_FONTWORK_SHAPE_TYPE
:
2673 case SID_FONTWORK_ALIGNMENT
:
2674 case SID_FONTWORK_SAME_LETTER_HEIGHTS
:
2675 case SID_FONTWORK_CHARACTER_SPACING
:
2676 case SID_FONTWORK_KERN_CHARACTER_PAIRS
:
2677 case SID_FONTWORK_GALLERY_FLOATER
:
2678 case SID_FONTWORK_CHARACTER_SPACING_FLOATER
:
2679 case SID_FONTWORK_ALIGNMENT_FLOATER
:
2680 case SID_FONTWORK_CHARACTER_SPACING_DIALOG
:
2681 svx::FontworkBar::execute( mpDrawView
, rReq
, GetViewFrame()->GetBindings() );
2688 GetViewFrame()->ToggleChildWindow( SvxBmpMaskChildWindow::GetChildWindowId() );
2689 GetViewFrame()->GetBindings().Invalidate( SID_BMPMASK
);
2698 if ( rReq
.GetArgs() )
2699 GetViewFrame()->SetChildWindow(SID_NAVIGATOR
,
2700 static_cast<const SfxBoolItem
&>(rReq
.GetArgs()->
2701 Get(SID_NAVIGATOR
)).GetValue());
2703 GetViewFrame()->ToggleChildWindow( SID_NAVIGATOR
);
2705 GetViewFrame()->GetBindings().Invalidate(SID_NAVIGATOR
);
2711 case SID_SLIDE_TRANSITIONS_PANEL
:
2712 case SID_CUSTOM_ANIMATION_PANEL
:
2715 // First make sure that the sidebar is visible
2716 GetViewFrame()->ShowChildWindow(SID_SIDEBAR
);
2719 if (nSId
== SID_CUSTOM_ANIMATION_PANEL
)
2720 panelId
= CustomAnimationPanelId
;
2721 else if (nSId
== SID_GALLERY
)
2722 panelId
= GalleryPanelId
;
2723 else if (nSId
== SID_SLIDE_TRANSITIONS_PANEL
)
2724 panelId
= SlideTransitionPanelId
;
2726 ::sfx2::sidebar::Sidebar::ShowPanel(
2728 GetViewFrame()->GetFrame().GetFrameInterface());
2735 case SID_ANIMATION_OBJECTS
:
2737 if ( rReq
.GetArgs() )
2738 GetViewFrame()->SetChildWindow(
2739 AnimationChildWindow::GetChildWindowId(),
2740 static_cast<const SfxBoolItem
&>(rReq
.GetArgs()->
2741 Get(SID_ANIMATION_OBJECTS
)).GetValue());
2743 GetViewFrame()->ToggleChildWindow(
2744 AnimationChildWindow::GetChildWindowId() );
2746 GetViewFrame()->GetBindings().Invalidate(SID_ANIMATION_OBJECTS
);
2754 if ( rReq
.GetArgs() )
2755 GetViewFrame()->SetChildWindow( Svx3DChildWindow::GetChildWindowId(),
2756 static_cast<const SfxBoolItem
&>(rReq
.GetArgs()->
2757 Get( SID_3D_WIN
)).GetValue());
2759 GetViewFrame()->ToggleChildWindow( Svx3DChildWindow::GetChildWindowId() );
2761 GetViewFrame()->GetBindings().Invalidate( SID_3D_WIN
);
2767 case SID_CONVERT_TO_3D_LATHE_FAST
:
2769 /* The call is enough. The initialization via Start3DCreation and
2770 CreateMirrorPolygons is no longer needed if the parameter
2771 sal_True is provided. Then a tilted rotary body with an axis left
2772 besides the bounding rectangle of the selected objects is drawn
2773 immediately and without user interaction. */
2774 mpDrawView
->SdrEndTextEdit();
2775 if(GetActiveWindow())
2776 GetActiveWindow()->EnterWait();
2777 mpDrawView
->End3DCreation(true);
2780 if(GetActiveWindow())
2781 GetActiveWindow()->LeaveWait();
2785 case SID_PRESENTATION_DLG
:
2787 SetCurrentFunction( FuSlideShowDlg::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
2792 case SID_REMOTE_DLG
:
2794 #ifdef ENABLE_SDREMOTE
2795 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
2796 VclAbstractDialog
* pDlg
= pFact
? pFact
->CreateRemoteDialog(GetActiveWindow()) : 0;
2803 case SID_CUSTOMSHOW_DLG
:
2805 SetCurrentFunction( FuCustomShowDlg::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
2810 case SID_EXPAND_PAGE
:
2812 SetCurrentFunction( FuExpandPage::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
2817 case SID_SUMMARY_PAGE
:
2819 mpDrawView
->SdrEndTextEdit();
2820 SetCurrentFunction( FuSummaryPage::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
2825 case SID_AVMEDIA_PLAYER
:
2827 GetViewFrame()->ToggleChildWindow( ::avmedia::MediaPlayer::GetChildWindowId() );
2828 GetViewFrame()->GetBindings().Invalidate( SID_AVMEDIA_PLAYER
);
2834 case SID_PRESENTATION_MINIMIZER
:
2836 Reference
<XComponentContext
> xContext(::comphelper::getProcessComponentContext());
2837 Reference
<util::XURLTransformer
> xParser(util::URLTransformer::create(xContext
));
2838 Reference
<frame::XDispatchProvider
> xProvider(GetViewShellBase().GetController()->getFrame(), UNO_QUERY
);
2842 aURL
.Complete
= "vnd.com.sun.star.comp.PresentationMinimizer:execute";
2843 xParser
->parseStrict(aURL
);
2844 uno::Reference
<frame::XDispatch
> xDispatch(xProvider
->queryDispatch(aURL
, OUString(), 0));
2847 xDispatch
->dispatch(aURL
, uno::Sequence
< beans::PropertyValue
>());
2855 case SID_DISPLAY_MASTER_BACKGROUND
:
2856 case SID_DISPLAY_MASTER_OBJECTS
:
2858 // Determine current page and toggle visibility of layers
2859 // associated with master page background or master page shapes.
2860 SdPage
* pPage
= GetActualPage();
2862 && GetDoc() != NULL
)
2864 SetOfByte aVisibleLayers
= pPage
->TRG_GetMasterPageVisibleLayers();
2865 SdrLayerAdmin
& rLayerAdmin
= GetDoc()->GetLayerAdmin();
2867 if (nSId
== SID_DISPLAY_MASTER_BACKGROUND
)
2868 aLayerId
= rLayerAdmin
.GetLayerID(SD_RESSTR(STR_LAYER_BCKGRND
), false);
2870 aLayerId
= rLayerAdmin
.GetLayerID(SD_RESSTR(STR_LAYER_BCKGRNDOBJ
), false);
2871 aVisibleLayers
.Set(aLayerId
, !aVisibleLayers
.IsSet(aLayerId
));
2872 pPage
->TRG_SetMasterPageVisibleLayers(aVisibleLayers
);
2879 case SID_PHOTOALBUM
:
2881 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
2882 boost::scoped_ptr
<VclAbstractDialog
> pDlg(pFact
? pFact
->CreateSdPhotoAlbumDialog(
2898 DBG_ASSERT( false, "Slot without function" );
2905 if(HasCurrentFunction())
2907 GetCurrentFunction()->Activate();
2911 void DrawViewShell::ExecChar( SfxRequest
&rReq
)
2913 SdDrawDocument
* pDoc
= GetDoc();
2914 if (!pDoc
|| !mpDrawView
)
2917 SfxItemSet
aEditAttr( pDoc
->GetPool() );
2918 mpDrawView
->GetAttributes( aEditAttr
);
2920 //modified by wj for sym2_1580, if put old itemset into new set,
2921 //when mpDrawView->SetAttributes(aNewAttr) it will invalidate all the item
2922 // and use old attr to update all the attributes
2923 // SfxItemSet aNewAttr( GetPool(),
2924 // EE_ITEMS_START, EE_ITEMS_END );
2925 // aNewAttr.Put( aEditAttr, sal_False );
2926 SfxItemSet
aNewAttr( pDoc
->GetPool() );
2929 sal_uInt16 nSId
= rReq
.GetSlot();
2935 case SID_ATTR_CHAR_FONT
:
2936 if( rReq
.GetArgs() )
2938 SFX_REQUEST_ARG( rReq
, pItem
, SvxFontItem
, SID_ATTR_CHAR_FONT
, false );
2941 aNewAttr
.Put(*pItem
);
2945 case SID_ATTR_CHAR_FONTHEIGHT
:
2946 if( rReq
.GetArgs() )
2948 SFX_REQUEST_ARG( rReq
, pItem
, SvxFontHeightItem
, SID_ATTR_CHAR_FONTHEIGHT
, false );
2951 aNewAttr
.Put(*pItem
);
2955 case SID_ATTR_CHAR_WEIGHT
:
2956 if( rReq
.GetArgs() )
2958 //const SvxWeightItem *pItem = (const SvxWeightItem*) rReq.GetArg( SID_ATTR_CHAR_WEIGHT, sal_False, TYPE(SvxWeightItem) );
2959 SFX_REQUEST_ARG( rReq
, pItem
, SvxWeightItem
, SID_ATTR_CHAR_WEIGHT
, false );
2962 aNewAttr
.Put(*pItem
);
2966 case SID_ATTR_CHAR_POSTURE
:
2967 if( rReq
.GetArgs() )
2969 //const SvxPostureItem *pItem = (const SvxPostureItem*) rReq.GetArg( SID_ATTR_CHAR_POSTURE, sal_False, TYPE(SvxPostureItem) );
2970 SFX_REQUEST_ARG( rReq
, pItem
, SvxPostureItem
, SID_ATTR_CHAR_POSTURE
, false );
2973 aNewAttr
.Put(*pItem
);
2977 case SID_ATTR_CHAR_UNDERLINE
:
2978 if( rReq
.GetArgs() )
2980 //<<modify by wj for sym2_1873
2981 //SFX_REQUEST_ARG( rReq, pItem, SvxTextLineItem, SID_ATTR_CHAR_UNDERLINE , sal_False );
2982 SFX_REQUEST_ARG( rReq
, pItem
, SvxUnderlineItem
, SID_ATTR_CHAR_UNDERLINE
, false );
2986 aNewAttr
.Put(*pItem
);
2990 FontUnderline eFU
= static_cast<const SvxUnderlineItem
&>( aEditAttr
.Get( EE_CHAR_UNDERLINE
) ).GetLineStyle();
2991 aNewAttr
.Put( SvxUnderlineItem( eFU
!= UNDERLINE_NONE
?UNDERLINE_NONE
: UNDERLINE_SINGLE
, EE_CHAR_UNDERLINE
) );
2992 }//aNewAttr.Put( (const SvxUnderlineItem&)aEditAttr.Get( EE_CHAR_UNDERLINE ) );
2995 case SID_ATTR_CHAR_SHADOWED
:
2996 if( rReq
.GetArgs() )
2998 SFX_REQUEST_ARG( rReq
, pItem
, SvxShadowedItem
, SID_ATTR_CHAR_SHADOWED
, false );
3001 aNewAttr
.Put(*pItem
);
3005 case SID_ATTR_CHAR_STRIKEOUT
:
3006 if( rReq
.GetArgs() )
3008 SFX_REQUEST_ARG( rReq
, pItem
, SvxCrossedOutItem
, SID_ATTR_CHAR_STRIKEOUT
, false );
3011 aNewAttr
.Put(*pItem
);
3015 case SID_ATTR_CHAR_COLOR
:
3016 if( rReq
.GetArgs() )
3018 SFX_REQUEST_ARG( rReq
, pItem
, SvxColorItem
, SID_ATTR_CHAR_COLOR
, false );
3021 aNewAttr
.Put(*pItem
);
3025 case SID_ATTR_CHAR_KERNING
:
3026 if( rReq
.GetArgs() )
3028 SFX_REQUEST_ARG( rReq
, pItem
, SvxKerningItem
, SID_ATTR_CHAR_KERNING
, false );
3031 aNewAttr
.Put(*pItem
);
3035 case SID_SET_SUB_SCRIPT
:
3037 SvxEscapementItem
aItem( EE_CHAR_ESCAPEMENT
);
3038 SvxEscapement eEsc
= (SvxEscapement
) static_cast<const SvxEscapementItem
&>(
3039 aEditAttr
.Get( EE_CHAR_ESCAPEMENT
) ).GetEnumValue();
3040 if( eEsc
== SVX_ESCAPEMENT_SUBSCRIPT
)
3041 aItem
.SetEscapement( SVX_ESCAPEMENT_OFF
);
3043 aItem
.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT
);
3044 aNewAttr
.Put( aItem
);
3047 case SID_SET_SUPER_SCRIPT
:
3049 SvxEscapementItem
aItem( EE_CHAR_ESCAPEMENT
);
3050 SvxEscapement eEsc
= (SvxEscapement
) static_cast<const SvxEscapementItem
&>(
3051 aEditAttr
.Get( EE_CHAR_ESCAPEMENT
) ).GetEnumValue();
3052 if( eEsc
== SVX_ESCAPEMENT_SUPERSCRIPT
)
3053 aItem
.SetEscapement( SVX_ESCAPEMENT_OFF
);
3055 aItem
.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT
);
3056 aNewAttr
.Put( aItem
);
3059 case SID_SHRINK_FONT_SIZE
:
3060 case SID_GROW_FONT_SIZE
:
3062 const SvxFontListItem
* pFonts
= dynamic_cast<const SvxFontListItem
*>(GetDocSh()->GetItem( SID_ATTR_CHAR_FONTLIST
) );
3063 const FontList
* pFontList
= pFonts
? pFonts
->GetFontList() : NULL
;
3066 FuText::ChangeFontSize( nSId
== SID_GROW_FONT_SIZE
, NULL
, pFontList
, mpView
);
3067 GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONTHEIGHT
);
3074 mpDrawView
->SetAttributes(aNewAttr
);
3079 /** This method consists basically of three parts:
3080 1. Process the arguments of the SFX request.
3081 2. Use the model to create a new page or duplicate an existing one.
3082 3. Update the tab control and switch to the new page.
3084 SdPage
* DrawViewShell::CreateOrDuplicatePage (
3085 SfxRequest
& rRequest
,
3088 const sal_Int32 nInsertPosition
)
3090 SdPage
* pNewPage
= NULL
;
3091 if (ePageKind
== PK_STANDARD
&& meEditMode
!= EM_MASTERPAGE
)
3093 if ( mpDrawView
->IsTextEdit() )
3095 mpDrawView
->SdrEndTextEdit();
3097 pNewPage
= ViewShell::CreateOrDuplicatePage (rRequest
, ePageKind
, pPage
, nInsertPosition
);
3102 void DrawViewShell::ExecutePropPanelAttr (SfxRequest
& rReq
)
3104 if(SlideShow::IsRunning( GetViewShellBase() ))
3107 SdDrawDocument
* pDoc
= GetDoc();
3108 if (!pDoc
|| !mpDrawView
)
3111 sal_uInt16 nSId
= rReq
.GetSlot();
3112 SfxItemSet
aAttrs( pDoc
->GetPool() );
3116 case SID_TABLE_VERT_NONE
:
3117 case SID_TABLE_VERT_CENTER
:
3118 case SID_TABLE_VERT_BOTTOM
:
3119 SdrTextVertAdjust eTVA
= SDRTEXTVERTADJUST_TOP
;
3120 if (nSId
== SID_TABLE_VERT_CENTER
)
3121 eTVA
= SDRTEXTVERTADJUST_CENTER
;
3122 else if (nSId
== SID_TABLE_VERT_BOTTOM
)
3123 eTVA
= SDRTEXTVERTADJUST_BOTTOM
;
3125 aAttrs
.Put( SdrTextVertAdjustItem(eTVA
) );
3126 mpDrawView
->SetAttributes(aAttrs
);
3132 void DrawViewShell::GetStatePropPanelAttr(SfxItemSet
& rSet
)
3134 SfxWhichIter
aIter( rSet
);
3135 sal_uInt16 nWhich
= aIter
.FirstWhich();
3137 SdDrawDocument
* pDoc
= GetDoc();
3138 if (!pDoc
|| !mpDrawView
)
3141 SfxItemSet
aAttrs( pDoc
->GetPool() );
3142 mpDrawView
->GetAttributes( aAttrs
);
3146 sal_uInt16 nSlotId
= SfxItemPool::IsWhich(nWhich
)
3147 ? GetPool().GetSlotId(nWhich
)
3151 case SID_TABLE_VERT_NONE
:
3152 case SID_TABLE_VERT_CENTER
:
3153 case SID_TABLE_VERT_BOTTOM
:
3154 bool bContour
= false;
3155 SfxItemState eConState
= aAttrs
.GetItemState( SDRATTR_TEXT_CONTOURFRAME
);
3156 if( eConState
!= SfxItemState::DONTCARE
)
3158 bContour
= static_cast<const SdrOnOffItem
&>( aAttrs
.Get( SDRATTR_TEXT_CONTOURFRAME
) ).GetValue();
3160 if (bContour
) break;
3162 SfxItemState eVState
= aAttrs
.GetItemState( SDRATTR_TEXT_VERTADJUST
);
3163 //SfxItemState eHState = aAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST );
3165 //if(SfxItemState::DONTCARE != eVState && SfxItemState::DONTCARE != eHState)
3166 if(SfxItemState::DONTCARE
!= eVState
)
3168 SdrTextVertAdjust eTVA
= (SdrTextVertAdjust
)static_cast<const SdrTextVertAdjustItem
&>(aAttrs
.Get(SDRATTR_TEXT_VERTADJUST
)).GetValue();
3169 bool bSet
= (nSlotId
== SID_TABLE_VERT_NONE
&& eTVA
== SDRTEXTVERTADJUST_TOP
) ||
3170 (nSlotId
== SID_TABLE_VERT_CENTER
&& eTVA
== SDRTEXTVERTADJUST_CENTER
) ||
3171 (nSlotId
== SID_TABLE_VERT_BOTTOM
&& eTVA
== SDRTEXTVERTADJUST_BOTTOM
);
3172 rSet
.Put(SfxBoolItem(nSlotId
, bSet
));
3176 rSet
.Put(SfxBoolItem(nSlotId
, false));
3180 nWhich
= aIter
.NextWhich();
3184 } // end of namespace sd
3186 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */