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/hlnkitem.hxx>
29 #include <svx/svdoole2.hxx>
30 #include <svx/svdouno.hxx>
31 #include <svx/extrusionbar.hxx>
32 #include <svx/fontworkbar.hxx>
33 #include <sfx2/docfile.hxx>
35 #include <com/sun/star/form/FormButtonType.hpp>
36 #include <com/sun/star/beans/XPropertySet.hpp>
37 #include <com/sun/star/beans/XPropertySetInfo.hpp>
40 #include <drawview.hxx>
41 #include <viewdata.hxx>
42 #include <tabvwsh.hxx>
44 #include <undotab.hxx>
45 #include <drwlayer.hxx>
46 #include <userdat.hxx>
47 #include <drtxtob.hxx>
52 using namespace com::sun::star
;
54 void ScDrawShell::GetHLinkState( SfxItemSet
& rSet
) // Hyperlink
56 ScDrawView
* pView
= pViewData
->GetScDrawView();
57 const SdrMarkList
& rMarkList
= pView
->GetMarkedObjectList();
61 SvxHyperlinkItem aHLinkItem
;
63 if ( rMarkList
.GetMarkCount() == 1 ) // URL-Button marked ?
65 SdrObject
* pObj
= rMarkList
.GetMark(0)->GetMarkedSdrObj();
66 ScMacroInfo
* pInfo
= ScDrawLayer::GetMacroInfo( pObj
);
67 if ( pInfo
&& !pInfo
->GetHlink().isEmpty() )
69 aHLinkItem
.SetURL( pInfo
->GetHlink() );
70 aHLinkItem
.SetInsertMode(HLINK_FIELD
);
72 SdrUnoObj
* pUnoCtrl
= dynamic_cast<SdrUnoObj
*>( pObj
);
73 if (pUnoCtrl
&& SdrInventor::FmForm
== pUnoCtrl
->GetObjInventor())
75 const uno::Reference
<awt::XControlModel
>& xControlModel
= pUnoCtrl
->GetUnoControlModel();
76 OSL_ENSURE( xControlModel
.is(), "UNO-Control without model" );
77 if( !xControlModel
.is() )
80 uno::Reference
< beans::XPropertySet
> xPropSet( xControlModel
, uno::UNO_QUERY
);
81 uno::Reference
< beans::XPropertySetInfo
> xInfo
= xPropSet
->getPropertySetInfo();
83 OUString
sPropButtonType( "ButtonType" );
84 OUString
sPropTargetURL( "TargetURL" );
85 OUString
sPropTargetFrame( "TargetFrame" );
86 OUString
sPropLabel( "Label" );
88 if(xInfo
->hasPropertyByName( sPropButtonType
))
90 uno::Any aAny
= xPropSet
->getPropertyValue( sPropButtonType
);
91 form::FormButtonType eTmp
;
92 if ( (aAny
>>= eTmp
) && eTmp
== form::FormButtonType_URL
)
96 if(xInfo
->hasPropertyByName( sPropLabel
))
98 aAny
= xPropSet
->getPropertyValue( sPropLabel
);
99 if ( (aAny
>>= sTmp
) && !sTmp
.isEmpty() )
101 aHLinkItem
.SetName(sTmp
);
105 if(xInfo
->hasPropertyByName( sPropTargetURL
))
107 aAny
= xPropSet
->getPropertyValue( sPropTargetURL
);
108 if ( (aAny
>>= sTmp
) && !sTmp
.isEmpty() )
110 aHLinkItem
.SetURL(sTmp
);
114 if(xInfo
->hasPropertyByName( sPropTargetFrame
))
116 aAny
= xPropSet
->getPropertyValue( sPropTargetFrame
);
117 if ( (aAny
>>= sTmp
) && !sTmp
.isEmpty() )
119 aHLinkItem
.SetTargetFrame(sTmp
);
122 aHLinkItem
.SetInsertMode(HLINK_BUTTON
);
128 rSet
.Put(aHLinkItem
);
131 void ScDrawShell::ExecuteHLink( const SfxRequest
& rReq
)
133 const SfxItemSet
* pReqArgs
= rReq
.GetArgs();
135 sal_uInt16 nSlot
= rReq
.GetSlot();
138 case SID_HYPERLINK_SETLINK
:
141 const SfxPoolItem
* pItem
;
142 if ( pReqArgs
->GetItemState( SID_HYPERLINK_SETLINK
, true, &pItem
) == SfxItemState::SET
)
144 const SvxHyperlinkItem
* pHyper
= static_cast<const SvxHyperlinkItem
*>(pItem
);
145 const OUString
& rName
= pHyper
->GetName();
146 const OUString
& rURL
= pHyper
->GetURL();
147 const OUString
& rTarget
= pHyper
->GetTargetFrame();
148 SvxLinkInsertMode eMode
= pHyper
->GetInsertMode();
151 if ( eMode
== HLINK_FIELD
|| eMode
== HLINK_BUTTON
)
153 ScDrawView
* pView
= pViewData
->GetScDrawView();
154 const SdrMarkList
& rMarkList
= pView
->GetMarkedObjectList();
155 if ( rMarkList
.GetMarkCount() == 1 )
157 SdrObject
* pObj
= rMarkList
.GetMark(0)->GetMarkedSdrObj();
158 SdrUnoObj
* pUnoCtrl
= dynamic_cast<SdrUnoObj
*>( pObj
);
159 if (pUnoCtrl
&& SdrInventor::FmForm
== pUnoCtrl
->GetObjInventor())
161 const uno::Reference
<awt::XControlModel
>& xControlModel
=
162 pUnoCtrl
->GetUnoControlModel();
163 OSL_ENSURE( xControlModel
.is(), "UNO-Control without model" );
164 if( !xControlModel
.is() )
167 uno::Reference
< beans::XPropertySet
> xPropSet( xControlModel
, uno::UNO_QUERY
);
168 uno::Reference
< beans::XPropertySetInfo
> xInfo
= xPropSet
->getPropertySetInfo();
170 OUString
sPropTargetURL( "TargetURL" );
172 // Is it possible to set a URL in the object?
173 if (xInfo
->hasPropertyByName( sPropTargetURL
))
176 OUString
sPropButtonType( "ButtonType");
177 OUString
sPropTargetFrame( "TargetFrame" );
178 OUString
sPropLabel( "Label" );
180 if ( xInfo
->hasPropertyByName( sPropLabel
) )
182 xPropSet
->setPropertyValue( sPropLabel
, uno::Any(rName
) );
185 OUString aTmp
= INetURLObject::GetAbsURL( pViewData
->GetDocShell()->GetMedium()->GetBaseURL(), rURL
);
186 xPropSet
->setPropertyValue( sPropTargetURL
, uno::Any(aTmp
) );
188 if( !rTarget
.isEmpty() && xInfo
->hasPropertyByName( sPropTargetFrame
) )
190 xPropSet
->setPropertyValue( sPropTargetFrame
, uno::Any(rTarget
) );
193 if ( xInfo
->hasPropertyByName( sPropButtonType
) )
195 xPropSet
->setPropertyValue( sPropButtonType
, uno::Any(form::FormButtonType_URL
) );
199 pViewData
->GetDocShell()->SetDocumentModified();
205 SetHlinkForObject( pObj
, rURL
);
212 pViewData
->GetViewShell()->
213 InsertURL( rName
, rURL
, rTarget
, static_cast<sal_uInt16
>(eMode
) );
215 // If "text" is received by InsertURL of ViewShell, then the DrawShell is turned off !!!
220 OSL_FAIL("wrong slot");
224 // Functions on Drawing-Objects
226 void ScDrawShell::ExecDrawFunc( SfxRequest
& rReq
)
228 SfxBindings
& rBindings
= pViewData
->GetBindings();
229 ScTabView
* pTabView
= pViewData
->GetView();
230 ScDrawView
* pView
= pTabView
->GetScDrawView();
231 sal_uInt16 nSlotId
= rReq
.GetSlot();
235 case SID_OBJECT_HEAVEN
:
236 pView
->SetMarkedToLayer( SC_LAYER_FRONT
);
237 rBindings
.Invalidate(SID_OBJECT_HEAVEN
);
238 rBindings
.Invalidate(SID_OBJECT_HELL
);
240 case SID_OBJECT_HELL
:
241 pView
->SetMarkedToLayer( SC_LAYER_BACK
);
242 rBindings
.Invalidate(SID_OBJECT_HEAVEN
);
243 rBindings
.Invalidate(SID_OBJECT_HELL
);
244 // leave draw shell if nothing selected (layer may be locked)
245 pViewData
->GetViewShell()->UpdateDrawShell();
248 case SID_FRAME_TO_TOP
:
249 pView
->PutMarkedToTop();
251 case SID_FRAME_TO_BOTTOM
:
252 pView
->PutMarkedToBtm();
255 pView
->MovMarkedToTop();
258 pView
->MovMarkedToBtm();
262 pView
->GroupMarked();
265 pView
->UnGroupMarked();
267 case SID_ENTER_GROUP
:
268 pView
->EnterMarkedGroup();
270 case SID_LEAVE_GROUP
:
271 pView
->LeaveOneGroup();
274 case SID_MIRROR_HORIZONTAL
:
275 case SID_FLIP_HORIZONTAL
:
276 pView
->MirrorAllMarkedHorizontal();
277 rBindings
.Invalidate( SID_ATTR_TRANSFORM_ANGLE
);
279 case SID_MIRROR_VERTICAL
:
280 case SID_FLIP_VERTICAL
:
281 pView
->MirrorAllMarkedVertical();
282 rBindings
.Invalidate( SID_ATTR_TRANSFORM_ANGLE
);
285 case SID_OBJECT_ALIGN_LEFT
:
286 case SID_ALIGN_ANY_LEFT
:
287 if (pView
->IsAlignPossible())
288 pView
->AlignMarkedObjects(SdrHorAlign::Left
, SdrVertAlign::NONE
);
290 case SID_OBJECT_ALIGN_CENTER
:
291 case SID_ALIGN_ANY_HCENTER
:
292 if (pView
->IsAlignPossible())
293 pView
->AlignMarkedObjects(SdrHorAlign::Center
, SdrVertAlign::NONE
);
295 case SID_OBJECT_ALIGN_RIGHT
:
296 case SID_ALIGN_ANY_RIGHT
:
297 if (pView
->IsAlignPossible())
298 pView
->AlignMarkedObjects(SdrHorAlign::Right
, SdrVertAlign::NONE
);
300 case SID_OBJECT_ALIGN_UP
:
301 case SID_ALIGN_ANY_TOP
:
302 if (pView
->IsAlignPossible())
303 pView
->AlignMarkedObjects(SdrHorAlign::NONE
, SdrVertAlign::Top
);
305 case SID_OBJECT_ALIGN_MIDDLE
:
306 case SID_ALIGN_ANY_VCENTER
:
307 if (pView
->IsAlignPossible())
308 pView
->AlignMarkedObjects(SdrHorAlign::NONE
, SdrVertAlign::Center
);
310 case SID_OBJECT_ALIGN_DOWN
:
311 case SID_ALIGN_ANY_BOTTOM
:
312 if (pView
->IsAlignPossible())
313 pView
->AlignMarkedObjects(SdrHorAlign::NONE
, SdrVertAlign::Bottom
);
317 case SID_DELETE_CONTENTS
:
318 pView
->DeleteMarked();
319 pViewData
->GetViewShell()->UpdateDrawShell();
324 pViewData
->GetViewShell()->UpdateDrawShell();
332 ScClipUtil::PasteFromClipboard ( GetViewData(), GetViewData()->GetViewShell(), true );
339 case SID_ANCHOR_PAGE
:
340 pView
->SetPageAnchored();
341 rBindings
.Invalidate( SID_ANCHOR_PAGE
);
342 rBindings
.Invalidate( SID_ANCHOR_CELL
);
343 rBindings
.Invalidate( SID_ANCHOR_CELL_RESIZE
);
346 case SID_ANCHOR_CELL
:
347 pView
->SetCellAnchored(false);
348 rBindings
.Invalidate( SID_ANCHOR_PAGE
);
349 rBindings
.Invalidate( SID_ANCHOR_CELL
);
350 rBindings
.Invalidate( SID_ANCHOR_CELL_RESIZE
);
353 case SID_ANCHOR_CELL_RESIZE
:
354 pView
->SetCellAnchored(true);
355 rBindings
.Invalidate( SID_ANCHOR_PAGE
);
356 rBindings
.Invalidate( SID_ANCHOR_CELL
);
357 rBindings
.Invalidate( SID_ANCHOR_CELL_RESIZE
);
360 case SID_ANCHOR_TOGGLE
:
362 switch( pView
->GetAnchorType() )
365 case SCA_CELL_RESIZE
:
366 pView
->SetPageAnchored();
369 pView
->SetCellAnchored(false);
373 rBindings
.Invalidate( SID_ANCHOR_PAGE
);
374 rBindings
.Invalidate( SID_ANCHOR_CELL
);
375 rBindings
.Invalidate( SID_ANCHOR_CELL_RESIZE
);
378 case SID_OBJECT_ROTATE
:
381 if (pView
->GetDragMode() == SdrDragMode::Rotate
)
382 eMode
= SdrDragMode::Move
;
384 eMode
= SdrDragMode::Rotate
;
385 pView
->SetDragMode( eMode
);
386 rBindings
.Invalidate( SID_OBJECT_ROTATE
);
387 rBindings
.Invalidate( SID_OBJECT_MIRROR
);
388 if (eMode
== SdrDragMode::Rotate
&& !pView
->IsFrameDragSingles())
390 pView
->SetFrameDragSingles();
391 rBindings
.Invalidate( SID_BEZIER_EDIT
);
395 case SID_OBJECT_MIRROR
:
398 if (pView
->GetDragMode() == SdrDragMode::Mirror
)
399 eMode
= SdrDragMode::Move
;
401 eMode
= SdrDragMode::Mirror
;
402 pView
->SetDragMode( eMode
);
403 rBindings
.Invalidate( SID_OBJECT_ROTATE
);
404 rBindings
.Invalidate( SID_OBJECT_MIRROR
);
405 if (eMode
== SdrDragMode::Mirror
&& !pView
->IsFrameDragSingles())
407 pView
->SetFrameDragSingles();
408 rBindings
.Invalidate( SID_BEZIER_EDIT
);
412 case SID_BEZIER_EDIT
:
414 bool bOld
= pView
->IsFrameDragSingles();
415 pView
->SetFrameDragSingles( !bOld
);
416 rBindings
.Invalidate( SID_BEZIER_EDIT
);
417 if (bOld
&& pView
->GetDragMode() != SdrDragMode::Move
)
419 pView
->SetDragMode( SdrDragMode::Move
);
420 rBindings
.Invalidate( SID_OBJECT_ROTATE
);
421 rBindings
.Invalidate( SID_OBJECT_MIRROR
);
428 sal_uInt16 nId
= ScGetFontWorkId();
429 SfxViewFrame
* pViewFrm
= pViewData
->GetViewShell()->GetViewFrame();
431 if ( rReq
.GetArgs() )
432 pViewFrm
->SetChildWindow( nId
,
433 static_cast<const SfxBoolItem
&>(
434 (rReq
.GetArgs()->Get(SID_FONTWORK
))).
437 pViewFrm
->ToggleChildWindow( nId
);
439 rBindings
.Invalidate( SID_FONTWORK
);
444 case SID_ORIGINALSIZE
:
445 pView
->SetMarkedOriginalSize();
448 case SID_FITCELLSIZE
:
449 pView
->FitToCellSize();
452 case SID_ENABLE_HYPHENATION
:
454 const SfxBoolItem
* pItem
= rReq
.GetArg
<SfxBoolItem
>(SID_ENABLE_HYPHENATION
);
457 SfxItemSet
aSet( GetPool(), svl::Items
<EE_PARA_HYPHENATE
, EE_PARA_HYPHENATE
>{} );
458 bool bValue
= pItem
->GetValue();
459 aSet
.Put( SfxBoolItem( EE_PARA_HYPHENATE
, bValue
) );
460 pView
->SetAttributes( aSet
);
466 case SID_RENAME_OBJECT
:
468 if(1 == pView
->GetMarkedObjectCount())
471 SdrObject
* pSelected
= pView
->GetMarkedObjectByIndex(0);
472 OSL_ENSURE(pSelected
, "ScDrawShell::ExecDrawFunc: nMarkCount, but no object (!)");
474 if(SC_LAYER_INTERN
!= pSelected
->GetLayer())
476 OUString aName
= pSelected
->GetName();
478 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
479 vcl::Window
* pWin
= pViewData
->GetActiveWin();
480 ScopedVclPtr
<AbstractSvxObjectNameDialog
> pDlg(pFact
->CreateSvxObjectNameDialog(pWin
? pWin
->GetFrameWeld() : nullptr, aName
));
482 pDlg
->SetCheckNameHdl(LINK(this, ScDrawShell
, NameObjectHdl
));
484 if(RET_OK
== pDlg
->Execute())
486 ScDocShell
* pDocSh
= pViewData
->GetDocShell();
487 pDlg
->GetName(aName
);
489 if (aName
!= pSelected
->GetName())
491 // handle name change
492 const sal_uInt16
nObjType(pSelected
->GetObjIdentifier());
494 if (OBJ_GRAF
== nObjType
&& aName
.isEmpty())
496 // graphics objects must have names
497 // (all graphics are supposed to be in the navigator)
498 ScDrawLayer
* pModel
= pViewData
->GetDocument()->GetDrawLayer();
502 aName
= pModel
->GetNewGraphicName();
506 // An undo action for renaming is missing in svdraw (99363).
507 // For OLE objects (which can be identified using the persist name),
508 // ScUndoRenameObject can be used until there is a common action for all objects.
509 if(OBJ_OLE2
== nObjType
)
511 const OUString aPersistName
= static_cast<SdrOle2Obj
*>(pSelected
)->GetPersistName();
513 if(!aPersistName
.isEmpty())
515 pDocSh
->GetUndoManager()->AddUndoAction(
516 std::make_unique
<ScUndoRenameObject
>(pDocSh
, aPersistName
, pSelected
->GetName(), aName
));
521 pSelected
->SetName(aName
);
524 // ChartListenerCollectionNeedsUpdate is needed for Navigator update
525 pDocSh
->GetDocument().SetChartListenerCollectionNeedsUpdate( true );
526 pDocSh
->SetDrawModified();
534 case SID_TITLE_DESCRIPTION_OBJECT
:
536 if(1 == pView
->GetMarkedObjectCount())
538 SdrObject
* pSelected
= pView
->GetMarkedObjectByIndex(0);
539 OSL_ENSURE(pSelected
, "ScDrawShell::ExecDrawFunc: nMarkCount, but no object (!)");
541 if(SC_LAYER_INTERN
!= pSelected
->GetLayer())
543 OUString
aTitle(pSelected
->GetTitle());
544 OUString
aDescription(pSelected
->GetDescription());
546 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
547 vcl::Window
* pWin
= pViewData
->GetActiveWin();
548 ScopedVclPtr
<AbstractSvxObjectTitleDescDialog
> pDlg(pFact
->CreateSvxObjectTitleDescDialog(
549 pWin
? pWin
->GetFrameWeld() : nullptr, aTitle
, aDescription
));
551 if(RET_OK
== pDlg
->Execute())
553 ScDocShell
* pDocSh
= pViewData
->GetDocShell();
555 // handle Title and Description
556 pDlg
->GetTitle(aTitle
);
557 pDlg
->GetDescription(aDescription
);
558 pSelected
->SetTitle(aTitle
);
559 pSelected
->SetDescription(aDescription
);
561 // ChartListenerCollectionNeedsUpdate is needed for Navigator update
562 pDocSh
->GetDocument().SetChartListenerCollectionNeedsUpdate( true );
563 pDocSh
->SetDrawModified();
570 case SID_EXTRUSION_TOGGLE
:
571 case SID_EXTRUSION_TILT_DOWN
:
572 case SID_EXTRUSION_TILT_UP
:
573 case SID_EXTRUSION_TILT_LEFT
:
574 case SID_EXTRUSION_TILT_RIGHT
:
575 case SID_EXTRUSION_3D_COLOR
:
576 case SID_EXTRUSION_DEPTH
:
577 case SID_EXTRUSION_DIRECTION
:
578 case SID_EXTRUSION_PROJECTION
:
579 case SID_EXTRUSION_LIGHTING_DIRECTION
:
580 case SID_EXTRUSION_LIGHTING_INTENSITY
:
581 case SID_EXTRUSION_SURFACE
:
582 case SID_EXTRUSION_DEPTH_FLOATER
:
583 case SID_EXTRUSION_DIRECTION_FLOATER
:
584 case SID_EXTRUSION_LIGHTING_FLOATER
:
585 case SID_EXTRUSION_SURFACE_FLOATER
:
586 case SID_EXTRUSION_DEPTH_DIALOG
:
587 svx::ExtrusionBar::execute( pView
, rReq
, rBindings
);
591 case SID_FONTWORK_SHAPE
:
592 case SID_FONTWORK_SHAPE_TYPE
:
593 case SID_FONTWORK_ALIGNMENT
:
594 case SID_FONTWORK_SAME_LETTER_HEIGHTS
:
595 case SID_FONTWORK_CHARACTER_SPACING
:
596 case SID_FONTWORK_KERN_CHARACTER_PAIRS
:
597 case SID_FONTWORK_CHARACTER_SPACING_FLOATER
:
598 case SID_FONTWORK_ALIGNMENT_FLOATER
:
599 case SID_FONTWORK_CHARACTER_SPACING_DIALOG
:
600 svx::FontworkBar::execute( *pView
, rReq
, rBindings
);
609 IMPL_LINK( ScDrawShell
, NameObjectHdl
, AbstractSvxObjectNameDialog
&, rDialog
, bool )
612 rDialog
.GetName( aName
);
614 ScDrawLayer
* pModel
= pViewData
->GetDocument()->GetDrawLayer();
615 if ( !aName
.isEmpty() && pModel
)
618 if ( pModel
->GetNamedObject( aName
, 0, nDummyTab
) )
620 // existing object found -> name invalid
625 return true; // name is valid
628 void ScDrawShell::ExecFormText(const SfxRequest
& rReq
)
630 ScDrawView
* pDrView
= pViewData
->GetScDrawView();
631 const SdrMarkList
& rMarkList
= pDrView
->GetMarkedObjectList();
633 if ( rMarkList
.GetMarkCount() == 1 && rReq
.GetArgs() )
635 const SfxItemSet
& rSet
= *rReq
.GetArgs();
637 if ( pDrView
->IsTextEdit() )
638 pDrView
->ScEndTextEdit();
640 pDrView
->SetAttributes(rSet
);
644 void ScDrawShell::ExecFormatPaintbrush( const SfxRequest
& rReq
)
646 ScViewFunc
* pView
= pViewData
->GetView();
647 if ( pView
->HasPaintBrush() )
649 // cancel paintbrush mode
650 pView
->ResetBrushDocument();
655 const SfxItemSet
*pArgs
= rReq
.GetArgs();
656 if( pArgs
&& pArgs
->Count() >= 1 )
657 bLock
= pArgs
->Get(SID_FORMATPAINTBRUSH
).GetValue();
659 ScDrawView
* pDrawView
= pViewData
->GetScDrawView();
660 if ( pDrawView
&& pDrawView
->AreObjectsMarked() )
662 std::unique_ptr
<SfxItemSet
> pItemSet(new SfxItemSet( pDrawView
->GetAttrFromMarked(true/*bOnlyHardAttr*/) ));
663 pView
->SetDrawBrushSet( std::move(pItemSet
), bLock
);
668 void ScDrawShell::StateFormatPaintbrush( SfxItemSet
& rSet
)
670 ScDrawView
* pDrawView
= pViewData
->GetScDrawView();
671 bool bSelection
= pDrawView
&& pDrawView
->AreObjectsMarked();
672 bool bHasPaintBrush
= pViewData
->GetView()->HasPaintBrush();
674 if ( !bHasPaintBrush
&& !bSelection
)
675 rSet
.DisableItem( SID_FORMATPAINTBRUSH
);
677 rSet
.Put( SfxBoolItem( SID_FORMATPAINTBRUSH
, bHasPaintBrush
) );
680 ScDrawView
* ScDrawShell::GetDrawView()
682 return pViewData
->GetView()->GetScDrawView();
685 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */