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 <editeng/eeitem.hxx>
22 #include <sfx2/viewfrm.hxx>
23 #include <sfx2/request.hxx>
24 #include <sfx2/bindings.hxx>
25 #include <tools/urlobj.hxx>
26 #include <cliputil.hxx>
27 #include <svx/svxdlg.hxx>
28 #include <svx/dialogs.hrc>
29 #include <svx/fmglob.hxx>
30 #include <svx/hlnkitem.hxx>
31 #include <svx/fontwork.hxx>
32 #include <svx/svdocapt.hxx>
33 #include <svx/svdoole2.hxx>
34 #include <svx/svdouno.hxx>
35 #include <svx/svdpage.hxx>
36 #include <svx/svdundo.hxx>
37 #include <svx/xdef.hxx>
38 #include <vcl/msgbox.hxx>
39 #include <svx/extrusionbar.hxx>
40 #include <svx/fontworkbar.hxx>
41 #include <sfx2/docfile.hxx>
43 #include <com/sun/star/form/FormButtonType.hpp>
44 #include <com/sun/star/beans/XPropertySet.hpp>
45 #include <com/sun/star/beans/XPropertySetInfo.hpp>
46 #include <com/sun/star/awt/XControlModel.hpp>
49 #include "drawview.hxx"
50 #include "viewdata.hxx"
51 #include "tabvwsh.hxx"
53 #include "scresid.hxx"
54 #include "undotab.hxx"
55 #include "drwlayer.hxx"
56 #include "userdat.hxx"
61 using namespace com::sun::star
;
63 //------------------------------------------------------------------
65 void ScDrawShell::GetHLinkState( SfxItemSet
& rSet
) // Hyperlink
67 ScDrawView
* pView
= pViewData
->GetScDrawView();
68 const SdrMarkList
& rMarkList
= pView
->GetMarkedObjectList();
69 sal_uLong nMarkCount
= rMarkList
.GetMarkCount();
73 SvxHyperlinkItem aHLinkItem
;
75 if ( nMarkCount
== 1 ) // URL-Button markiert ?
77 SdrObject
* pObj
= rMarkList
.GetMark(0)->GetMarkedSdrObj();
78 ScMacroInfo
* pInfo
= ScDrawLayer::GetMacroInfo( pObj
);
79 if ( pInfo
&& !pInfo
->GetHlink().isEmpty() )
81 aHLinkItem
.SetURL( pInfo
->GetHlink() );
82 aHLinkItem
.SetInsertMode(HLINK_FIELD
);
84 SdrUnoObj
* pUnoCtrl
= PTR_CAST(SdrUnoObj
, pObj
);
85 if (pUnoCtrl
&& FmFormInventor
== pUnoCtrl
->GetObjInventor())
87 uno::Reference
<awt::XControlModel
> xControlModel
= pUnoCtrl
->GetUnoControlModel();
88 OSL_ENSURE( xControlModel
.is(), "UNO-Control ohne Model" );
89 if( !xControlModel
.is() )
92 uno::Reference
< beans::XPropertySet
> xPropSet( xControlModel
, uno::UNO_QUERY
);
93 uno::Reference
< beans::XPropertySetInfo
> xInfo
= xPropSet
->getPropertySetInfo();
95 OUString
sPropButtonType( "ButtonType" );
96 OUString
sPropTargetURL( "TargetURL" );
97 OUString
sPropTargetFrame( "TargetFrame" );
98 OUString
sPropLabel( "Label" );
100 if(xInfo
->hasPropertyByName( sPropButtonType
))
102 uno::Any aAny
= xPropSet
->getPropertyValue( sPropButtonType
);
103 form::FormButtonType eTmp
;
104 if ( (aAny
>>= eTmp
) && eTmp
== form::FormButtonType_URL
)
108 if(xInfo
->hasPropertyByName( sPropLabel
))
110 aAny
= xPropSet
->getPropertyValue( sPropLabel
);
111 if ( (aAny
>>= sTmp
) && !sTmp
.isEmpty() )
113 aHLinkItem
.SetName(sTmp
);
117 if(xInfo
->hasPropertyByName( sPropTargetURL
))
119 aAny
= xPropSet
->getPropertyValue( sPropTargetURL
);
120 if ( (aAny
>>= sTmp
) && !sTmp
.isEmpty() )
122 aHLinkItem
.SetURL(sTmp
);
126 if(xInfo
->hasPropertyByName( sPropTargetFrame
))
128 aAny
= xPropSet
->getPropertyValue( sPropTargetFrame
);
129 if ( (aAny
>>= sTmp
) && !sTmp
.isEmpty() )
131 aHLinkItem
.SetTargetFrame(sTmp
);
134 aHLinkItem
.SetInsertMode(HLINK_BUTTON
);
140 rSet
.Put(aHLinkItem
);
143 void ScDrawShell::ExecuteHLink( SfxRequest
& rReq
)
145 const SfxItemSet
* pReqArgs
= rReq
.GetArgs();
147 sal_uInt16 nSlot
= rReq
.GetSlot();
150 case SID_HYPERLINK_SETLINK
:
153 const SfxPoolItem
* pItem
;
154 if ( pReqArgs
->GetItemState( SID_HYPERLINK_SETLINK
, sal_True
, &pItem
) == SFX_ITEM_SET
)
156 const SvxHyperlinkItem
* pHyper
= (const SvxHyperlinkItem
*) pItem
;
157 const OUString
& rName
= pHyper
->GetName();
158 const OUString
& rURL
= pHyper
->GetURL();
159 const OUString
& rTarget
= pHyper
->GetTargetFrame();
160 SvxLinkInsertMode eMode
= pHyper
->GetInsertMode();
162 sal_Bool bDone
= false;
163 if ( eMode
== HLINK_FIELD
|| eMode
== HLINK_BUTTON
)
165 ScDrawView
* pView
= pViewData
->GetScDrawView();
166 const SdrMarkList
& rMarkList
= pView
->GetMarkedObjectList();
167 if ( rMarkList
.GetMarkCount() == 1 )
169 SdrObject
* pObj
= rMarkList
.GetMark(0)->GetMarkedSdrObj();
170 SdrUnoObj
* pUnoCtrl
= PTR_CAST(SdrUnoObj
, pObj
);
171 if (pUnoCtrl
&& FmFormInventor
== pUnoCtrl
->GetObjInventor())
173 uno::Reference
<awt::XControlModel
> xControlModel
=
174 pUnoCtrl
->GetUnoControlModel();
175 OSL_ENSURE( xControlModel
.is(), "UNO-Control ohne Model" );
176 if( !xControlModel
.is() )
179 uno::Reference
< beans::XPropertySet
> xPropSet( xControlModel
, uno::UNO_QUERY
);
180 uno::Reference
< beans::XPropertySetInfo
> xInfo
= xPropSet
->getPropertySetInfo();
182 OUString
sPropTargetURL( "TargetURL" );
184 // Darf man eine URL an dem Objekt setzen?
185 if (xInfo
->hasPropertyByName( sPropTargetURL
))
189 OUString
sPropButtonType( "ButtonType");
190 OUString
sPropTargetFrame( "TargetFrame" );
191 OUString
sPropLabel( "Label" );
194 if ( xInfo
->hasPropertyByName( sPropLabel
) )
196 aAny
<<= OUString(rName
);
197 xPropSet
->setPropertyValue( sPropLabel
, aAny
);
200 OUString aTmp
= INetURLObject::GetAbsURL( pViewData
->GetDocShell()->GetMedium()->GetBaseURL(), rURL
);
202 xPropSet
->setPropertyValue( sPropTargetURL
, aAny
);
204 if( !rTarget
.isEmpty() && xInfo
->hasPropertyByName( sPropTargetFrame
) )
206 aAny
<<= OUString(rTarget
);
207 xPropSet
->setPropertyValue( sPropTargetFrame
, aAny
);
210 if ( xInfo
->hasPropertyByName( sPropButtonType
) )
212 form::FormButtonType eButtonType
= form::FormButtonType_URL
;
213 aAny
<<= eButtonType
;
214 xPropSet
->setPropertyValue( sPropButtonType
, aAny
);
218 pViewData
->GetDocShell()->SetDocumentModified();
224 SetHlinkForObject( pObj
, rURL
);
231 pViewData
->GetViewShell()->
232 InsertURL( rName
, rURL
, rTarget
, (sal_uInt16
) eMode
);
234 // InsertURL an der ViewShell schaltet bei "Text" die DrawShell ab !!!
239 OSL_FAIL("falscher Slot");
243 sal_uInt16
ScGetFontWorkId();
245 //------------------------------------------------------------------
248 // Funktionen auf Drawing-Objekten
251 void ScDrawShell::ExecDrawFunc( SfxRequest
& rReq
)
253 SfxBindings
& rBindings
= pViewData
->GetBindings();
254 ScTabView
* pTabView
= pViewData
->GetView();
255 ScDrawView
* pView
= pTabView
->GetScDrawView();
256 const SfxItemSet
*pArgs
= rReq
.GetArgs();
257 sal_uInt16 nSlotId
= rReq
.GetSlot();
260 // wer weiss, wie lange das funktioniert? (->vom Abreisscontrol funktioniert es)
262 if (nSlotId
== SID_OBJECT_ALIGN
&& pArgs
)
263 nSlotId
= SID_OBJECT_ALIGN
+ ((SfxEnumItem
&)pArgs
->Get(SID_OBJECT_ALIGN
)).GetValue() + 1;
267 case SID_OBJECT_HEAVEN
:
268 pView
->SetMarkedToLayer( SC_LAYER_FRONT
);
269 rBindings
.Invalidate(SID_OBJECT_HEAVEN
);
270 rBindings
.Invalidate(SID_OBJECT_HELL
);
272 case SID_OBJECT_HELL
:
273 pView
->SetMarkedToLayer( SC_LAYER_BACK
);
274 rBindings
.Invalidate(SID_OBJECT_HEAVEN
);
275 rBindings
.Invalidate(SID_OBJECT_HELL
);
276 // leave draw shell if nothing selected (layer may be locked)
277 pViewData
->GetViewShell()->UpdateDrawShell();
280 case SID_FRAME_TO_TOP
:
281 pView
->PutMarkedToTop();
283 case SID_FRAME_TO_BOTTOM
:
284 pView
->PutMarkedToBtm();
287 pView
->MovMarkedToTop();
290 pView
->MovMarkedToBtm();
294 pView
->GroupMarked();
297 pView
->UnGroupMarked();
299 case SID_ENTER_GROUP
:
300 pView
->EnterMarkedGroup();
302 case SID_LEAVE_GROUP
:
303 pView
->LeaveOneGroup();
306 case SID_MIRROR_HORIZONTAL
:
307 case SID_FLIP_HORIZONTAL
:
308 pView
->MirrorAllMarkedHorizontal();
309 rBindings
.Invalidate( SID_ATTR_TRANSFORM_ANGLE
);
311 case SID_MIRROR_VERTICAL
:
312 case SID_FLIP_VERTICAL
:
313 pView
->MirrorAllMarkedVertical();
314 rBindings
.Invalidate( SID_ATTR_TRANSFORM_ANGLE
);
317 case SID_OBJECT_ALIGN_LEFT
:
318 case SID_ALIGN_ANY_LEFT
:
319 if (pView
->IsAlignPossible())
320 pView
->AlignMarkedObjects(SDRHALIGN_LEFT
, SDRVALIGN_NONE
);
322 case SID_OBJECT_ALIGN_CENTER
:
323 case SID_ALIGN_ANY_HCENTER
:
324 if (pView
->IsAlignPossible())
325 pView
->AlignMarkedObjects(SDRHALIGN_CENTER
, SDRVALIGN_NONE
);
327 case SID_OBJECT_ALIGN_RIGHT
:
328 case SID_ALIGN_ANY_RIGHT
:
329 if (pView
->IsAlignPossible())
330 pView
->AlignMarkedObjects(SDRHALIGN_RIGHT
, SDRVALIGN_NONE
);
332 case SID_OBJECT_ALIGN_UP
:
333 case SID_ALIGN_ANY_TOP
:
334 if (pView
->IsAlignPossible())
335 pView
->AlignMarkedObjects(SDRHALIGN_NONE
, SDRVALIGN_TOP
);
337 case SID_OBJECT_ALIGN_MIDDLE
:
338 case SID_ALIGN_ANY_VCENTER
:
339 if (pView
->IsAlignPossible())
340 pView
->AlignMarkedObjects(SDRHALIGN_NONE
, SDRVALIGN_CENTER
);
342 case SID_OBJECT_ALIGN_DOWN
:
343 case SID_ALIGN_ANY_BOTTOM
:
344 if (pView
->IsAlignPossible())
345 pView
->AlignMarkedObjects(SDRHALIGN_NONE
, SDRVALIGN_BOTTOM
);
349 case SID_DELETE_CONTENTS
:
350 pView
->DeleteMarked();
351 pViewData
->GetViewShell()->UpdateDrawShell();
356 pViewData
->GetViewShell()->UpdateDrawShell();
364 ScClipUtil::PasteFromClipboard ( GetViewData(), GetViewData()->GetViewShell(), true );
371 case SID_ANCHOR_PAGE
:
372 pView
->SetPageAnchored();
373 rBindings
.Invalidate( SID_ANCHOR_PAGE
);
374 rBindings
.Invalidate( SID_ANCHOR_CELL
);
377 case SID_ANCHOR_CELL
:
378 pView
->SetCellAnchored();
379 rBindings
.Invalidate( SID_ANCHOR_PAGE
);
380 rBindings
.Invalidate( SID_ANCHOR_CELL
);
383 case SID_ANCHOR_TOGGLE
:
385 switch( pView
->GetAnchorType() )
388 pView
->SetPageAnchored();
391 pView
->SetCellAnchored();
395 rBindings
.Invalidate( SID_ANCHOR_PAGE
);
396 rBindings
.Invalidate( SID_ANCHOR_CELL
);
399 case SID_OBJECT_ROTATE
:
402 if (pView
->GetDragMode() == SDRDRAG_ROTATE
)
403 eMode
= SDRDRAG_MOVE
;
405 eMode
= SDRDRAG_ROTATE
;
406 pView
->SetDragMode( eMode
);
407 rBindings
.Invalidate( SID_OBJECT_ROTATE
);
408 rBindings
.Invalidate( SID_OBJECT_MIRROR
);
409 if (eMode
== SDRDRAG_ROTATE
&& !pView
->IsFrameDragSingles())
411 pView
->SetFrameDragSingles( sal_True
);
412 rBindings
.Invalidate( SID_BEZIER_EDIT
);
416 case SID_OBJECT_MIRROR
:
419 if (pView
->GetDragMode() == SDRDRAG_MIRROR
)
420 eMode
= SDRDRAG_MOVE
;
422 eMode
= SDRDRAG_MIRROR
;
423 pView
->SetDragMode( eMode
);
424 rBindings
.Invalidate( SID_OBJECT_ROTATE
);
425 rBindings
.Invalidate( SID_OBJECT_MIRROR
);
426 if (eMode
== SDRDRAG_MIRROR
&& !pView
->IsFrameDragSingles())
428 pView
->SetFrameDragSingles( sal_True
);
429 rBindings
.Invalidate( SID_BEZIER_EDIT
);
433 case SID_BEZIER_EDIT
:
435 sal_Bool bOld
= pView
->IsFrameDragSingles();
436 pView
->SetFrameDragSingles( !bOld
);
437 rBindings
.Invalidate( SID_BEZIER_EDIT
);
438 if (bOld
&& pView
->GetDragMode() != SDRDRAG_MOVE
)
440 pView
->SetDragMode( SDRDRAG_MOVE
);
441 rBindings
.Invalidate( SID_OBJECT_ROTATE
);
442 rBindings
.Invalidate( SID_OBJECT_MIRROR
);
449 sal_uInt16 nId
= ScGetFontWorkId();
450 SfxViewFrame
* pViewFrm
= pViewData
->GetViewShell()->GetViewFrame();
452 if ( rReq
.GetArgs() )
453 pViewFrm
->SetChildWindow( nId
,
454 ((const SfxBoolItem
&)
455 (rReq
.GetArgs()->Get(SID_FONTWORK
))).
458 pViewFrm
->ToggleChildWindow( nId
);
460 rBindings
.Invalidate( SID_FONTWORK
);
465 case SID_ORIGINALSIZE
:
466 pView
->SetMarkedOriginalSize();
469 case SID_ENABLE_HYPHENATION
:
471 SFX_REQUEST_ARG( rReq
, pItem
, SfxBoolItem
, SID_ENABLE_HYPHENATION
, false);
474 SfxItemSet
aSet( GetPool(), EE_PARA_HYPHENATE
, EE_PARA_HYPHENATE
);
475 sal_Bool bValue
= ( (const SfxBoolItem
*) pItem
)->GetValue();
476 aSet
.Put( SfxBoolItem( EE_PARA_HYPHENATE
, bValue
) );
477 pView
->SetAttributes( aSet
);
483 case SID_RENAME_OBJECT
:
485 if(1L == pView
->GetMarkedObjectCount())
488 SdrObject
* pSelected
= pView
->GetMarkedObjectByIndex(0L);
489 OSL_ENSURE(pSelected
, "ScDrawShell::ExecDrawFunc: nMarkCount, but no object (!)");
491 if(SC_LAYER_INTERN
!= pSelected
->GetLayer())
493 OUString aName
= pSelected
->GetName();
495 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
496 OSL_ENSURE(pFact
, "Dialogdiet fail!");
497 AbstractSvxObjectNameDialog
* pDlg
= pFact
->CreateSvxObjectNameDialog(NULL
, aName
);
498 OSL_ENSURE(pDlg
, "Dialogdiet fail!");
500 pDlg
->SetCheckNameHdl(LINK(this, ScDrawShell
, NameObjectHdl
));
502 if(RET_OK
== pDlg
->Execute())
504 ScDocShell
* pDocSh
= pViewData
->GetDocShell();
505 pDlg
->GetName(aName
);
507 if (!aName
.equals(pSelected
->GetName()))
509 // handle name change
510 const sal_uInt16
nObjType(pSelected
->GetObjIdentifier());
512 if (OBJ_GRAF
== nObjType
&& aName
.isEmpty())
514 // graphics objects must have names
515 // (all graphics are supposed to be in the navigator)
516 ScDrawLayer
* pModel
= pViewData
->GetDocument()->GetDrawLayer();
520 aName
= pModel
->GetNewGraphicName();
524 // An undo action for renaming is missing in svdraw (99363).
525 // For OLE objects (which can be identified using the persist name),
526 // ScUndoRenameObject can be used until there is a common action for all objects.
527 if(OBJ_OLE2
== nObjType
)
529 const OUString aPersistName
= static_cast<SdrOle2Obj
*>(pSelected
)->GetPersistName();
531 if(!aPersistName
.isEmpty())
533 pDocSh
->GetUndoManager()->AddUndoAction(
534 new ScUndoRenameObject(pDocSh
, aPersistName
, pSelected
->GetName(), aName
));
539 pSelected
->SetName(aName
);
542 // ChartListenerCollectionNeedsUpdate is needed for Navigator update
543 pDocSh
->GetDocument()->SetChartListenerCollectionNeedsUpdate( sal_True
);
544 pDocSh
->SetDrawModified();
554 case SID_TITLE_DESCRIPTION_OBJECT
:
556 if(1L == pView
->GetMarkedObjectCount())
558 SdrObject
* pSelected
= pView
->GetMarkedObjectByIndex(0L);
559 OSL_ENSURE(pSelected
, "ScDrawShell::ExecDrawFunc: nMarkCount, but no object (!)");
561 if(SC_LAYER_INTERN
!= pSelected
->GetLayer())
563 OUString
aTitle(pSelected
->GetTitle());
564 OUString
aDescription(pSelected
->GetDescription());
566 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
567 OSL_ENSURE(pFact
, "Dialogdiet fail!");
568 AbstractSvxObjectTitleDescDialog
* pDlg
= pFact
->CreateSvxObjectTitleDescDialog(NULL
, aTitle
, aDescription
);
569 OSL_ENSURE(pDlg
, "Dialogdiet fail!");
571 if(RET_OK
== pDlg
->Execute())
573 ScDocShell
* pDocSh
= pViewData
->GetDocShell();
575 // handle Title and Description
576 pDlg
->GetTitle(aTitle
);
577 pDlg
->GetDescription(aDescription
);
578 pSelected
->SetTitle(aTitle
);
579 pSelected
->SetDescription(aDescription
);
581 // ChartListenerCollectionNeedsUpdate is needed for Navigator update
582 pDocSh
->GetDocument()->SetChartListenerCollectionNeedsUpdate( sal_True
);
583 pDocSh
->SetDrawModified();
592 case SID_EXTRUSION_TOOGLE
:
593 case SID_EXTRUSION_TILT_DOWN
:
594 case SID_EXTRUSION_TILT_UP
:
595 case SID_EXTRUSION_TILT_LEFT
:
596 case SID_EXTRUSION_TILT_RIGHT
:
597 case SID_EXTRUSION_3D_COLOR
:
598 case SID_EXTRUSION_DEPTH
:
599 case SID_EXTRUSION_DIRECTION
:
600 case SID_EXTRUSION_PROJECTION
:
601 case SID_EXTRUSION_LIGHTING_DIRECTION
:
602 case SID_EXTRUSION_LIGHTING_INTENSITY
:
603 case SID_EXTRUSION_SURFACE
:
604 case SID_EXTRUSION_DEPTH_FLOATER
:
605 case SID_EXTRUSION_DIRECTION_FLOATER
:
606 case SID_EXTRUSION_LIGHTING_FLOATER
:
607 case SID_EXTRUSION_SURFACE_FLOATER
:
608 case SID_EXTRUSION_DEPTH_DIALOG
:
609 svx::ExtrusionBar::execute( pView
, rReq
, rBindings
);
613 case SID_FONTWORK_SHAPE
:
614 case SID_FONTWORK_SHAPE_TYPE
:
615 case SID_FONTWORK_ALIGNMENT
:
616 case SID_FONTWORK_SAME_LETTER_HEIGHTS
:
617 case SID_FONTWORK_CHARACTER_SPACING
:
618 case SID_FONTWORK_KERN_CHARACTER_PAIRS
:
619 case SID_FONTWORK_CHARACTER_SPACING_FLOATER
:
620 case SID_FONTWORK_ALIGNMENT_FLOATER
:
621 case SID_FONTWORK_CHARACTER_SPACING_DIALOG
:
622 svx::FontworkBar::execute( pView
, rReq
, rBindings
);
631 IMPL_LINK( ScDrawShell
, NameObjectHdl
, AbstractSvxNameDialog
*, pDialog
)
636 pDialog
->GetName( aName
);
638 ScDrawLayer
* pModel
= pViewData
->GetDocument()->GetDrawLayer();
639 if ( !aName
.isEmpty() && pModel
)
642 if ( pModel
->GetNamedObject( aName
, 0, nDummyTab
) )
644 // existing object found -> name invalid
649 return 1; // name is valid
652 //------------------------------------------------------------------
654 void ScDrawShell::ExecFormText(SfxRequest
& rReq
)
656 ScDrawView
* pDrView
= pViewData
->GetScDrawView();
657 const SdrMarkList
& rMarkList
= pDrView
->GetMarkedObjectList();
659 if ( rMarkList
.GetMarkCount() == 1 && rReq
.GetArgs() )
661 const SfxItemSet
& rSet
= *rReq
.GetArgs();
663 if ( pDrView
->IsTextEdit() )
664 pDrView
->ScEndTextEdit();
666 pDrView
->SetAttributes(rSet
);
670 //------------------------------------------------------------------
672 void ScDrawShell::ExecFormatPaintbrush( SfxRequest
& rReq
)
674 ScViewFunc
* pView
= pViewData
->GetView();
675 if ( pView
->HasPaintBrush() )
677 // cancel paintbrush mode
678 pView
->ResetBrushDocument();
682 sal_Bool bLock
= false;
683 const SfxItemSet
*pArgs
= rReq
.GetArgs();
684 if( pArgs
&& pArgs
->Count() >= 1 )
685 bLock
= static_cast<const SfxBoolItem
&>(pArgs
->Get(SID_FORMATPAINTBRUSH
)).GetValue();
687 ScDrawView
* pDrawView
= pViewData
->GetScDrawView();
688 if ( pDrawView
&& pDrawView
->AreObjectsMarked() )
690 sal_Bool bOnlyHardAttr
= sal_True
;
691 SfxItemSet
* pItemSet
= new SfxItemSet( pDrawView
->GetAttrFromMarked(bOnlyHardAttr
) );
692 pView
->SetDrawBrushSet( pItemSet
, bLock
);
697 void ScDrawShell::StateFormatPaintbrush( SfxItemSet
& rSet
)
699 ScDrawView
* pDrawView
= pViewData
->GetScDrawView();
700 sal_Bool bSelection
= pDrawView
&& pDrawView
->AreObjectsMarked();
701 sal_Bool bHasPaintBrush
= pViewData
->GetView()->HasPaintBrush();
703 if ( !bHasPaintBrush
&& !bSelection
)
704 rSet
.DisableItem( SID_FORMATPAINTBRUSH
);
706 rSet
.Put( SfxBoolItem( SID_FORMATPAINTBRUSH
, bHasPaintBrush
) );
709 ScDrawView
* ScDrawShell::GetDrawView()
711 return pViewData
->GetView()->GetScDrawView();
717 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */