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 <avmedia/mediaplayer.hxx>
22 #include <basic/sberrors.hxx>
23 #include <basic/sbstar.hxx>
25 #include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
26 #include <com/sun/star/drawing/XDrawPages.hpp>
27 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
28 #include <com/sun/star/ui/dialogs/XSLTFilterDialog.hpp>
30 #include <comphelper/processfactory.hxx>
32 #include <editeng/editdata.hxx>
33 #include <editeng/eeitem.hxx>
34 #include <editeng/flditem.hxx>
36 #include <sfx2/bindings.hxx>
37 #include <sfx2/dispatch.hxx>
38 #include <sfx2/docfile.hxx>
39 #include <sfx2/msgpool.hxx>
40 #include <sfx2/request.hxx>
41 #include <sfx2/viewfrm.hxx>
42 #include <sfx2/zoomitem.hxx>
44 #include <svl/aeitem.hxx>
46 #include <svx/SpellDialogChildWindow.hxx>
47 #include <svx/compressgraphicdialog.hxx>
48 #include <svx/dialogs.hrc>
49 #include <svx/bmpmask.hxx>
50 #include <svx/colrctrl.hxx>
51 #include <svx/extedit.hxx>
52 #include <svx/extrusionbar.hxx>
53 #include <svx/f3dchild.hxx>
54 #include <svx/fontwork.hxx>
55 #include <svx/fontworkbar.hxx>
56 #include <svx/galbrws.hxx>
57 #include <svx/graphichelper.hxx>
58 #include <svx/hlnkitem.hxx>
59 #include <svx/imapdlg.hxx>
60 #include <svx/sdtagitm.hxx>
61 #include <svx/sdtmfitm.hxx>
62 #include <svx/svdoattr.hxx>
63 #include <svx/svdograf.hxx>
64 #include <svx/svdoole2.hxx>
65 #include <svx/svdoutl.hxx>
66 #include <svx/svdpagv.hxx>
67 #include <svx/svdundo.hxx>
68 #include <svx/svxdlg.hxx>
69 #include <svx/svxids.hrc>
70 #include <svx/xfillit0.hxx>
71 #include <svx/xflclit.hxx>
72 #include <svx/xlineit0.hxx>
73 #include <svx/xlnedwit.hxx>
74 #include <svx/xlnstwit.hxx>
75 #include <svx/xlnwtit.hxx>
77 #include <tools/diagnose_ex.h>
79 #include <unotools/useroptions.hxx>
81 #include <vcl/graph.hxx>
82 #include <vcl/msgbox.hxx>
83 #include <vcl/svapp.hxx>
84 #include <vcl/waitobj.hxx>
86 #include <editeng/escapementitem.hxx>
87 #include <editeng/kernitem.hxx>
88 #include <editeng/wghtitem.hxx>
89 #include <editeng/postitem.hxx>
90 #include <editeng/udlnitem.hxx>
91 #include <editeng/crossedoutitem.hxx>
92 #include <editeng/contouritem.hxx>
93 #include <editeng/shdditem.hxx>
94 #include <svx/xtable.hxx>
95 #include <svx/svdobj.hxx>
96 #include <svx/SvxColorChildWindow.hxx>
97 #include <editeng/outlobj.hxx>
98 #include <editeng/flstitem.hxx>
99 #include <editeng/scripttypeitem.hxx>
100 #include <editeng/fontitem.hxx>
101 #include <editeng/fhgtitem.hxx>
102 #include <editeng/colritem.hxx>
103 #include <editeng/brushitem.hxx>
105 #include <svl/whiter.hxx>
109 #include "strings.hrc"
111 #include "framework/FrameworkHelper.hxx"
113 #include "AnimationChildWindow.hxx"
114 #include "DrawDocShell.hxx"
115 #include "DrawViewShell.hxx"
116 #include "GraphicViewShell.hxx"
117 #include "LayerDialogChildWindow.hxx"
118 #include "LayerTabBar.hxx"
119 #include "Outliner.hxx"
120 #include "ViewShellHint.hxx"
121 #include "ViewShellImplementation.hxx"
122 #include "Window.hxx"
123 #include "drawdoc.hxx"
124 #include "drawview.hxx"
125 #include "fuarea.hxx"
126 #include "fubullet.hxx"
127 #include "fuchar.hxx"
128 #include "fucushow.hxx"
129 #include "fuconnct.hxx"
130 #include "fucopy.hxx"
131 #include "fudspord.hxx"
132 #include "fuexpand.hxx"
133 #include "fuinsert.hxx"
134 #include "fuinsfil.hxx"
135 #include "fuline.hxx"
136 #include "fulinend.hxx"
137 #include "fulink.hxx"
138 #include "fumeasur.hxx"
139 #include "fumorph.hxx"
140 #include "fuoaprms.hxx"
141 #include "fuolbull.hxx"
142 #include "fupage.hxx"
143 #include "fuparagr.hxx"
144 #include "fuprlout.hxx"
145 #include "fuscale.hxx"
147 #include "fusldlg.hxx"
148 #include "fusnapln.hxx"
149 #include "fusumry.hxx"
150 #include "futempl.hxx"
151 #include "futhes.hxx"
152 #include "futransf.hxx"
153 #include "futxtatt.hxx"
154 #include "fuvect.hxx"
155 #include "futext.hxx"
156 #include "fuzoom.hxx"
158 #include "optsitem.hxx"
159 #include "sdabstdlg.hxx"
160 #include "sdattr.hxx"
161 #include "sdgrffilter.hxx"
162 #include "sdpage.hxx"
163 #include "sdresid.hxx"
164 #include "slideshow.hxx"
165 #include "stlpool.hxx"
166 #include "undolayer.hxx"
167 #include "unmodpg.hxx"
169 using namespace ::com::sun::star
;
170 using namespace ::com::sun::star::uno
;
172 #define MIN_ACTIONS_FOR_DIALOG 5000 ///< if there are more meta objects, we show a dialog during the break up
176 class SdExternalToolEdit
: public ExternalToolEdit
182 SdExternalToolEdit ( FmFormView
* pView
, SdrObject
* pObj
) :
187 virtual void Update( Graphic
& aGraphic
)
189 SdrPageView
* pPageView
= m_pView
->GetSdrPageView();
192 SdrGrafObj
* pNewObj
= (SdrGrafObj
*) m_pObj
->Clone();
193 String
aStr( m_pView
->GetDescriptionOfMarkedObjects() );
194 aStr
.Append( sal_Unicode(' ') );
195 aStr
.Append( String( "External Edit" ) );
196 m_pView
->BegUndo( aStr
);
197 pNewObj
->SetGraphicObject( aGraphic
);
198 m_pView
->ReplaceObjectAtView( m_pObj
, *pPageView
, pNewObj
);
205 * SfxRequests for temporary actions
208 void DrawViewShell::FuTemporary(SfxRequest
& rReq
)
210 // during a native slide show nothing gets executed!
211 if(SlideShow::IsRunning( GetViewShellBase() ) && (rReq
.GetSlot() != SID_NAVIGATOR
))
214 DBG_ASSERT( mpDrawView
, "sd::DrawViewShell::FuTemporary(), no draw view!" );
220 DeactivateCurrentFunction();
222 sal_uInt16 nSId
= rReq
.GetSlot();
224 // Slot gets mapped (ToolboxImages/-Slots)
229 case SID_OUTLINE_TEXT_AUTOFIT
:
231 ::svl::IUndoManager
* pUndoManager
= GetDocSh()->GetUndoManager();
232 SdrObject
* pObj
= NULL
;
233 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
234 if( rMarkList
.GetMarkCount() == 1 )
236 pUndoManager
->EnterListAction( String(), String() );
237 mpDrawView
->BegUndo();
239 pObj
= rMarkList
.GetMark(0)->GetMarkedSdrObj();
240 bool bSet
= ((const SdrTextFitToSizeTypeItem
*)pObj
->GetMergedItemSet().GetItem(SDRATTR_TEXT_FITTOSIZE
))->GetValue() != SDRTEXTFIT_NONE
;
242 mpDrawView
->AddUndo(GetDoc()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj
));
244 pObj
->SetMergedItem(SdrTextFitToSizeTypeItem(bSet
? SDRTEXTFIT_NONE
: SDRTEXTFIT_AUTOFIT
));
246 mpDrawView
->EndUndo();
247 pUndoManager
->LeaveListAction();
254 // area and line attributes: shall have
255 // an own Execute method (like StateMethode)
256 case SID_ATTR_FILL_STYLE
:
257 case SID_ATTR_FILL_COLOR
:
258 case SID_ATTR_FILL_GRADIENT
:
259 case SID_ATTR_FILL_HATCH
:
260 case SID_ATTR_FILL_BITMAP
:
261 case SID_ATTR_FILL_SHADOW
:
262 case SID_ATTR_FILL_TRANSPARENCE
:
263 case SID_ATTR_FILL_FLOATTRANSPARENCE
:
265 case SID_ATTR_LINE_STYLE
:
266 case SID_ATTR_LINE_DASH
:
267 case SID_ATTR_LINE_WIDTH
:
268 case SID_ATTR_LINE_COLOR
:
269 case SID_ATTR_LINEEND_STYLE
:
270 case SID_ATTR_LINE_START
:
271 case SID_ATTR_LINE_END
:
272 case SID_ATTR_LINE_TRANSPARENCE
:
273 case SID_ATTR_LINE_JOINT
:
274 case SID_ATTR_LINE_CAP
:
276 case SID_ATTR_TEXT_FITTOSIZE
:
280 mpDrawView
->SetAttributes(*rReq
.GetArgs());
285 switch( rReq
.GetSlot() )
287 case SID_ATTR_FILL_SHADOW
:
288 case SID_ATTR_FILL_STYLE
:
289 case SID_ATTR_FILL_COLOR
:
290 case SID_ATTR_FILL_GRADIENT
:
291 case SID_ATTR_FILL_HATCH
:
292 case SID_ATTR_FILL_BITMAP
:
293 case SID_ATTR_FILL_TRANSPARENCE
:
294 case SID_ATTR_FILL_FLOATTRANSPARENCE
:
295 GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_AREA
, SFX_CALLMODE_ASYNCHRON
);
297 case SID_ATTR_LINE_STYLE
:
298 case SID_ATTR_LINE_DASH
:
299 case SID_ATTR_LINE_WIDTH
:
300 case SID_ATTR_LINE_COLOR
:
301 case SID_ATTR_LINE_TRANSPARENCE
:
302 case SID_ATTR_LINE_JOINT
:
303 case SID_ATTR_LINE_CAP
:
304 GetViewFrame()->GetDispatcher()->Execute( SID_ATTRIBUTES_LINE
, SFX_CALLMODE_ASYNCHRON
);
306 case SID_ATTR_TEXT_FITTOSIZE
:
307 GetViewFrame()->GetDispatcher()->Execute( SID_TEXTATTR_DLG
, SFX_CALLMODE_ASYNCHRON
);
315 case SID_HYPHENATION
:
317 // const SfxPoolItem* pItem = rReq.GetArg( SID_HYPHENATION );
318 // ^-- should not be used (defaults are wrong) !
319 SFX_REQUEST_ARG( rReq
, pItem
, SfxBoolItem
, SID_HYPHENATION
, sal_False
);
323 SfxItemSet
aSet( GetPool(), EE_PARA_HYPHENATE
, EE_PARA_HYPHENATE
);
324 sal_Bool bValue
= ( (const SfxBoolItem
*) pItem
)->GetValue();
325 aSet
.Put( SfxBoolItem( EE_PARA_HYPHENATE
, bValue
) );
326 mpDrawView
->SetAttributes( aSet
);
328 else // only for testing purpose
330 OSL_FAIL(" no value for hyphenation!");
331 SfxItemSet
aSet( GetPool(), EE_PARA_HYPHENATE
, EE_PARA_HYPHENATE
);
332 sal_Bool bValue
= sal_True
;
333 aSet
.Put( SfxBoolItem( EE_PARA_HYPHENATE
, bValue
) );
334 mpDrawView
->SetAttributes( aSet
);
342 case SID_INSERTPAGE_QUICK
:
343 case SID_DUPLICATE_PAGE
:
345 SdPage
* pNewPage
= CreateOrDuplicatePage (rReq
, mePageKind
, GetActualPage());
347 if(HasCurrentFunction(SID_BEZIER_EDIT
) )
348 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT
, SFX_CALLMODE_ASYNCHRON
);
349 if (pNewPage
!= NULL
)
350 SwitchPage((pNewPage
->GetPageNum()-1)/2);
355 case SID_INSERT_MASTER_PAGE
:
357 // Use the API to create a new page.
358 Reference
<drawing::XMasterPagesSupplier
> xMasterPagesSupplier (
359 GetDoc()->getUnoModel(), UNO_QUERY
);
360 if (xMasterPagesSupplier
.is())
362 Reference
<drawing::XDrawPages
> xMasterPages (
363 xMasterPagesSupplier
->getMasterPages());
364 if (xMasterPages
.is())
366 sal_uInt16 nIndex
= GetCurPageId();
367 xMasterPages
->insertNewByIndex (nIndex
);
369 // Create shapes for the default layout.
370 SdPage
* pMasterPage
= GetDoc()->GetMasterSdPage(
371 nIndex
, PK_STANDARD
);
372 pMasterPage
->CreateTitleAndLayout (sal_True
,sal_True
);
377 if(HasCurrentFunction(SID_BEZIER_EDIT
))
378 GetViewFrame()->GetDispatcher()->Execute(
379 SID_OBJECT_SELECT
, SFX_CALLMODE_ASYNCHRON
);
386 if (mePageKind
==PK_STANDARD
|| mePageKind
==PK_NOTES
||
387 (mePageKind
==PK_HANDOUT
&& meEditMode
==EM_MASTERPAGE
) )
389 if ( mpDrawView
->IsTextEdit() )
391 mpDrawView
->SdrEndTextEdit();
393 sal_uInt16 nPage
= maTabControl
.GetCurPageId() - 1;
394 mpActualPage
= GetDoc()->GetSdPage(nPage
, mePageKind
);
395 ::sd::ViewShell::mpImpl
->ProcessModifyPageSlot (
406 case SID_ASSIGN_LAYOUT
:
408 if (mePageKind
==PK_STANDARD
|| mePageKind
==PK_NOTES
|| (mePageKind
==PK_HANDOUT
&& meEditMode
==EM_MASTERPAGE
))
410 if ( mpDrawView
->IsTextEdit() )
411 mpDrawView
->SdrEndTextEdit();
413 ::sd::ViewShell::mpImpl
->AssignLayout(rReq
, mePageKind
);
421 case SID_RENAME_MASTER_PAGE
:
423 if (mePageKind
==PK_STANDARD
|| mePageKind
==PK_NOTES
)
425 if ( mpDrawView
->IsTextEdit() )
427 mpDrawView
->SdrEndTextEdit();
430 sal_uInt16 nPageId
= maTabControl
.GetCurPageId();
431 SdPage
* pCurrentPage
= ( GetEditMode() == EM_PAGE
)
432 ? GetDoc()->GetSdPage( nPageId
- 1, GetPageKind() )
433 : GetDoc()->GetMasterSdPage( nPageId
- 1, GetPageKind() );
435 String
aTitle( SdResId( STR_TITLE_RENAMESLIDE
) );
436 String
aDescr( SdResId( STR_DESC_RENAMESLIDE
) );
437 String aPageName
= pCurrentPage
->GetName();
439 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
440 DBG_ASSERT(pFact
, "Dialogdiet fail!");
441 AbstractSvxNameDialog
* aNameDlg
= pFact
->CreateSvxNameDialog( GetActiveWindow(), aPageName
, aDescr
);
442 DBG_ASSERT(aNameDlg
, "Dialogdiet fail!");
443 aNameDlg
->SetText( aTitle
);
444 aNameDlg
->SetCheckNameHdl( LINK( this, DrawViewShell
, RenameSlideHdl
), true );
445 aNameDlg
->SetEditHelpId( HID_SD_NAMEDIALOG_PAGE
);
447 if( aNameDlg
->Execute() == RET_OK
)
450 aNameDlg
->GetName( aNewName
);
451 if( ! aNewName
.Equals( aPageName
) )
456 RenameSlide( nPageId
, aNewName
);
457 DBG_ASSERT( bResult
, "Couldn't rename slide" );
468 case SID_RENAMEPAGE_QUICK
:
470 if (mePageKind
==PK_STANDARD
|| mePageKind
==PK_NOTES
)
472 if ( mpDrawView
->IsTextEdit() )
474 mpDrawView
->SdrEndTextEdit();
477 maTabControl
.StartEditMode( maTabControl
.GetCurPageId() );
485 case SID_PAGESIZE
: // either this (no menu entries or something else!)
487 const SfxItemSet
*pArgs
= rReq
.GetArgs ();
490 if (pArgs
->Count () == 3)
492 SFX_REQUEST_ARG (rReq
, pWidth
, SfxUInt32Item
, ID_VAL_PAGEWIDTH
, sal_False
);
493 SFX_REQUEST_ARG (rReq
, pHeight
, SfxUInt32Item
, ID_VAL_PAGEHEIGHT
, sal_False
);
494 SFX_REQUEST_ARG (rReq
, pScaleAll
, SfxBoolItem
, ID_VAL_SCALEOBJECTS
, sal_False
);
496 Size
aSize (pWidth
->GetValue (), pHeight
->GetValue ());
498 SetupPage (aSize
, 0, 0, 0, 0, sal_True
, sal_False
, pScaleAll
->GetValue ());
502 #ifndef DISABLE_SCRIPTING
503 StarBASIC::FatalError (SbERR_WRONG_ARGS
);
509 case SID_PAGEMARGIN
: // or this (no menu entries or something else!)
511 const SfxItemSet
*pArgs
= rReq
.GetArgs ();
514 if (pArgs
->Count () == 5)
516 SFX_REQUEST_ARG (rReq
, pLeft
, SfxUInt32Item
, ID_VAL_PAGELEFT
, sal_False
);
517 SFX_REQUEST_ARG (rReq
, pRight
, SfxUInt32Item
, ID_VAL_PAGERIGHT
, sal_False
);
518 SFX_REQUEST_ARG (rReq
, pUpper
, SfxUInt32Item
, ID_VAL_PAGETOP
, sal_False
);
519 SFX_REQUEST_ARG (rReq
, pLower
, SfxUInt32Item
, ID_VAL_PAGEBOTTOM
, sal_False
);
520 SFX_REQUEST_ARG (rReq
, pScaleAll
, SfxBoolItem
, ID_VAL_SCALEOBJECTS
, sal_False
);
522 Size
aEmptySize (0, 0);
524 SetupPage (aEmptySize
, pLeft
->GetValue (), pRight
->GetValue (),
525 pUpper
->GetValue (), pLower
->GetValue (),
526 sal_False
, sal_True
, pScaleAll
->GetValue ());
530 #ifndef DISABLE_SCRIPTING
531 StarBASIC::FatalError (SbERR_WRONG_ARGS
);
537 case SID_ATTR_ZOOMSLIDER
:
539 const SfxItemSet
* pArgs
= rReq
.GetArgs();
541 if (pArgs
&& pArgs
->Count () == 1 )
543 SFX_REQUEST_ARG (rReq
, pScale
, SfxUInt16Item
, SID_ATTR_ZOOMSLIDER
, sal_False
);
544 if (CHECK_RANGE (5, pScale
->GetValue (), 3000))
546 SetZoom (pScale
->GetValue ());
548 SfxBindings
& rBindings
= GetViewFrame()->GetBindings();
549 rBindings
.Invalidate( SID_ATTR_ZOOM
);
550 rBindings
.Invalidate( SID_ZOOM_IN
);
551 rBindings
.Invalidate( SID_ZOOM_OUT
);
552 rBindings
.Invalidate( SID_ATTR_ZOOMSLIDER
);
561 case SID_ZOOMING
: // no menu entry, but generated from zoom dialog
563 const SfxItemSet
* pArgs
= rReq
.GetArgs();
566 if (pArgs
->Count () == 1)
568 SFX_REQUEST_ARG (rReq
, pScale
, SfxUInt32Item
, ID_VAL_ZOOM
, sal_False
);
569 if (CHECK_RANGE (10, pScale
->GetValue (), 1000))
571 SetZoom (pScale
->GetValue ());
573 SfxBindings
& rBindings
= GetViewFrame()->GetBindings();
574 rBindings
.Invalidate( SID_ATTR_ZOOM
);
575 rBindings
.Invalidate( SID_ZOOM_IN
);
576 rBindings
.Invalidate( SID_ZOOM_OUT
);
577 rBindings
.Invalidate( SID_ATTR_ZOOMSLIDER
);
579 #ifndef DISABLE_SCRIPTING
580 else StarBASIC::FatalError (SbERR_BAD_PROP_VALUE
);
585 #ifndef DISABLE_SCRIPTING
586 StarBASIC::FatalError (SbERR_WRONG_ARGS
);
594 const SfxItemSet
* pArgs
= rReq
.GetArgs();
595 mbZoomOnPage
= sal_False
;
599 SvxZoomType eZT
= ( ( const SvxZoomItem
& ) pArgs
->
600 Get( SID_ATTR_ZOOM
) ).GetType();
603 case SVX_ZOOM_PERCENT
:
604 SetZoom( (long) ( ( const SvxZoomItem
& ) pArgs
->
605 Get( SID_ATTR_ZOOM
) ).GetValue() );
608 case SVX_ZOOM_OPTIMAL
:
609 GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_ALL
,
610 SFX_CALLMODE_ASYNCHRON
| SFX_CALLMODE_RECORD
);
613 case SVX_ZOOM_PAGEWIDTH
:
614 GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE_WIDTH
,
615 SFX_CALLMODE_ASYNCHRON
| SFX_CALLMODE_RECORD
);
618 case SVX_ZOOM_WHOLEPAGE
:
619 GetViewFrame()->GetDispatcher()->Execute( SID_SIZE_PAGE
,
620 SFX_CALLMODE_ASYNCHRON
| SFX_CALLMODE_RECORD
);
622 case SVX_ZOOM_PAGEWIDTH_NOBORDER
:
623 OSL_FAIL("sd::DrawViewShell::FuTemporary(), SVX_ZOOM_PAGEWIDTH_NOBORDER not handled!" );
631 SetCurrentFunction( FuScale::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
637 case SID_CHANGEBEZIER
:
638 case SID_CHANGEPOLYGON
:
639 if ( mpDrawView
->IsTextEdit() )
641 mpDrawView
->SdrEndTextEdit();
642 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT
, SFX_CALLMODE_ASYNCHRON
);
645 if ( mpDrawView
->IsPresObjSelected() )
647 ::sd::Window
* pWindow
= GetActiveWindow();
648 InfoBox(pWindow
, String(SdResId(STR_ACTION_NOTPOSSIBLE
) ) ).Execute();
652 if( rReq
.GetSlot() == SID_CHANGEBEZIER
)
654 WaitObject
aWait( (Window
*)GetActiveWindow() );
655 mpDrawView
->ConvertMarkedToPathObj(sal_False
);
659 if( mpDrawView
->IsVectorizeAllowed() )
661 SetCurrentFunction( FuVectorize::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
665 WaitObject
aWait( (Window
*)GetActiveWindow() );
666 mpDrawView
->ConvertMarkedToPolyObj(sal_False
);
670 Invalidate(SID_CHANGEBEZIER
);
671 Invalidate(SID_CHANGEPOLYGON
);
675 if( HasCurrentFunction(SID_BEZIER_EDIT
) )
676 { // where applicable, activate right edit action
677 GetViewFrame()->GetDispatcher()->Execute(SID_SWITCH_POINTEDIT
,
678 SFX_CALLMODE_ASYNCHRON
| SFX_CALLMODE_RECORD
);
683 case SID_CONVERT_TO_CONTOUR
:
684 if ( mpDrawView
->IsTextEdit() )
686 mpDrawView
->SdrEndTextEdit();
687 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT
, SFX_CALLMODE_ASYNCHRON
);
690 if ( mpDrawView
->IsPresObjSelected() )
692 ::sd::Window
* pWindow
= GetActiveWindow();
693 InfoBox(pWindow
, String(SdResId(STR_ACTION_NOTPOSSIBLE
) ) ).Execute();
697 WaitObject
aWait( (Window
*)GetActiveWindow() );
698 mpDrawView
->ConvertMarkedToPathObj(sal_True
);
700 Invalidate(SID_CONVERT_TO_CONTOUR
);
707 case SID_CONVERT_TO_METAFILE
:
708 case SID_CONVERT_TO_BITMAP
:
710 // End text edit mode when it is active because the metafile or
711 // bitmap that will be created does not support it.
712 if ( mpDrawView
->IsTextEdit() )
714 mpDrawView
->SdrEndTextEdit();
715 GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT
, SFX_CALLMODE_ASYNCHRON
);
718 if ( mpDrawView
->IsPresObjSelected(true,true,true) )
720 ::sd::Window
* pWindow
= GetActiveWindow();
721 InfoBox(pWindow
, String(SdResId(STR_ACTION_NOTPOSSIBLE
) ) ).Execute();
725 WaitObject
aWait( (Window
*)GetActiveWindow() );
727 // create SdrGrafObj from metafile/bitmap
731 case SID_CONVERT_TO_METAFILE
:
733 // switch on undo for the next operations
734 mpDrawView
->BegUndo( String( SdResId( STR_UNDO_CONVERT_TO_METAFILE
)));
735 GDIMetaFile
aMetaFile(mpDrawView
->GetMarkedObjMetaFile());
736 aGraphic
= Graphic(aMetaFile
);
739 case SID_CONVERT_TO_BITMAP
:
741 // switch on undo for the next operations
742 mpDrawView
->BegUndo( String( SdResId( STR_UNDO_CONVERT_TO_BITMAP
)));
745 // I have to get the image here directly since GetMarkedObjBitmapEx works
746 // based on Bitmaps, but not on BitmapEx, thus throwing away the alpha
747 // channel. Argh! GetMarkedObjBitmapEx itself is too widely used to safely
748 // change that, e.g. in the exchange formats. For now I can only add this
749 // exception to get good results for Svgs. This is how the code gets more
750 // and more crowded, at last I made a remark for myself to change this
751 // as one of the next tasks.
752 if(1 == mpDrawView
->GetMarkedObjectCount())
754 const SdrGrafObj
* pSdrGrafObj
= dynamic_cast< const SdrGrafObj
* >(mpDrawView
->GetMarkedObjectByIndex(0));
756 if(pSdrGrafObj
&& pSdrGrafObj
->isEmbeddedSvg())
758 aGraphic
= Graphic(pSdrGrafObj
->GetGraphic().getSvgData()->getReplacement());
765 aGraphic
= Graphic(mpDrawView
->GetMarkedObjBitmapEx());
772 SdrGrafObj
* pGraphicObj
= new SdrGrafObj (aGraphic
);
774 // get some necessary info and ensure it
775 const SdrMarkList
& rMarkList(mpDrawView
->GetMarkedObjectList());
776 const sal_uInt32
nMarkCount(rMarkList
.GetMarkCount());
777 SdrPageView
* pPageView
= mpDrawView
->GetSdrPageView();
778 OSL_ENSURE(nMarkCount
, "DrawViewShell::FuTemporary: SID_CONVERT_TO_BITMAP with empty selection (!)");
779 OSL_ENSURE(pPageView
, "DrawViewShell::FuTemporary: SID_CONVERT_TO_BITMAP without SdrPageView (!)");
781 // fit rectangle of new graphic object to selection's mark rect
782 Rectangle aAllMarkedRect
;
783 rMarkList
.TakeBoundRect(pPageView
, aAllMarkedRect
);
784 pGraphicObj
->SetLogicRect(aAllMarkedRect
);
786 // #i71540# to keep the order, it is necessary to replace the lowest object
787 // of the selection with the new object. This also means that with multi
788 // selection, all other objects need to be deleted first
789 SdrMark
* pFirstMark
= rMarkList
.GetMark(0L);
790 SdrObject
* pReplacementCandidate
= pFirstMark
->GetMarkedSdrObj();
794 // take first object out of selection
795 mpDrawView
->MarkObj(pReplacementCandidate
, pPageView
, true, true);
797 // clear remaining selection
798 mpDrawView
->DeleteMarkedObj();
801 // now replace lowest object with new one
802 mpDrawView
->ReplaceObjectAtView(pReplacementCandidate
, *pPageView
, pGraphicObj
);
805 mpDrawView
->EndUndo();
814 case SID_SET_DEFAULT
:
816 SfxItemSet
* pSet
= NULL
;
818 if (mpDrawView
->IsTextEdit())
820 ::Outliner
* pOutl
= mpDrawView
->GetTextEditOutliner();
823 pOutl
->RemoveFields(sal_True
, (TypeId
) SvxURLField::StaticType());
826 pSet
= new SfxItemSet( GetPool(), EE_ITEMS_START
, EE_ITEMS_END
);
827 mpDrawView
->SetAttributes( *pSet
, sal_True
);
831 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
832 sal_uLong nCount
= rMarkList
.GetMarkCount();
834 // For every presentation object a SfxItemSet of hard attributes
835 // and the UserCall is stored in this list. This is because
836 // at the following mpDrawView->SetAttributes( *pSet, sal_True )
837 // they get lost and have to be restored.
838 std::vector
<std::pair
<SfxItemSet
*,SdrObjUserCall
*> > aAttrList
;
839 SdPage
* pPresPage
= (SdPage
*) mpDrawView
->GetSdrPageView()->GetPage();
842 for ( i
= 0; i
< nCount
; i
++ )
844 SdrObject
* pObj
= rMarkList
.GetMark(i
)->GetMarkedSdrObj();
846 if( pPresPage
->IsPresObj( pObj
) )
848 SfxItemSet
* pNewSet
= new SfxItemSet( GetDoc()->GetPool(), SDRATTR_TEXT_MINFRAMEHEIGHT
, SDRATTR_TEXT_AUTOGROWHEIGHT
, 0 );
849 pNewSet
->Put(pObj
->GetMergedItemSet());
850 aAttrList
.push_back(std::make_pair(pNewSet
, pObj
->GetUserCall()));
854 pSet
= new SfxItemSet( GetPool() );
855 mpDrawView
->SetAttributes( *pSet
, sal_True
);
859 for ( i
= 0; i
< nCount
; i
++ )
861 SfxStyleSheet
* pSheet
= NULL
;
862 SdrObject
* pObj
= rMarkList
.GetMark(i
)->GetMarkedSdrObj();
864 if (pObj
->GetObjIdentifier() == OBJ_TITLETEXT
)
866 pSheet
= mpActualPage
->GetStyleSheetForPresObj(PRESOBJ_TITLE
);
868 pObj
->SetStyleSheet(pSheet
, sal_False
);
870 else if(pObj
->GetObjIdentifier() == OBJ_OUTLINETEXT
)
872 for (sal_uInt16 nLevel
= 1; nLevel
< 10; nLevel
++)
874 pSheet
= mpActualPage
->GetStyleSheetForPresObj( PRESOBJ_OUTLINE
);
875 DBG_ASSERT(pSheet
, "Template for outline object not found");
878 pObj
->StartListening(*pSheet
);
881 // text frame listens on StyleSheet of level1
882 pObj
->NbcSetStyleSheet(pSheet
, sal_False
);
888 if( pPresPage
->IsPresObj( pObj
) )
890 std::pair
<SfxItemSet
*,SdrObjUserCall
*> &rAttr
= aAttrList
[j
++];
892 SfxItemSet
* pNewSet
= rAttr
.first
;
893 SdrObjUserCall
* pUserCall
= rAttr
.second
;
895 if ( pNewSet
&& pNewSet
->GetItemState( SDRATTR_TEXT_MINFRAMEHEIGHT
) == SFX_ITEM_ON
)
897 pObj
->SetMergedItem(pNewSet
->Get(SDRATTR_TEXT_MINFRAMEHEIGHT
));
900 if ( pNewSet
&& pNewSet
->GetItemState( SDRATTR_TEXT_AUTOGROWHEIGHT
) == SFX_ITEM_ON
)
902 pObj
->SetMergedItem(pNewSet
->Get(SDRATTR_TEXT_AUTOGROWHEIGHT
));
906 pObj
->SetUserCall( pUserCall
);
918 case SID_DELETE_SNAPITEM
:
921 Point aMPos
= GetActiveWindow()->PixelToLogic( maMousePos
);
922 sal_uInt16 nHitLog
= (sal_uInt16
) GetActiveWindow()->PixelToLogic( Size(
923 FuPoor::HITPIX
, 0 ) ).Width();
924 sal_uInt16 nHelpLine
;
926 mbMousePosFreezed
= sal_False
;
928 if( mpDrawView
->PickHelpLine( aMPos
, nHitLog
, *GetActiveWindow(), nHelpLine
, pPV
) )
930 pPV
->DeleteHelpLine( nHelpLine
);
937 case SID_DELETE_PAGE
:
938 case SID_DELETE_MASTER_PAGE
:
944 case SID_DELETE_LAYER
:
950 case SID_ORIGINAL_SIZE
:
951 mpDrawView
->SetMarkedOriginalSize();
956 case SID_DRAW_FONTWORK
:
957 case SID_DRAW_FONTWORK_VERTICAL
:
959 svx::FontworkBar::execute( mpView
, rReq
, GetViewFrame()->GetBindings() ); // SJ: can be removed (I think)
965 case SID_SAVE_GRAPHIC
:
967 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
968 if( rMarkList
.GetMarkCount() == 1 )
970 SdrObject
* pObj
= rMarkList
.GetMark( 0 )->GetMarkedSdrObj();
971 if( pObj
&& pObj
->ISA( SdrGrafObj
) && ( (SdrGrafObj
*) pObj
)->GetGraphicType() == GRAPHIC_BITMAP
)
973 GraphicObject
aGraphicObject( ( (SdrGrafObj
*) pObj
)->GetGraphicObject() );
975 GraphicHelper::ExportGraphic( aGraphicObject
.GetGraphic(), String("") );
984 case SID_EXTERNAL_EDIT
:
986 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
987 if( rMarkList
.GetMarkCount() == 1 )
989 SdrObject
* pObj
= rMarkList
.GetMark( 0 )->GetMarkedSdrObj();
990 if( pObj
&& pObj
->ISA( SdrGrafObj
) && ( (SdrGrafObj
*) pObj
)->GetGraphicType() == GRAPHIC_BITMAP
)
992 GraphicObject
aGraphicObject( ( (SdrGrafObj
*) pObj
)->GetGraphicObject() );
993 SdExternalToolEdit
* aExternalToolEdit
= new SdExternalToolEdit( mpDrawView
, pObj
);
994 aExternalToolEdit
->Edit( &aGraphicObject
);
1002 case SID_COMPRESS_GRAPHIC
:
1004 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
1005 if( rMarkList
.GetMarkCount() == 1 )
1007 SdrObject
* pObj
= rMarkList
.GetMark( 0 )->GetMarkedSdrObj();
1009 if( pObj
&& pObj
->ISA( SdrGrafObj
) && ( (SdrGrafObj
*) pObj
)->GetGraphicType() == GRAPHIC_BITMAP
)
1011 SdrGrafObj
* pGraphicObj
= (SdrGrafObj
*) pObj
;
1012 CompressGraphicsDialog
dialog( GetParentWindow(), pGraphicObj
, GetViewFrame()->GetBindings() );
1013 if ( dialog
.Execute() == RET_OK
)
1015 SdrGrafObj
* pNewObject
= dialog
.GetCompressedSdrGrafObj();
1016 SdrPageView
* pPageView
= mpDrawView
->GetSdrPageView();
1017 String
aUndoString( mpDrawView
->GetDescriptionOfMarkedObjects() );
1018 aUndoString
+= String( " Compress" );
1019 mpDrawView
->BegUndo( aUndoString
);
1020 mpDrawView
->ReplaceObjectAtView( pObj
, *pPageView
, pNewObject
);
1021 mpDrawView
->EndUndo();
1030 case SID_ATTRIBUTES_LINE
: // BASIC
1032 SetCurrentFunction( FuLine::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1037 case SID_ATTRIBUTES_AREA
: // BASIC
1039 SetCurrentFunction( FuArea::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1044 case SID_ATTR_TRANSFORM
:
1046 SetCurrentFunction( FuTransform::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1047 Invalidate(SID_RULER_OBJECT
);
1052 case SID_CHAR_DLG_EFFECT
:
1053 case SID_CHAR_DLG
: // BASIC
1055 SetCurrentFunction( FuChar::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1062 SetCurrentFunction( FuParagraph::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1067 case FN_NUM_BULLET_ON
:
1069 // The value (sal_uInt16)0xFFFF means set bullet on/off.
1070 SfxUInt16Item
aItem(FN_SVX_SET_BULLET
, (sal_uInt16
)0xFFFF);
1071 GetViewFrame()->GetDispatcher()->Execute( FN_SVX_SET_BULLET
, SFX_CALLMODE_RECORD
, &aItem
, 0L );
1075 case FN_NUM_NUMBERING_ON
:
1077 // The value (sal_uInt16)0xFFFF means set bullet on/off.
1078 SfxUInt16Item
aItem(FN_SVX_SET_NUMBER
, (sal_uInt16
)0xFFFF);
1079 GetViewFrame()->GetDispatcher()->Execute( FN_SVX_SET_NUMBER
, SFX_CALLMODE_RECORD
, &aItem
, 0L );
1083 case SID_OUTLINE_BULLET
:
1084 case FN_SVX_SET_BULLET
:
1085 case FN_SVX_SET_NUMBER
:
1087 SetCurrentFunction( FuOutlineBullet::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1092 case FN_INSERT_SOFT_HYPHEN
:
1093 case FN_INSERT_HARDHYPHEN
:
1094 case FN_INSERT_HARD_SPACE
:
1095 case SID_INSERT_RLM
:
1096 case SID_INSERT_LRM
:
1097 case SID_INSERT_ZWNBSP
:
1098 case SID_INSERT_ZWSP
:
1101 SetCurrentFunction( FuBullet::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1106 case SID_PRESENTATION_LAYOUT
:
1108 SetCurrentFunction( FuPresentationLayout::Create(this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1113 case SID_PASTE_SPECIAL
:
1115 SetCurrentFunction( FuInsertClipboard::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1121 case SID_CHANGE_PICTURE
:
1122 case SID_INSERT_GRAPHIC
:
1124 SetCurrentFunction( FuInsertGraphic::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1127 Invalidate(SID_DRAWTBX_INSERT
);
1131 case SID_INSERT_AVMEDIA
:
1133 SetCurrentFunction( FuInsertAVMedia::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1138 Invalidate(SID_DRAWTBX_INSERT
);
1142 case SID_INSERT_OBJECT
:
1143 case SID_INSERT_PLUGIN
:
1144 case SID_INSERT_SOUND
:
1145 case SID_INSERT_VIDEO
:
1146 case SID_INSERT_FLOATINGFRAME
:
1147 case SID_INSERT_MATH
:
1148 case SID_INSERT_DIAGRAM
:
1149 case SID_ATTR_TABLE
:
1151 SetCurrentFunction( FuInsertOLE::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1156 Invalidate(SID_DRAWTBX_INSERT
);
1160 case SID_COPYOBJECTS
:
1162 if ( mpDrawView
->IsPresObjSelected(sal_False
, sal_True
) )
1164 ::sd::Window
* pWindow
= GetActiveWindow();
1165 InfoBox(pWindow
, String(SdResId(STR_ACTION_NOTPOSSIBLE
) ) ).Execute();
1169 if ( mpDrawView
->IsTextEdit() )
1171 mpDrawView
->SdrEndTextEdit();
1174 SetCurrentFunction( FuCopy::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1181 case SID_INSERTFILE
: // BASIC
1183 Broadcast (ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_START
));
1184 SetCurrentFunction( FuInsertFile::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1185 Broadcast (ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_END
));
1189 Invalidate(SID_DRAWTBX_INSERT
);
1193 case SID_SELECT_BACKGROUND
:
1194 case SID_PAGESETUP
: // BASIC ??
1196 SetCurrentFunction( FuPage::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1198 rReq
.Ignore (); // we generate independent macros !!
1203 case SID_ZOOM_PANNING
:
1205 mbZoomOnPage
= sal_False
;
1206 SetCurrentFunction( FuZoom::Create(this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1207 // finishes itself, no Cancel() needed!
1208 Invalidate( SID_ZOOM_TOOLBOX
);
1213 case SID_BEFORE_OBJ
:
1214 case SID_BEHIND_OBJ
:
1216 SetCurrentFunction( FuDisplayOrder::Create(this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1217 Invalidate( SID_POSITION
);
1219 // finishes itself, no Cancel() needed!
1223 case SID_REVERSE_ORDER
: // BASIC
1225 mpDrawView
->ReverseOrderOfMarked();
1226 Invalidate( SID_POSITION
);
1232 case SID_ANIMATION_EFFECTS
:
1234 SetCurrentFunction( FuObjectAnimationParameters::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1239 case SID_LINEEND_POLYGON
:
1241 SetCurrentFunction( FuLineEnd::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1246 case SID_CAPTUREPOINT
:
1247 // negative value to signal call from menu
1248 maMousePos
= Point(-1,-1);
1249 case SID_SET_SNAPITEM
:
1251 SetCurrentFunction( FuSnapLine::Create(this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1256 case SID_MANAGE_LINKS
:
1258 SetCurrentFunction( FuLink::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1266 SetCurrentFunction( FuThesaurus::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1272 case SID_TEXTATTR_DLG
:
1274 SetCurrentFunction( FuTextAttrDlg::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1280 case SID_MEASURE_DLG
:
1282 SetCurrentFunction( FuMeasureDlg::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1288 case SID_CONNECTION_DLG
:
1290 SetCurrentFunction( FuConnectionDlg::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1296 case SID_CONNECTION_NEW_ROUTING
:
1298 SfxItemSet
aDefAttr( GetPool(), SDRATTR_EDGELINE1DELTA
, SDRATTR_EDGELINE3DELTA
);
1299 GetView()->SetAttributes( aDefAttr
, sal_True
); // (ReplaceAll)
1306 case SID_TWAIN_SELECT
:
1308 if( mxScannerManager
.is() )
1312 const ::com::sun::star::uno::Sequence
< ::com::sun::star::scanner::ScannerContext
>
1313 aContexts( mxScannerManager
->getAvailableScanners() );
1315 if( aContexts
.getLength() )
1317 ::com::sun::star::scanner::ScannerContext
aContext( aContexts
.getConstArray()[ 0 ] );
1318 mxScannerManager
->configureScannerAndScan( aContext
, mxScannerListener
);
1331 case SID_TWAIN_TRANSFER
:
1333 sal_Bool bDone
= sal_False
;
1335 if( mxScannerManager
.is() )
1339 const ::com::sun::star::uno::Sequence
< ::com::sun::star::scanner::ScannerContext
> aContexts( mxScannerManager
->getAvailableScanners() );
1341 if( aContexts
.getLength() )
1343 mxScannerManager
->startScan( aContexts
.getConstArray()[ 0 ], mxScannerListener
);
1355 const sal_uInt16 nId
= STR_TWAIN_NO_SOURCE
;
1357 const sal_uInt16 nId
= STR_TWAIN_NO_SOURCE_UNX
;
1360 ::sd::Window
* pWindow
= GetActiveWindow();
1361 InfoBox(pWindow
, String( SdResId( nId
) ) ).Execute();
1365 SfxBindings
& rBindings
= GetViewFrame()->GetBindings();
1366 rBindings
.Invalidate( SID_TWAIN_SELECT
);
1367 rBindings
.Invalidate( SID_TWAIN_TRANSFER
);
1375 case SID_POLYGON_MORPHING
:
1377 SetCurrentFunction( FuMorph::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1384 SetCurrentFunction( FuVectorize::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
1389 case SID_INSERTLAYER
:
1391 if ( mpDrawView
->IsTextEdit() )
1393 mpDrawView
->SdrEndTextEdit();
1396 SdrLayerAdmin
& rLayerAdmin
= GetDoc()->GetLayerAdmin();
1397 sal_uInt16 nLayerCnt
= rLayerAdmin
.GetLayerCount();
1398 sal_uInt16 nLayer
= nLayerCnt
- 2 + 1;
1399 String
aLayerName ( SdResId(STR_LAYER
) ), aLayerTitle
, aLayerDesc
;
1400 aLayerName
+= OUString::number( (sal_Int32
)nLayer
);
1401 sal_Bool bIsVisible
= sal_False
;
1402 sal_Bool bIsLocked
= sal_False
;
1403 sal_Bool bIsPrintable
= sal_False
;
1405 const SfxItemSet
* pArgs
= rReq
.GetArgs();
1409 SfxItemSet
aNewAttr( GetDoc()->GetPool(), ATTR_LAYER_START
, ATTR_LAYER_END
);
1411 aNewAttr
.Put( SdAttrLayerName( aLayerName
) );
1412 aNewAttr
.Put( SdAttrLayerTitle() );
1413 aNewAttr
.Put( SdAttrLayerDesc() );
1414 aNewAttr
.Put( SdAttrLayerVisible() );
1415 aNewAttr
.Put( SdAttrLayerPrintable() );
1416 aNewAttr
.Put( SdAttrLayerLocked() );
1417 aNewAttr
.Put( SdAttrLayerThisPage() );
1419 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
1420 AbstractSdInsertLayerDlg
* pDlg
= pFact
? pFact
->CreateSdInsertLayerDlg(NULL
, aNewAttr
, true, String( SdResId( STR_INSERTLAYER
) ) ) : 0;
1423 pDlg
->SetHelpId( SD_MOD()->GetSlotPool()->GetSlot( SID_INSERTLAYER
)->GetCommand() );
1425 // test for already existing names
1426 sal_Bool bLoop
= sal_True
;
1427 while( bLoop
&& pDlg
->Execute() == RET_OK
)
1429 pDlg
->GetAttr( aNewAttr
);
1430 aLayerName
= ((SdAttrLayerName
&) aNewAttr
.Get (ATTR_LAYER_NAME
)).GetValue ();
1432 if( rLayerAdmin
.GetLayer( aLayerName
, sal_False
)
1433 || aLayerName
.Len()==0 )
1435 // name already exists
1436 WarningBox
aWarningBox (
1439 String(SdResId( STR_WARN_NAME_DUPLICATE
)));
1440 aWarningBox
.Execute();
1445 if( bLoop
) // was canceled
1455 aLayerTitle
= ((SdAttrLayerTitle
&) aNewAttr
.Get (ATTR_LAYER_TITLE
)).GetValue ();
1456 aLayerDesc
= ((SdAttrLayerDesc
&) aNewAttr
.Get (ATTR_LAYER_DESC
)).GetValue ();
1457 bIsVisible
= ((SdAttrLayerVisible
&) aNewAttr
.Get (ATTR_LAYER_VISIBLE
)).GetValue ();
1458 bIsLocked
= ((SdAttrLayerLocked
&) aNewAttr
.Get (ATTR_LAYER_LOCKED
)).GetValue () ;
1459 bIsPrintable
= ((SdAttrLayerPrintable
&) aNewAttr
.Get (ATTR_LAYER_PRINTABLE
)).GetValue () ;
1465 else if (pArgs
->Count () != 4)
1467 #ifndef DISABLE_SCRIPTING
1468 StarBASIC::FatalError (SbERR_WRONG_ARGS
);
1476 SFX_REQUEST_ARG (rReq
, pLayerName
, SfxStringItem
, ID_VAL_LAYERNAME
, sal_False
);
1477 SFX_REQUEST_ARG (rReq
, pIsVisible
, SfxBoolItem
, ID_VAL_ISVISIBLE
, sal_False
);
1478 SFX_REQUEST_ARG (rReq
, pIsLocked
, SfxBoolItem
, ID_VAL_ISLOCKED
, sal_False
);
1479 SFX_REQUEST_ARG (rReq
, pIsPrintable
, SfxBoolItem
, ID_VAL_ISPRINTABLE
, sal_False
);
1481 aLayerName
= pLayerName
->GetValue ();
1482 bIsVisible
= pIsVisible
->GetValue ();
1483 bIsLocked
= pIsLocked
->GetValue ();
1484 bIsPrintable
= pIsPrintable
->GetValue ();
1487 String aPrevLayer
= mpDrawView
->GetActiveLayer();
1490 sal_uInt16 nPrevLayer
= 0;
1491 nLayerCnt
= rLayerAdmin
.GetLayerCount();
1493 for ( nLayer
= 0; nLayer
< nLayerCnt
; nLayer
++ )
1495 pLayer
= rLayerAdmin
.GetLayer(nLayer
);
1496 aName
= pLayer
->GetName();
1498 if ( aPrevLayer
== aName
)
1500 nPrevLayer
= std::max(nLayer
, (sal_uInt16
) 4);
1504 mpDrawView
->InsertNewLayer(aLayerName
, nPrevLayer
+ 1);
1505 pLayer
= rLayerAdmin
.GetLayer(aLayerName
, sal_False
);
1508 pLayer
->SetTitle( aLayerTitle
);
1509 pLayer
->SetDescription( aLayerDesc
);
1512 mpDrawView
->SetLayerVisible( aLayerName
, bIsVisible
);
1513 mpDrawView
->SetLayerLocked( aLayerName
, bIsLocked
);
1514 mpDrawView
->SetLayerPrintable(aLayerName
, bIsPrintable
);
1516 mpDrawView
->SetActiveLayer(aLayerName
);
1520 GetDoc()->SetChanged(sal_True
);
1522 GetViewFrame()->GetDispatcher()->Execute(SID_SWITCHLAYER
,
1523 SFX_CALLMODE_ASYNCHRON
| SFX_CALLMODE_RECORD
);
1530 case SID_MODIFYLAYER
:
1532 if ( mpDrawView
->IsTextEdit() )
1534 mpDrawView
->SdrEndTextEdit();
1537 SdrLayerAdmin
& rLayerAdmin
= GetDoc()->GetLayerAdmin();
1538 sal_uInt16 nCurPage
= GetLayerTabControl()->GetCurPageId();
1539 String
aLayerName( GetLayerTabControl()->GetPageText(nCurPage
) );
1540 SdrLayer
* pLayer
= rLayerAdmin
.GetLayer(aLayerName
, sal_False
);
1542 String
aLayerTitle( pLayer
->GetTitle() );
1543 String
aLayerDesc( pLayer
->GetDescription() );
1545 String
aOldLayerName( aLayerName
);
1546 String
aOldLayerTitle( aLayerTitle
);
1547 String
aOldLayerDesc( aLayerDesc
);
1549 sal_Bool bIsVisible
, bIsLocked
, bIsPrintable
;
1550 sal_Bool bOldIsVisible
= bIsVisible
= mpDrawView
->IsLayerVisible(aLayerName
);
1551 sal_Bool bOldIsLocked
= bIsLocked
= mpDrawView
->IsLayerLocked(aLayerName
);
1552 sal_Bool bOldIsPrintable
= bIsPrintable
= mpDrawView
->IsLayerPrintable(aLayerName
);
1555 const SfxItemSet
* pArgs
= rReq
.GetArgs();
1556 // is it allowed to delete the layer?
1557 bool bDelete
= true;
1559 String
aLayoutLayer ( SdResId(STR_LAYER_LAYOUT
) );
1560 String
aControlsLayer ( SdResId(STR_LAYER_CONTROLS
) );
1561 String
aMeasureLinesLayer ( SdResId(STR_LAYER_MEASURELINES
) );
1562 String
aBackgroundLayer( SdResId(STR_LAYER_BCKGRND
) );
1563 String
aBackgroundObjLayer( SdResId(STR_LAYER_BCKGRNDOBJ
) );
1565 if( aLayerName
== aLayoutLayer
|| aLayerName
== aControlsLayer
||
1566 aLayerName
== aMeasureLinesLayer
||
1567 aLayerName
== aBackgroundLayer
|| aLayerName
== aBackgroundObjLayer
)
1574 SfxItemSet
aNewAttr( GetDoc()->GetPool(), ATTR_LAYER_START
, ATTR_LAYER_END
);
1576 aNewAttr
.Put( SdAttrLayerName( aLayerName
) );
1577 aNewAttr
.Put( SdAttrLayerTitle( aLayerTitle
) );
1578 aNewAttr
.Put( SdAttrLayerDesc( aLayerDesc
) );
1579 aNewAttr
.Put( SdAttrLayerVisible( bIsVisible
) );
1580 aNewAttr
.Put( SdAttrLayerLocked( bIsLocked
) );
1581 aNewAttr
.Put( SdAttrLayerPrintable( bIsPrintable
) );
1582 aNewAttr
.Put( SdAttrLayerThisPage() );
1584 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
1585 AbstractSdInsertLayerDlg
* pDlg
= pFact
? pFact
->CreateSdInsertLayerDlg(NULL
, aNewAttr
, bDelete
, String( SdResId( STR_MODIFYLAYER
) ) ) : 0;
1588 pDlg
->SetHelpId( SD_MOD()->GetSlotPool()->GetSlot( SID_MODIFYLAYER
)->GetCommand() );
1590 // test for already existing names
1591 sal_Bool bLoop
= sal_True
;
1592 sal_uInt16 nRet
= 0;
1593 while( bLoop
&& ( (nRet
= pDlg
->Execute()) == RET_OK
) )
1595 pDlg
->GetAttr( aNewAttr
);
1596 aLayerName
= ((SdAttrLayerName
&) aNewAttr
.Get (ATTR_LAYER_NAME
)).GetValue ();
1598 if( (rLayerAdmin
.GetLayer( aLayerName
, sal_False
) &&
1599 aLayerName
!= aOldLayerName
) || aLayerName
.Len()==0 )
1601 // name already exists
1602 WarningBox
aWarningBox (
1605 String( SdResId( STR_WARN_NAME_DUPLICATE
)));
1606 aWarningBox
.Execute();
1614 aLayerTitle
= ((SdAttrLayerTitle
&) aNewAttr
.Get (ATTR_LAYER_TITLE
)).GetValue ();
1615 aLayerDesc
= ((SdAttrLayerDesc
&) aNewAttr
.Get (ATTR_LAYER_DESC
)).GetValue ();
1616 bIsVisible
= ((const SdAttrLayerVisible
&) aNewAttr
.Get (ATTR_LAYER_VISIBLE
)).GetValue ();
1617 bIsLocked
= ((const SdAttrLayerLocked
&) aNewAttr
.Get (ATTR_LAYER_LOCKED
)).GetValue ();
1618 bIsPrintable
= ((const SdAttrLayerLocked
&) aNewAttr
.Get (ATTR_LAYER_PRINTABLE
)).GetValue ();
1631 else if (pArgs
->Count () == 4)
1633 SFX_REQUEST_ARG (rReq
, pLayerName
, SfxStringItem
, ID_VAL_LAYERNAME
, sal_False
);
1634 SFX_REQUEST_ARG (rReq
, pIsVisible
, SfxBoolItem
, ID_VAL_ISVISIBLE
, sal_False
);
1635 SFX_REQUEST_ARG (rReq
, pIsLocked
, SfxBoolItem
, ID_VAL_ISLOCKED
, sal_False
);
1636 SFX_REQUEST_ARG (rReq
, pIsPrintable
, SfxBoolItem
, ID_VAL_ISPRINTABLE
, sal_False
);
1638 aLayerName
= pLayerName
->GetValue ();
1639 bIsVisible
= pIsVisible
->GetValue ();
1640 bIsLocked
= pIsLocked
->GetValue ();
1641 bIsPrintable
= pIsPrintable
->GetValue ();
1645 #ifndef DISABLE_SCRIPTING
1646 StarBASIC::FatalError (SbERR_WRONG_ARGS
);
1653 ::svl::IUndoManager
* pManager
= GetDoc()->GetDocSh()->GetUndoManager();
1654 SdLayerModifyUndoAction
* pAction
= new SdLayerModifyUndoAction(
1672 pManager
->AddUndoAction( pAction
);
1674 ModifyLayer( pLayer
, aLayerName
, aLayerTitle
, aLayerDesc
, bIsVisible
, bIsLocked
, bIsPrintable
);
1681 case SID_RENAMELAYER
:
1683 if ( mpDrawView
->IsTextEdit() )
1685 mpDrawView
->SdrEndTextEdit();
1688 GetLayerTabControl()->StartEditMode(
1689 GetLayerTabControl()->GetCurPageId() );
1696 case SID_EDIT_HYPERLINK
:
1698 GetViewFrame()->GetDispatcher()->Execute( SID_HYPERLINK_DIALOG
);
1705 case SID_OPEN_HYPERLINK
:
1707 OutlinerView
* pOutView
= mpDrawView
->GetTextEditOutlinerView();
1710 const SvxFieldItem
* pFieldItem
= pOutView
->GetFieldAtSelection();
1713 const SvxFieldData
* pField
= pFieldItem
->GetField();
1714 if( pField
&& pField
->ISA( SvxURLField
) )
1716 const SvxURLField
* pURLField
= static_cast< const SvxURLField
* >( pField
);
1718 SfxStringItem
aUrl( SID_FILE_NAME
, pURLField
->GetURL() );
1719 SfxStringItem
aTarget( SID_TARGETNAME
, pURLField
->GetTargetFrame() );
1722 SfxViewFrame
* pFrame
= GetViewFrame();
1723 SfxMedium
* pMed
= pFrame
->GetObjectShell()->GetMedium();
1725 aReferName
= pMed
->GetName();
1727 SfxFrameItem
aFrm( SID_DOCFRAME
, pFrame
);
1728 SfxStringItem
aReferer( SID_REFERER
, aReferName
);
1730 SfxBoolItem
aNewView( SID_OPEN_NEW_VIEW
, sal_False
);
1731 SfxBoolItem
aBrowsing( SID_BROWSE
, sal_True
);
1733 SfxViewFrame
* pViewFrm
= SfxViewFrame::Current();
1735 pViewFrm
->GetDispatcher()->Execute( SID_OPENDOC
,
1736 SFX_CALLMODE_ASYNCHRON
| SFX_CALLMODE_RECORD
,
1739 &aNewView
, &aBrowsing
,
1749 case SID_HYPERLINK_SETLINK
:
1751 const SfxItemSet
* pReqArgs
= rReq
.GetArgs();
1755 SvxHyperlinkItem
* pHLItem
=
1756 (SvxHyperlinkItem
*) &pReqArgs
->Get(SID_HYPERLINK_SETLINK
);
1758 if (pHLItem
->GetInsertMode() == HLINK_FIELD
)
1760 InsertURLField(pHLItem
->GetURL(), pHLItem
->GetName(),
1761 pHLItem
->GetTargetFrame(), NULL
);
1763 else if (pHLItem
->GetInsertMode() == HLINK_BUTTON
)
1765 InsertURLButton(pHLItem
->GetURL(), pHLItem
->GetName(),
1766 pHLItem
->GetTargetFrame(), NULL
);
1768 else if (pHLItem
->GetInsertMode() == HLINK_DEFAULT
)
1770 OutlinerView
* pOlView
= mpDrawView
->GetTextEditOutlinerView();
1774 InsertURLField(pHLItem
->GetURL(), pHLItem
->GetName(),
1775 pHLItem
->GetTargetFrame(), NULL
);
1779 InsertURLButton(pHLItem
->GetURL(), pHLItem
->GetName(),
1780 pHLItem
->GetTargetFrame(), NULL
);
1790 case SID_INSERT_FLD_DATE_FIX
:
1791 case SID_INSERT_FLD_DATE_VAR
:
1792 case SID_INSERT_FLD_TIME_FIX
:
1793 case SID_INSERT_FLD_TIME_VAR
:
1794 case SID_INSERT_FLD_AUTHOR
:
1795 case SID_INSERT_FLD_PAGE
:
1796 case SID_INSERT_FLD_PAGES
:
1797 case SID_INSERT_FLD_FILE
:
1799 sal_uInt16 nMul
= 1;
1800 SvxFieldItem
* pFieldItem
= 0;
1804 case SID_INSERT_FLD_DATE_FIX
:
1805 pFieldItem
= new SvxFieldItem(
1806 SvxDateField( Date( Date::SYSTEM
), SVXDATETYPE_FIX
), EE_FEATURE_FIELD
);
1809 case SID_INSERT_FLD_DATE_VAR
:
1810 pFieldItem
= new SvxFieldItem( SvxDateField(), EE_FEATURE_FIELD
);
1813 case SID_INSERT_FLD_TIME_FIX
:
1814 pFieldItem
= new SvxFieldItem(
1815 SvxExtTimeField( Time( Time::SYSTEM
), SVXTIMETYPE_FIX
), EE_FEATURE_FIELD
);
1818 case SID_INSERT_FLD_TIME_VAR
:
1819 pFieldItem
= new SvxFieldItem( SvxExtTimeField(), EE_FEATURE_FIELD
);
1822 case SID_INSERT_FLD_AUTHOR
:
1824 SvtUserOptions aUserOptions
;
1825 pFieldItem
= new SvxFieldItem(
1827 aUserOptions
.GetFirstName(), aUserOptions
.GetLastName(), aUserOptions
.GetID() ), EE_FEATURE_FIELD
);
1831 case SID_INSERT_FLD_PAGE
:
1833 pFieldItem
= new SvxFieldItem( SvxPageField(), EE_FEATURE_FIELD
);
1838 case SID_INSERT_FLD_PAGES
:
1840 pFieldItem
= new SvxFieldItem( SvxPagesField(), EE_FEATURE_FIELD
);
1845 case SID_INSERT_FLD_FILE
:
1848 if( GetDocSh()->HasName() )
1849 aName
= GetDocSh()->GetMedium()->GetName();
1850 pFieldItem
= new SvxFieldItem( SvxExtFileField( aName
), EE_FEATURE_FIELD
);
1855 OutlinerView
* pOLV
= mpDrawView
->GetTextEditOutlinerView();
1859 const SvxFieldItem
* pOldFldItem
= pOLV
->GetFieldAtSelection();
1861 if( pOldFldItem
&& ( pOldFldItem
->GetField()->ISA( SvxURLField
) ||
1862 pOldFldItem
->GetField()->ISA( SvxDateField
) ||
1863 pOldFldItem
->GetField()->ISA( SvxTimeField
) ||
1864 pOldFldItem
->GetField()->ISA( SvxExtTimeField
) ||
1865 pOldFldItem
->GetField()->ISA( SvxExtFileField
) ||
1866 pOldFldItem
->GetField()->ISA( SvxAuthorField
) ||
1867 pOldFldItem
->GetField()->ISA( SvxPageField
) ) )
1869 // select field, then it will be deleted when inserting
1870 ESelection aSel
= pOLV
->GetSelection();
1871 if( aSel
.nStartPos
== aSel
.nEndPos
)
1873 pOLV
->SetSelection( aSel
);
1877 pOLV
->InsertField( *pFieldItem
);
1881 Outliner
* pOutl
= GetDoc()->GetInternalOutliner();
1882 pOutl
->Init( OUTLINERMODE_TEXTOBJECT
);
1883 sal_uInt16 nOutlMode
= pOutl
->GetMode();
1884 pOutl
->SetStyleSheet( 0, NULL
);
1885 pOutl
->QuickInsertField( *pFieldItem
, ESelection() );
1886 OutlinerParaObject
* pOutlParaObject
= pOutl
->CreateParaObject();
1888 SdrRectObj
* pRectObj
= new SdrRectObj( OBJ_TEXT
);
1889 pRectObj
->SetMergedItem(SdrTextAutoGrowWidthItem(sal_True
));
1891 pOutl
->UpdateFields();
1892 pOutl
->SetUpdateMode( sal_True
);
1893 Size
aSize( pOutl
->CalcTextSize() );
1894 aSize
.Width() *= nMul
;
1895 pOutl
->SetUpdateMode( sal_False
);
1898 Rectangle
aRect( aPos
, GetActiveWindow()->GetOutputSizePixel() );
1899 aPos
= aRect
.Center();
1900 aPos
= GetActiveWindow()->PixelToLogic(aPos
);
1901 aPos
.X() -= aSize
.Width() / 2;
1902 aPos
.Y() -= aSize
.Height() / 2;
1904 Rectangle
aLogicRect(aPos
, aSize
);
1905 pRectObj
->SetLogicRect(aLogicRect
);
1906 pRectObj
->SetOutlinerParaObject( pOutlParaObject
);
1907 mpDrawView
->InsertObjectAtView(pRectObj
, *mpDrawView
->GetSdrPageView());
1908 pOutl
->Init( nOutlMode
);
1918 case SID_MODIFY_FIELD
:
1920 OutlinerView
* pOLV
= mpDrawView
->GetTextEditOutlinerView();
1924 const SvxFieldItem
* pFldItem
= pOLV
->GetFieldAtSelection();
1926 if( pFldItem
&& (pFldItem
->GetField()->ISA( SvxDateField
) ||
1927 pFldItem
->GetField()->ISA( SvxAuthorField
) ||
1928 pFldItem
->GetField()->ISA( SvxExtFileField
) ||
1929 pFldItem
->GetField()->ISA( SvxExtTimeField
) ) )
1932 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
1933 AbstractSdModifyFieldDlg
* pDlg
= pFact
? pFact
->CreateSdModifyFieldDlg(GetActiveWindow(), pFldItem
->GetField(), pOLV
->GetAttribs() ) : 0;
1934 if( pDlg
&& pDlg
->Execute() == RET_OK
)
1936 // To make a correct SetAttribs() call at the utlinerView
1937 // it is necessary to split the actions here
1938 SvxFieldData
* pField
= pDlg
->GetField();
1939 ESelection aSel
= pOLV
->GetSelection();
1940 sal_Bool
bSelectionWasModified(sal_False
);
1944 SvxFieldItem
aFieldItem( *pField
, EE_FEATURE_FIELD
);
1946 if( aSel
.nStartPos
== aSel
.nEndPos
)
1948 bSelectionWasModified
= sal_True
;
1950 pOLV
->SetSelection( aSel
);
1953 pOLV
->InsertField( aFieldItem
);
1955 // select again for eventual SetAttribs call
1956 pOLV
->SetSelection( aSel
);
1959 SfxItemSet
aSet( pDlg
->GetItemSet() );
1963 pOLV
->SetAttribs( aSet
);
1965 ::Outliner
* pOutliner
= pOLV
->GetOutliner();
1967 pOutliner
->UpdateFields();
1972 // restore selection to original
1973 if(bSelectionWasModified
)
1976 pOLV
->SetSelection( aSel
);
1991 case SID_OPEN_XML_FILTERSETTINGS
:
1995 css::uno::Reference
< css::ui::dialogs::XExecutableDialog
> xDialog
= css::ui::dialogs::XSLTFilterDialog::create( ::comphelper::getProcessComponentContext() );
1998 catch( ::com::sun::star::uno::RuntimeException
& )
2000 DBG_UNHANDLED_EXCEPTION();
2008 case SID_GROUP
: // BASIC
2010 if ( mpDrawView
->IsPresObjSelected( sal_True
, sal_True
, sal_True
) )
2012 ::sd::Window
* pWindow
= GetActiveWindow();
2013 InfoBox(pWindow
, String(SdResId(STR_ACTION_NOTPOSSIBLE
) ) ).Execute();
2017 mpDrawView
->GroupMarked();
2024 case SID_UNGROUP
: // BASIC
2026 mpDrawView
->UnGroupMarked();
2032 case SID_NAME_GROUP
:
2034 // only allow for single object selection since the name of an object needs
2036 if(1L == mpDrawView
->GetMarkedObjectCount())
2039 SdrObject
* pSelected
= mpDrawView
->GetMarkedObjectByIndex(0L);
2040 OSL_ENSURE(pSelected
, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
2041 String
aName(pSelected
->GetName());
2043 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
2044 OSL_ENSURE(pFact
, "Dialogdiet fail!");
2045 AbstractSvxObjectNameDialog
* pDlg
= pFact
->CreateSvxObjectNameDialog(NULL
, aName
);
2046 OSL_ENSURE(pDlg
, "Dialogdiet fail!");
2048 pDlg
->SetCheckNameHdl(LINK(this, DrawViewShell
, NameObjectHdl
));
2050 if(RET_OK
== pDlg
->Execute())
2052 pDlg
->GetName(aName
);
2053 pSelected
->SetName(aName
);
2059 SfxBindings
& rBindings
= GetViewFrame()->GetBindings();
2060 rBindings
.Invalidate( SID_NAVIGATOR_STATE
, sal_True
, sal_False
);
2061 rBindings
.Invalidate( SID_CONTEXT
);
2069 case SID_OBJECT_TITLE_DESCRIPTION
:
2071 if(1L == mpDrawView
->GetMarkedObjectCount())
2073 SdrObject
* pSelected
= mpDrawView
->GetMarkedObjectByIndex(0L);
2074 OSL_ENSURE(pSelected
, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
2075 String
aTitle(pSelected
->GetTitle());
2076 String
aDescription(pSelected
->GetDescription());
2078 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
2079 OSL_ENSURE(pFact
, "Dialogdiet fail!");
2080 AbstractSvxObjectTitleDescDialog
* pDlg
= pFact
->CreateSvxObjectTitleDescDialog(NULL
, aTitle
, aDescription
);
2081 OSL_ENSURE(pDlg
, "Dialogdiet fail!");
2083 if(RET_OK
== pDlg
->Execute())
2085 pDlg
->GetTitle(aTitle
);
2086 pDlg
->GetDescription(aDescription
);
2087 pSelected
->SetTitle(aTitle
);
2088 pSelected
->SetDescription(aDescription
);
2094 SfxBindings
& rBindings
= GetViewFrame()->GetBindings();
2095 rBindings
.Invalidate( SID_NAVIGATOR_STATE
, sal_True
, sal_False
);
2096 rBindings
.Invalidate( SID_CONTEXT
);
2103 case SID_ENTER_GROUP
: // BASIC
2105 mpDrawView
->EnterMarkedGroup();
2111 case SID_LEAVE_GROUP
: // BASIC
2113 mpDrawView
->LeaveOneGroup();
2119 case SID_LEAVE_ALL_GROUPS
: // BASIC
2121 mpDrawView
->LeaveAllGroup();
2127 case SID_COMBINE
: // BASIC
2129 // End text edit to avoid conflicts
2130 if(mpDrawView
->IsTextEdit())
2131 mpDrawView
->SdrEndTextEdit();
2133 if ( mpDrawView
->IsPresObjSelected() )
2135 ::sd::Window
* pWindow
= GetActiveWindow();
2136 InfoBox(pWindow
, String(SdResId(STR_ACTION_NOTPOSSIBLE
) ) ).Execute();
2140 WaitObject
aWait( (Window
*)GetActiveWindow() );
2141 mpDrawView
->CombineMarkedObjects(sal_False
);
2148 case SID_DISTRIBUTE_DLG
:
2150 if ( mpDrawView
->IsPresObjSelected() )
2152 ::sd::Window
* pWindow
= GetActiveWindow();
2153 InfoBox(pWindow
, String(SdResId(STR_ACTION_NOTPOSSIBLE
) ) ).Execute();
2157 mpDrawView
->DistributeMarkedObjects();
2164 case SID_POLY_MERGE
:
2166 // End text edit to avoid conflicts
2167 if(mpDrawView
->IsTextEdit())
2168 mpDrawView
->SdrEndTextEdit();
2170 if ( mpDrawView
->IsPresObjSelected() )
2172 ::sd::Window
* pWindow
= GetActiveWindow();
2173 InfoBox(pWindow
, String(SdResId(STR_ACTION_NOTPOSSIBLE
) ) ).Execute();
2177 WaitObject
aWait( (Window
*)GetActiveWindow() );
2178 mpDrawView
->MergeMarkedObjects(SDR_MERGE_MERGE
);
2185 case SID_POLY_SUBSTRACT
:
2187 // End text edit to avoid conflicts
2188 if(mpDrawView
->IsTextEdit())
2189 mpDrawView
->SdrEndTextEdit();
2191 if ( mpDrawView
->IsPresObjSelected() )
2193 ::sd::Window
* pWindow
= GetActiveWindow();
2194 InfoBox(pWindow
, String(SdResId(STR_ACTION_NOTPOSSIBLE
) ) ).Execute();
2198 WaitObject
aWait( (Window
*)GetActiveWindow() );
2199 mpDrawView
->MergeMarkedObjects(SDR_MERGE_SUBSTRACT
);
2206 case SID_POLY_INTERSECT
:
2208 // End text edit to avoid conflicts
2209 if(mpDrawView
->IsTextEdit())
2210 mpDrawView
->SdrEndTextEdit();
2212 if ( mpDrawView
->IsPresObjSelected() )
2214 ::sd::Window
* pWindow
= GetActiveWindow();
2215 InfoBox(pWindow
, String(SdResId(STR_ACTION_NOTPOSSIBLE
) ) ).Execute();
2219 WaitObject
aWait( (Window
*)GetActiveWindow() );
2220 mpDrawView
->MergeMarkedObjects(SDR_MERGE_INTERSECT
);
2227 case SID_DISMANTLE
: // BASIC
2229 if ( mpDrawView
->IsDismantlePossible(sal_False
) )
2231 WaitObject
aWait( (Window
*)GetActiveWindow() );
2232 mpDrawView
->DismantleMarkedObjects(sal_False
);
2239 case SID_CONNECT
: // BASIC
2241 if ( mpDrawView
->IsPresObjSelected() )
2243 ::sd::Window
* pWindow
= GetActiveWindow();
2244 InfoBox(pWindow
, String(SdResId(STR_ACTION_NOTPOSSIBLE
) ) ).Execute();
2248 WaitObject
aWait( (Window
*)GetActiveWindow() );
2249 mpDrawView
->CombineMarkedObjects(sal_True
);
2256 case SID_BREAK
: // BASIC
2258 if ( mpDrawView
->IsTextEdit() )
2260 mpDrawView
->SdrEndTextEdit();
2263 if ( mpDrawView
->IsBreak3DObjPossible() )
2265 WaitObject
aWait( (Window
*)GetActiveWindow() );
2266 mpDrawView
->Break3DObj();
2268 else if ( mpDrawView
->IsDismantlePossible(sal_True
) )
2270 WaitObject
aWait( (Window
*)GetActiveWindow() );
2271 mpDrawView
->DismantleMarkedObjects(sal_True
);
2273 else if ( mpDrawView
->IsImportMtfPossible() )
2275 WaitObject
aWait( (Window
*)GetActiveWindow() );
2276 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
2277 sal_uLong nAnz
=rMarkList
.GetMarkCount();
2279 // determine the sum of meta objects of all selected meta files
2280 sal_uLong nCount
= 0;
2281 for(sal_uLong nm
=0; nm
<nAnz
; nm
++)
2283 SdrMark
* pM
=rMarkList
.GetMark(nm
);
2284 SdrObject
* pObj
=pM
->GetMarkedSdrObj();
2285 SdrGrafObj
* pGraf
=PTR_CAST(SdrGrafObj
,pObj
);
2286 SdrOle2Obj
* pOle2
=PTR_CAST(SdrOle2Obj
,pObj
);
2290 if(pGraf
->HasGDIMetaFile())
2292 nCount
+= pGraf
->GetGraphic().GetGDIMetaFile().GetActionSize();
2294 else if(pGraf
->isEmbeddedSvg())
2296 nCount
+= pGraf
->getMetafileFromEmbeddedSvg().GetActionSize();
2300 if(pOle2
&& pOle2
->GetGraphic())
2302 nCount
+= pOle2
->GetGraphic()->GetGDIMetaFile().GetActionSize();
2306 // decide with the sum of all meta objects if we should show a dialog
2307 if(nCount
< MIN_ACTIONS_FOR_DIALOG
)
2310 mpDrawView
->DoImportMarkedMtf();
2314 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
2317 VclAbstractDialog
* pDlg
= pFact
->CreateBreakDlg(GetActiveWindow(), mpDrawView
, GetDocSh(), nCount
, nAnz
);
2332 case SID_CONVERT_TO_3D
:
2334 if ( mpDrawView
->IsPresObjSelected() )
2336 ::sd::Window
* pWindow
= GetActiveWindow();
2337 InfoBox(pWindow
, String(SdResId(STR_ACTION_NOTPOSSIBLE
) ) ).Execute();
2341 if (mpDrawView
->IsConvertTo3DObjPossible())
2343 if (mpDrawView
->IsTextEdit())
2345 mpDrawView
->SdrEndTextEdit();
2348 WaitObject
aWait( (Window
*)GetActiveWindow() );
2349 mpDrawView
->ConvertMarkedObjTo3D(true);
2358 case SID_FRAME_TO_TOP
: // BASIC
2360 mpDrawView
->PutMarkedToTop();
2362 Invalidate( SID_POSITION
);
2367 case SID_MOREFRONT
: // BASIC
2369 mpDrawView
->MovMarkedToTop();
2371 Invalidate( SID_POSITION
);
2376 case SID_MOREBACK
: // BASIC
2378 mpDrawView
->MovMarkedToBtm();
2380 Invalidate( SID_POSITION
);
2385 case SID_FRAME_TO_BOTTOM
: // BASIC
2387 mpDrawView
->PutMarkedToBtm();
2389 Invalidate( SID_POSITION
);
2394 case SID_HORIZONTAL
: // BASIC
2395 case SID_FLIP_HORIZONTAL
:
2397 mpDrawView
->MirrorAllMarkedHorizontal();
2403 case SID_VERTICAL
: // BASIC
2404 case SID_FLIP_VERTICAL
:
2406 mpDrawView
->MirrorAllMarkedVertical();
2412 case SID_OBJECT_ALIGN_LEFT
: // BASIC
2414 mpDrawView
->AlignMarkedObjects(SDRHALIGN_LEFT
, SDRVALIGN_NONE
);
2420 case SID_OBJECT_ALIGN_CENTER
: // BASIC
2422 mpDrawView
->AlignMarkedObjects(SDRHALIGN_CENTER
, SDRVALIGN_NONE
);
2428 case SID_OBJECT_ALIGN_RIGHT
: // BASIC
2430 mpDrawView
->AlignMarkedObjects(SDRHALIGN_RIGHT
, SDRVALIGN_NONE
);
2436 case SID_OBJECT_ALIGN_UP
: // BASIC
2438 mpDrawView
->AlignMarkedObjects(SDRHALIGN_NONE
, SDRVALIGN_TOP
);
2444 case SID_OBJECT_ALIGN_MIDDLE
: // BASIC
2446 mpDrawView
->AlignMarkedObjects(SDRHALIGN_NONE
, SDRVALIGN_CENTER
);
2452 case SID_OBJECT_ALIGN_DOWN
: // BASIC
2454 mpDrawView
->AlignMarkedObjects(SDRHALIGN_NONE
, SDRVALIGN_BOTTOM
);
2460 case SID_SELECTALL
: // BASIC
2462 if( (dynamic_cast<FuSelection
*>( GetOldFunction().get() ) != 0) &&
2463 !GetView()->IsFrameDragSingles() && GetView()->HasMarkablePoints())
2465 if ( !mpDrawView
->IsAction() )
2466 mpDrawView
->MarkAllPoints();
2469 mpDrawView
->SelectAll();
2476 case SID_STYLE_NEW
: // BASIC ???
2477 case SID_STYLE_APPLY
:
2478 case SID_STYLE_EDIT
:
2479 case SID_STYLE_DELETE
:
2480 case SID_STYLE_HIDE
:
2481 case SID_STYLE_SHOW
:
2482 case SID_STYLE_FAMILY
:
2483 case SID_STYLE_WATERCAN
:
2484 case SID_STYLE_UPDATE_BY_EXAMPLE
:
2485 case SID_STYLE_NEW_BY_EXAMPLE
:
2487 if( rReq
.GetSlot() == SID_STYLE_EDIT
&& !rReq
.GetArgs() )
2489 SfxStyleSheet
* pStyleSheet
= mpDrawView
->GetStyleSheet();
2490 if( pStyleSheet
&& pStyleSheet
->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE
)
2491 pStyleSheet
= ((SdStyleSheet
*)pStyleSheet
)->GetPseudoStyleSheet();
2493 if( (pStyleSheet
== NULL
) && GetView()->IsTextEdit() )
2495 GetView()->SdrEndTextEdit();
2497 pStyleSheet
= mpDrawView
->GetStyleSheet();
2498 if(pStyleSheet
&& pStyleSheet
->GetFamily() == SD_STYLE_FAMILY_MASTERPAGE
)
2499 pStyleSheet
= ((SdStyleSheet
*)pStyleSheet
)->GetPseudoStyleSheet();
2502 if( pStyleSheet
== NULL
)
2508 SfxAllItemSet
aSet(GetDoc()->GetPool());
2510 SfxStringItem
aStyleNameItem( SID_STYLE_EDIT
, pStyleSheet
->GetName() );
2511 aSet
.Put(aStyleNameItem
);
2513 SfxUInt16Item
aStyleFamilyItem( SID_STYLE_FAMILY
, (sal_uInt16
)pStyleSheet
->GetFamily() );
2514 aSet
.Put(aStyleFamilyItem
);
2519 if( rReq
.GetArgs() )
2521 SetCurrentFunction( FuTemplate::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
2522 if( rReq
.GetSlot() == SID_STYLE_APPLY
)
2523 GetViewFrame()->GetBindings().Invalidate( SID_STYLE_APPLY
);
2526 else if( rReq
.GetSlot() == SID_STYLE_APPLY
)
2527 GetViewFrame()->GetDispatcher()->Execute( SID_STYLE_DESIGNER
, SFX_CALLMODE_ASYNCHRON
);
2534 sal_uInt16 nId
= SvxIMapDlgChildWindow::GetChildWindowId();
2536 GetViewFrame()->ToggleChildWindow( nId
);
2537 GetViewFrame()->GetBindings().Invalidate( SID_IMAP
);
2539 if ( GetViewFrame()->HasChildWindow( nId
)
2540 && ( ( ViewShell::Implementation::GetImageMapDialog() ) != NULL
) )
2542 const SdrMarkList
& rMarkList
= mpDrawView
->GetMarkedObjectList();
2544 if ( rMarkList
.GetMarkCount() == 1 )
2545 UpdateIMapDlg( rMarkList
.GetMark( 0 )->GetMarkedSdrObj() );
2553 case SID_GRID_FRONT
:
2555 mpDrawView
->SetGridFront( !mpDrawView
->IsGridFront() );
2561 case SID_HELPLINES_FRONT
:
2563 mpDrawView
->SetHlplFront( !mpDrawView
->IsHlplFront() );
2571 if ( rReq
.GetArgs() )
2573 GetViewFrame()->SetChildWindow(SvxFontWorkChildWindow::GetChildWindowId(),
2574 ((const SfxBoolItem
&) (rReq
.GetArgs()->
2575 Get(SID_FONTWORK
))).GetValue());
2579 GetViewFrame()->ToggleChildWindow( SvxFontWorkChildWindow::GetChildWindowId() );
2582 GetViewFrame()->GetBindings().Invalidate(SID_FONTWORK
);
2588 case SID_COLOR_CONTROL
:
2590 if ( rReq
.GetArgs() )
2591 GetViewFrame()->SetChildWindow(SvxColorChildWindow::GetChildWindowId(),
2592 ((const SfxBoolItem
&) (rReq
.GetArgs()->
2593 Get(SID_COLOR_CONTROL
))).GetValue());
2595 GetViewFrame()->ToggleChildWindow(SvxColorChildWindow::GetChildWindowId() );
2597 GetViewFrame()->GetBindings().Invalidate(SID_COLOR_CONTROL
);
2603 case SID_EXTRUSION_TOOGLE
:
2604 case SID_EXTRUSION_TILT_DOWN
:
2605 case SID_EXTRUSION_TILT_UP
:
2606 case SID_EXTRUSION_TILT_LEFT
:
2607 case SID_EXTRUSION_TILT_RIGHT
:
2608 case SID_EXTRUSION_3D_COLOR
:
2609 case SID_EXTRUSION_DEPTH
:
2610 case SID_EXTRUSION_DIRECTION
:
2611 case SID_EXTRUSION_PROJECTION
:
2612 case SID_EXTRUSION_LIGHTING_DIRECTION
:
2613 case SID_EXTRUSION_LIGHTING_INTENSITY
:
2614 case SID_EXTRUSION_SURFACE
:
2615 case SID_EXTRUSION_DEPTH_FLOATER
:
2616 case SID_EXTRUSION_DIRECTION_FLOATER
:
2617 case SID_EXTRUSION_LIGHTING_FLOATER
:
2618 case SID_EXTRUSION_SURFACE_FLOATER
:
2619 case SID_EXTRUSION_DEPTH_DIALOG
:
2620 svx::ExtrusionBar::execute( mpDrawView
, rReq
, GetViewFrame()->GetBindings() );
2625 case SID_FONTWORK_SHAPE
:
2626 case SID_FONTWORK_SHAPE_TYPE
:
2627 case SID_FONTWORK_ALIGNMENT
:
2628 case SID_FONTWORK_SAME_LETTER_HEIGHTS
:
2629 case SID_FONTWORK_CHARACTER_SPACING
:
2630 case SID_FONTWORK_KERN_CHARACTER_PAIRS
:
2631 case SID_FONTWORK_GALLERY_FLOATER
:
2632 case SID_FONTWORK_CHARACTER_SPACING_FLOATER
:
2633 case SID_FONTWORK_ALIGNMENT_FLOATER
:
2634 case SID_FONTWORK_CHARACTER_SPACING_DIALOG
:
2635 svx::FontworkBar::execute( mpDrawView
, rReq
, GetViewFrame()->GetBindings() );
2642 GetViewFrame()->ToggleChildWindow( SvxBmpMaskChildWindow::GetChildWindowId() );
2643 GetViewFrame()->GetBindings().Invalidate( SID_BMPMASK
);
2652 GetViewFrame()->ToggleChildWindow( GalleryChildWindow::GetChildWindowId() );
2653 GetViewFrame()->GetBindings().Invalidate( SID_GALLERY
);
2662 if ( rReq
.GetArgs() )
2663 GetViewFrame()->SetChildWindow(SID_NAVIGATOR
,
2664 ((const SfxBoolItem
&) (rReq
.GetArgs()->
2665 Get(SID_NAVIGATOR
))).GetValue());
2667 GetViewFrame()->ToggleChildWindow( SID_NAVIGATOR
);
2669 GetViewFrame()->GetBindings().Invalidate(SID_NAVIGATOR
);
2675 case SID_ANIMATION_OBJECTS
:
2677 if ( rReq
.GetArgs() )
2678 GetViewFrame()->SetChildWindow(
2679 AnimationChildWindow::GetChildWindowId(),
2680 ((const SfxBoolItem
&) (rReq
.GetArgs()->
2681 Get(SID_ANIMATION_OBJECTS
))).GetValue());
2683 GetViewFrame()->ToggleChildWindow(
2684 AnimationChildWindow::GetChildWindowId() );
2686 GetViewFrame()->GetBindings().Invalidate(SID_ANIMATION_OBJECTS
);
2692 case SID_CUSTOM_ANIMATION_PANEL
:
2694 // Make the slide transition panel visible (expand it) in the
2696 framework::FrameworkHelper::Instance(GetViewShellBase())->RequestSidebarPanel(
2697 framework::FrameworkHelper::msCustomAnimationTaskPanelURL
);
2704 case SID_SLIDE_TRANSITIONS_PANEL
:
2706 // Make the slide transition panel visible (expand it) in the
2708 framework::FrameworkHelper::Instance(GetViewShellBase())->RequestSidebarPanel(
2709 framework::FrameworkHelper::msSlideTransitionTaskPanelURL
);
2718 if ( rReq
.GetArgs() )
2719 GetViewFrame()->SetChildWindow( Svx3DChildWindow::GetChildWindowId(),
2720 ((const SfxBoolItem
&) (rReq
.GetArgs()->
2721 Get( SID_3D_WIN
))).GetValue());
2723 GetViewFrame()->ToggleChildWindow( Svx3DChildWindow::GetChildWindowId() );
2725 GetViewFrame()->GetBindings().Invalidate( SID_3D_WIN
);
2731 case SID_CONVERT_TO_3D_LATHE_FAST
:
2733 /* The call is enough. The initialization via Start3DCreation and
2734 CreateMirrorPolygons is no longer needed if the parameter
2735 sal_True is provided. Then a tilted rotary body with an axis left
2736 besides the bounding rectangle of the selected objects is drawn
2737 immediately and without user interaction. */
2738 mpDrawView
->SdrEndTextEdit();
2739 if(GetActiveWindow())
2740 GetActiveWindow()->EnterWait();
2741 mpDrawView
->End3DCreation(true);
2744 if(GetActiveWindow())
2745 GetActiveWindow()->LeaveWait();
2749 case SID_PRESENTATION_DLG
:
2751 SetCurrentFunction( FuSlideShowDlg::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
2756 case SID_REMOTE_DLG
:
2758 #ifdef ENABLE_SDREMOTE
2759 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
2760 VclAbstractDialog
* pDlg
= pFact
? pFact
->CreateRemoteDialog(GetActiveWindow()) : 0;
2767 case SID_CUSTOMSHOW_DLG
:
2769 SetCurrentFunction( FuCustomShowDlg::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
2774 case SID_EXPAND_PAGE
:
2776 SetCurrentFunction( FuExpandPage::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
2781 case SID_SUMMARY_PAGE
:
2783 mpDrawView
->SdrEndTextEdit();
2784 SetCurrentFunction( FuSummaryPage::Create( this, GetActiveWindow(), mpDrawView
, GetDoc(), rReq
) );
2789 case SID_AVMEDIA_PLAYER
:
2791 GetViewFrame()->ToggleChildWindow( ::avmedia::MediaPlayer::GetChildWindowId() );
2792 GetViewFrame()->GetBindings().Invalidate( SID_AVMEDIA_PLAYER
);
2798 case SID_LAYER_DIALOG_WIN
:
2800 if ( rReq
.GetArgs() )
2802 GetViewFrame()->SetChildWindow(
2803 LayerDialogChildWindow::GetChildWindowId(),
2804 ((const SfxBoolItem
&) (rReq
.GetArgs()->
2805 Get(SID_LAYER_DIALOG_WIN
))).GetValue());
2809 GetViewFrame()->ToggleChildWindow(
2810 LayerDialogChildWindow::GetChildWindowId());
2813 GetViewFrame()->GetBindings().Invalidate(SID_LAYER_DIALOG_WIN
);
2819 case SID_DISPLAY_MASTER_BACKGROUND
:
2820 case SID_DISPLAY_MASTER_OBJECTS
:
2822 // Determine current page and toggle visibility of layers
2823 // associated with master page background or master page shapes.
2824 SdPage
* pPage
= GetActualPage();
2826 && GetDoc() != NULL
)
2828 SetOfByte aVisibleLayers
= pPage
->TRG_GetMasterPageVisibleLayers();
2829 SdrLayerAdmin
& rLayerAdmin
= GetDoc()->GetLayerAdmin();
2831 if (nSId
== SID_DISPLAY_MASTER_BACKGROUND
)
2832 aLayerId
= rLayerAdmin
.GetLayerID(String(SdResId(STR_LAYER_BCKGRND
)), sal_False
);
2834 aLayerId
= rLayerAdmin
.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ
)), sal_False
);
2835 aVisibleLayers
.Set(aLayerId
, !aVisibleLayers
.IsSet(aLayerId
));
2836 pPage
->TRG_SetMasterPageVisibleLayers(aVisibleLayers
);
2843 case SID_PHOTOALBUM
:
2845 SdAbstractDialogFactory
* pFact
= SdAbstractDialogFactory::Create();
2846 VclAbstractDialog
* pDlg
= pFact
? pFact
->CreateSdPhotoAlbumDialog(
2862 DBG_ASSERT( 0, "Slot without function" );
2869 if(HasCurrentFunction())
2871 GetCurrentFunction()->Activate();
2875 void DrawViewShell::ExecChar( SfxRequest
&rReq
)
2877 SdDrawDocument
* pDoc
= GetDoc();
2878 if (!pDoc
|| !mpDrawView
)
2881 SfxItemSet
aEditAttr( pDoc
->GetPool() );
2882 mpDrawView
->GetAttributes( aEditAttr
);
2884 //modified by wj for sym2_1580, if put old itemset into new set,
2885 //when mpDrawView->SetAttributes(aNewAttr) it will invalidate all the item
2886 // and use old attr to update all the attributes
2887 // SfxItemSet aNewAttr( GetPool(),
2888 // EE_ITEMS_START, EE_ITEMS_END );
2889 // aNewAttr.Put( aEditAttr, sal_False );
2890 SfxItemSet
aNewAttr( pDoc
->GetPool() );
2893 sal_uInt16 nSId
= rReq
.GetSlot();
2899 case SID_ATTR_CHAR_FONT
:
2900 if( rReq
.GetArgs() )
2902 SFX_REQUEST_ARG( rReq
, pItem
, SvxFontItem
, SID_ATTR_CHAR_FONT
, sal_False
);
2905 aNewAttr
.Put(*pItem
);
2909 case SID_ATTR_CHAR_FONTHEIGHT
:
2910 if( rReq
.GetArgs() )
2912 SFX_REQUEST_ARG( rReq
, pItem
, SvxFontHeightItem
, SID_ATTR_CHAR_FONTHEIGHT
, sal_False
);
2915 aNewAttr
.Put(*pItem
);
2919 case SID_ATTR_CHAR_WEIGHT
:
2920 if( rReq
.GetArgs() )
2922 //const SvxWeightItem *pItem = (const SvxWeightItem*) rReq.GetArg( SID_ATTR_CHAR_WEIGHT, sal_False, TYPE(SvxWeightItem) );
2923 SFX_REQUEST_ARG( rReq
, pItem
, SvxWeightItem
, SID_ATTR_CHAR_WEIGHT
, sal_False
);
2926 aNewAttr
.Put(*pItem
);
2930 case SID_ATTR_CHAR_POSTURE
:
2931 if( rReq
.GetArgs() )
2933 //const SvxPostureItem *pItem = (const SvxPostureItem*) rReq.GetArg( SID_ATTR_CHAR_POSTURE, sal_False, TYPE(SvxPostureItem) );
2934 SFX_REQUEST_ARG( rReq
, pItem
, SvxPostureItem
, SID_ATTR_CHAR_POSTURE
, sal_False
);
2937 aNewAttr
.Put(*pItem
);
2941 case SID_ATTR_CHAR_UNDERLINE
:
2942 if( rReq
.GetArgs() )
2944 //<<modify by wj for sym2_1873
2945 //SFX_REQUEST_ARG( rReq, pItem, SvxTextLineItem, SID_ATTR_CHAR_UNDERLINE , sal_False );
2946 SFX_REQUEST_ARG( rReq
, pItem
, SvxUnderlineItem
, SID_ATTR_CHAR_UNDERLINE
, sal_False
);
2950 aNewAttr
.Put(*pItem
);
2954 FontUnderline eFU
= ( (const SvxUnderlineItem
&) aEditAttr
.Get( EE_CHAR_UNDERLINE
) ).GetLineStyle();
2955 aNewAttr
.Put( SvxUnderlineItem( eFU
!= UNDERLINE_NONE
?UNDERLINE_NONE
: UNDERLINE_SINGLE
, EE_CHAR_UNDERLINE
) );
2956 }//aNewAttr.Put( (const SvxUnderlineItem&)aEditAttr.Get( EE_CHAR_UNDERLINE ) );
2959 case SID_ATTR_CHAR_SHADOWED
:
2960 if( rReq
.GetArgs() )
2962 SFX_REQUEST_ARG( rReq
, pItem
, SvxShadowedItem
, SID_ATTR_CHAR_SHADOWED
, sal_False
);
2965 aNewAttr
.Put(*pItem
);
2969 case SID_ATTR_CHAR_STRIKEOUT
:
2970 if( rReq
.GetArgs() )
2972 SFX_REQUEST_ARG( rReq
, pItem
, SvxCrossedOutItem
, SID_ATTR_CHAR_STRIKEOUT
, sal_False
);
2975 aNewAttr
.Put(*pItem
);
2979 case SID_ATTR_CHAR_COLOR
:
2980 if( rReq
.GetArgs() )
2982 SFX_REQUEST_ARG( rReq
, pItem
, SvxColorItem
, SID_ATTR_CHAR_COLOR
, sal_False
);
2985 aNewAttr
.Put(*pItem
);
2989 case SID_ATTR_CHAR_KERNING
:
2990 if( rReq
.GetArgs() )
2992 SFX_REQUEST_ARG( rReq
, pItem
, SvxKerningItem
, SID_ATTR_CHAR_KERNING
, sal_False
);
2995 aNewAttr
.Put(*pItem
);
2999 case SID_SET_SUB_SCRIPT
:
3000 if( rReq
.GetArgs() )
3002 SvxEscapementItem
aItem( EE_CHAR_ESCAPEMENT
);
3003 SvxEscapement eEsc
= (SvxEscapement
) ( (const SvxEscapementItem
&)
3004 aEditAttr
.Get( EE_CHAR_ESCAPEMENT
) ).GetEnumValue();
3005 if( eEsc
== SVX_ESCAPEMENT_SUBSCRIPT
)
3006 aItem
.SetEscapement( SVX_ESCAPEMENT_OFF
);
3008 aItem
.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT
);
3009 aNewAttr
.Put( aItem
);
3012 case SID_SET_SUPER_SCRIPT
:
3013 if( rReq
.GetArgs() )
3015 SvxEscapementItem
aItem( EE_CHAR_ESCAPEMENT
);
3016 SvxEscapement eEsc
= (SvxEscapement
) ( (const SvxEscapementItem
&)
3017 aEditAttr
.Get( EE_CHAR_ESCAPEMENT
) ).GetEnumValue();
3018 if( eEsc
== SVX_ESCAPEMENT_SUPERSCRIPT
)
3019 aItem
.SetEscapement( SVX_ESCAPEMENT_OFF
);
3021 aItem
.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT
);
3022 aNewAttr
.Put( aItem
);
3025 case SID_SHRINK_FONT_SIZE
:
3026 case SID_GROW_FONT_SIZE
:
3027 //if (rReq.GetArgs())
3029 const SvxFontListItem
* pFonts
= dynamic_cast<const SvxFontListItem
*>(GetDocSh()->GetItem( SID_ATTR_CHAR_FONTLIST
) );
3030 const FontList
* pFontList
= pFonts
->GetFontList();
3033 FuText::ChangeFontSize( nSId
== SID_GROW_FONT_SIZE
, NULL
, pFontList
, mpView
);
3034 GetViewFrame()->GetBindings().Invalidate( SID_ATTR_CHAR_FONTHEIGHT
);
3041 mpDrawView
->SetAttributes(aNewAttr
);
3046 /** This method consists basically of three parts:
3047 1. Process the arguments of the SFX request.
3048 2. Use the model to create a new page or duplicate an existing one.
3049 3. Update the tab control and switch to the new page.
3051 SdPage
* DrawViewShell::CreateOrDuplicatePage (
3052 SfxRequest
& rRequest
,
3055 const sal_Int32 nInsertPosition
)
3057 SdPage
* pNewPage
= NULL
;
3058 if (ePageKind
== PK_STANDARD
&& meEditMode
!= EM_MASTERPAGE
)
3060 if ( mpDrawView
->IsTextEdit() )
3062 mpDrawView
->SdrEndTextEdit();
3064 pNewPage
= ViewShell::CreateOrDuplicatePage (rRequest
, ePageKind
, pPage
, nInsertPosition
);
3069 void DrawViewShell::ExecutePropPanelAttr (SfxRequest
& rReq
)
3071 if(SlideShow::IsRunning( GetViewShellBase() ))
3074 SdDrawDocument
* pDoc
= GetDoc();
3075 if (!pDoc
|| !mpDrawView
)
3078 sal_uInt16 nSId
= rReq
.GetSlot();
3079 SfxItemSet
aAttrs( pDoc
->GetPool() );
3083 case SID_TABLE_VERT_NONE
:
3084 case SID_TABLE_VERT_CENTER
:
3085 case SID_TABLE_VERT_BOTTOM
:
3086 SdrTextVertAdjust eTVA
= SDRTEXTVERTADJUST_TOP
;
3087 if (nSId
== SID_TABLE_VERT_CENTER
)
3088 eTVA
= SDRTEXTVERTADJUST_CENTER
;
3089 else if (nSId
== SID_TABLE_VERT_BOTTOM
)
3090 eTVA
= SDRTEXTVERTADJUST_BOTTOM
;
3092 aAttrs
.Put( SdrTextVertAdjustItem(eTVA
) );
3093 mpDrawView
->SetAttributes(aAttrs
);
3099 void DrawViewShell::GetStatePropPanelAttr(SfxItemSet
& rSet
)
3101 SfxWhichIter
aIter( rSet
);
3102 sal_uInt16 nWhich
= aIter
.FirstWhich();
3104 SdDrawDocument
* pDoc
= GetDoc();
3105 if (!pDoc
|| !mpDrawView
)
3108 SfxItemSet
aAttrs( pDoc
->GetPool() );
3109 mpDrawView
->GetAttributes( aAttrs
);
3113 sal_uInt16 nSlotId
= SfxItemPool::IsWhich(nWhich
)
3114 ? GetPool().GetSlotId(nWhich
)
3118 case SID_TABLE_VERT_NONE
:
3119 case SID_TABLE_VERT_CENTER
:
3120 case SID_TABLE_VERT_BOTTOM
:
3121 sal_Bool bContour
= sal_False
;
3122 SfxItemState eConState
= aAttrs
.GetItemState( SDRATTR_TEXT_CONTOURFRAME
);
3123 if( eConState
!= SFX_ITEM_DONTCARE
)
3125 bContour
= ( ( const SdrTextContourFrameItem
& )aAttrs
.Get( SDRATTR_TEXT_CONTOURFRAME
) ).GetValue();
3127 if (bContour
) break;
3129 SfxItemState eVState
= aAttrs
.GetItemState( SDRATTR_TEXT_VERTADJUST
);
3130 //SfxItemState eHState = aAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST );
3132 //if(SFX_ITEM_DONTCARE != eVState && SFX_ITEM_DONTCARE != eHState)
3133 if(SFX_ITEM_DONTCARE
!= eVState
)
3135 SdrTextVertAdjust eTVA
= (SdrTextVertAdjust
)((const SdrTextVertAdjustItem
&)aAttrs
.Get(SDRATTR_TEXT_VERTADJUST
)).GetValue();
3136 sal_Bool bSet
= (nSlotId
== SID_TABLE_VERT_NONE
&& eTVA
== SDRTEXTVERTADJUST_TOP
) ||
3137 (nSlotId
== SID_TABLE_VERT_CENTER
&& eTVA
== SDRTEXTVERTADJUST_CENTER
) ||
3138 (nSlotId
== SID_TABLE_VERT_BOTTOM
&& eTVA
== SDRTEXTVERTADJUST_BOTTOM
);
3139 rSet
.Put(SfxBoolItem(nSlotId
, bSet
));
3143 rSet
.Put(SfxBoolItem(nSlotId
, sal_False
));
3147 nWhich
= aIter
.NextWhich();
3151 } // end of namespace sd
3153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */