LibreOffice Module sc (master) 1
drawsh5.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <editeng/eeitem.hxx>
21
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 <svx/svdogrp.hxx>
34#include <sfx2/docfile.hxx>
35#include <osl/diagnose.h>
37
38#include <com/sun/star/form/FormButtonType.hpp>
39#include <com/sun/star/beans/XPropertySet.hpp>
40#include <com/sun/star/beans/XPropertySetInfo.hpp>
41
42#include <drawsh.hxx>
43#include <drawview.hxx>
44#include <viewdata.hxx>
45#include <tabvwsh.hxx>
46#include <docsh.hxx>
47#include <undotab.hxx>
48#include <drwlayer.hxx>
49#include <drtxtob.hxx>
50#include <memory>
51
52#include <sc.hrc>
53
54using namespace com::sun::star;
55
56void ScDrawShell::GetHLinkState( SfxItemSet& rSet ) // Hyperlink
57{
59 const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
60
61 // Hyperlink
62
63 SvxHyperlinkItem aHLinkItem;
64
65 if ( rMarkList.GetMarkCount() == 1 ) // URL-Button marked ?
66 {
67 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
68 if ( pObj && !pObj->getHyperlink().isEmpty() )
69 {
70 aHLinkItem.SetURL( pObj->getHyperlink() );
71 aHLinkItem.SetInsertMode(HLINK_FIELD);
72 }
73 SdrUnoObj* pUnoCtrl = dynamic_cast<SdrUnoObj*>( pObj );
74 if (pUnoCtrl && SdrInventor::FmForm == pUnoCtrl->GetObjInventor())
75 {
76 const uno::Reference<awt::XControlModel>& xControlModel = pUnoCtrl->GetUnoControlModel();
77 OSL_ENSURE( xControlModel.is(), "UNO-Control without model" );
78 if( !xControlModel.is() )
79 return;
80
81 uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY );
82 uno::Reference< beans::XPropertySetInfo > xInfo = xPropSet->getPropertySetInfo();
83
84 OUString sPropButtonType( "ButtonType" );
85
86 if(xInfo->hasPropertyByName( sPropButtonType ))
87 {
88 uno::Any aAny = xPropSet->getPropertyValue( sPropButtonType );
89 form::FormButtonType eTmp;
90 if ( (aAny >>= eTmp) && eTmp == form::FormButtonType_URL )
91 {
92 OUString sTmp;
93 // Label
94 OUString sPropLabel( "Label" );
95 if(xInfo->hasPropertyByName( sPropLabel ))
96 {
97 aAny = xPropSet->getPropertyValue( sPropLabel );
98 if ( (aAny >>= sTmp) && !sTmp.isEmpty() )
99 {
100 aHLinkItem.SetName(sTmp);
101 }
102 }
103 // URL
104 OUString sPropTargetURL( "TargetURL" );
105 if(xInfo->hasPropertyByName( sPropTargetURL ))
106 {
107 aAny = xPropSet->getPropertyValue( sPropTargetURL );
108 if ( (aAny >>= sTmp) && !sTmp.isEmpty() )
109 {
110 aHLinkItem.SetURL(sTmp);
111 }
112 }
113 // Target
114 OUString sPropTargetFrame( "TargetFrame" );
115 if(xInfo->hasPropertyByName( sPropTargetFrame ))
116 {
117 aAny = xPropSet->getPropertyValue( sPropTargetFrame );
118 if ( (aAny >>= sTmp) && !sTmp.isEmpty() )
119 {
120 aHLinkItem.SetTargetFrame(sTmp);
121 }
122 }
123 aHLinkItem.SetInsertMode(HLINK_BUTTON);
124 }
125 }
126 }
127 }
128
129 rSet.Put(aHLinkItem);
130}
131
133{
134 const SfxItemSet* pReqArgs = rReq.GetArgs();
135
136 sal_uInt16 nSlot = rReq.GetSlot();
137 switch ( nSlot )
138 {
139 case SID_HYPERLINK_SETLINK:
140 if( pReqArgs )
141 {
142 const SfxPoolItem* pItem;
143 if ( pReqArgs->GetItemState( SID_HYPERLINK_SETLINK, true, &pItem ) == SfxItemState::SET )
144 {
145 const SvxHyperlinkItem* pHyper = static_cast<const SvxHyperlinkItem*>(pItem);
146 const OUString& rName = pHyper->GetName();
147 const OUString& rURL = pHyper->GetURL();
148 const OUString& rTarget = pHyper->GetTargetFrame();
150
151 bool bDone = false;
152 if ( eMode == HLINK_FIELD || eMode == HLINK_BUTTON )
153 {
155 const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
156 if ( rMarkList.GetMarkCount() == 1 )
157 {
158 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
159 SdrUnoObj* pUnoCtrl = dynamic_cast<SdrUnoObj*>( pObj );
160 if (pUnoCtrl && SdrInventor::FmForm == pUnoCtrl->GetObjInventor())
161 {
162 const uno::Reference<awt::XControlModel>& xControlModel =
163 pUnoCtrl->GetUnoControlModel();
164 OSL_ENSURE( xControlModel.is(), "UNO-Control without model" );
165 if( !xControlModel.is() )
166 return;
167
168 uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY );
169 uno::Reference< beans::XPropertySetInfo > xInfo = xPropSet->getPropertySetInfo();
170
171 OUString sPropTargetURL( "TargetURL" );
172
173 // Is it possible to set a URL in the object?
174 if (xInfo->hasPropertyByName( sPropTargetURL ))
175 {
176
177 OUString sPropButtonType( "ButtonType");
178 OUString sPropTargetFrame( "TargetFrame" );
179 OUString sPropLabel( "Label" );
180
181 if ( xInfo->hasPropertyByName( sPropLabel ) )
182 {
183 xPropSet->setPropertyValue( sPropLabel, uno::Any(rName) );
184 }
185
186 OUString aTmp = INetURLObject::GetAbsURL( rViewData.GetDocShell()->GetMedium()->GetBaseURL(), rURL );
187 xPropSet->setPropertyValue( sPropTargetURL, uno::Any(aTmp) );
188
189 if( !rTarget.isEmpty() && xInfo->hasPropertyByName( sPropTargetFrame ) )
190 {
191 xPropSet->setPropertyValue( sPropTargetFrame, uno::Any(rTarget) );
192 }
193
194 if ( xInfo->hasPropertyByName( sPropButtonType ) )
195 {
196 xPropSet->setPropertyValue( sPropButtonType, uno::Any(form::FormButtonType_URL) );
197 }
198
201 bDone = true;
202 }
203 }
204 else
205 {
206 pObj->setHyperlink(rURL);
207 setModified();
208 bDone = true;
209 }
210 }
211 }
212
213 if (!bDone)
215 InsertURL( rName, rURL, rTarget, static_cast<sal_uInt16>(eMode) );
216
217 // If "text" is received by InsertURL of ViewShell, then the DrawShell is turned off !!!
218 }
219 }
220 break;
221 default:
222 OSL_FAIL("wrong slot");
223 }
224}
225
226// Functions on Drawing-Objects
227
229{
230 SfxBindings& rBindings = rViewData.GetBindings();
231 ScTabView* pTabView = rViewData.GetView();
232 ScDrawView* pView = pTabView->GetScDrawView();
233 sal_uInt16 nSlotId = rReq.GetSlot();
234
235 switch (nSlotId)
236 {
237 case SID_OBJECT_HEAVEN:
239 rBindings.Invalidate(SID_OBJECT_HEAVEN);
240 rBindings.Invalidate(SID_OBJECT_HELL);
241 break;
242 case SID_OBJECT_HELL:
244 rBindings.Invalidate(SID_OBJECT_HEAVEN);
245 rBindings.Invalidate(SID_OBJECT_HELL);
246 // leave draw shell if nothing selected (layer may be locked)
248 break;
249
250 case SID_FRAME_TO_TOP:
251 pView->PutMarkedToTop();
252 break;
253 case SID_FRAME_TO_BOTTOM:
254 pView->PutMarkedToBtm();
255 break;
256 case SID_FRAME_UP:
257 pView->MovMarkedToTop();
258 break;
259 case SID_FRAME_DOWN:
260 pView->MovMarkedToBtm();
261 break;
262
263 case SID_GROUP:
264 pView->GroupMarked();
265 break;
266 case SID_UNGROUP:
267 pView->UnGroupMarked();
268 break;
269 case SID_ENTER_GROUP:
270 pView->EnterMarkedGroup();
271 break;
272 case SID_LEAVE_GROUP:
273 pView->LeaveOneGroup();
274 break;
275
276 case SID_REGENERATE_DIAGRAM:
277 case SID_EDIT_DIAGRAM:
278 {
279 const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
280
281 if (1 == rMarkList.GetMarkCount())
282 {
283 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
284
285 // Support advanced DiagramHelper
286 if(nullptr != pObj && pObj->isDiagram())
287 {
288 if(SID_REGENERATE_DIAGRAM == nSlotId)
289 {
290 pView->UnmarkAll();
291 pObj->getDiagramHelper()->reLayout(*static_cast<SdrObjGroup*>(pObj));
292 pView->MarkObj(pObj, pView->GetSdrPageView());
293 }
294 else // SID_EDIT_DIAGRAM
295 {
299 pWin ? pWin->GetFrameWeld() : nullptr,
300 *static_cast<SdrObjGroup*>(pObj));
301 pDlg->Execute();
302 }
303 }
304 }
305
306 rReq.Done();
307 }
308 break;
309
310 case SID_MIRROR_HORIZONTAL:
311 case SID_FLIP_HORIZONTAL:
313 rBindings.Invalidate( SID_ATTR_TRANSFORM_ANGLE );
314 break;
315 case SID_MIRROR_VERTICAL:
316 case SID_FLIP_VERTICAL:
318 rBindings.Invalidate( SID_ATTR_TRANSFORM_ANGLE );
319 break;
320
321 case SID_OBJECT_ALIGN_LEFT:
322 case SID_ALIGN_ANY_LEFT:
323 if (pView->IsAlignPossible())
324 pView->AlignMarkedObjects(SdrHorAlign::Left, SdrVertAlign::NONE);
325 break;
326 case SID_OBJECT_ALIGN_CENTER:
327 case SID_ALIGN_ANY_HCENTER:
328 if (pView->IsAlignPossible())
329 pView->AlignMarkedObjects(SdrHorAlign::Center, SdrVertAlign::NONE);
330 break;
331 case SID_OBJECT_ALIGN_RIGHT:
332 case SID_ALIGN_ANY_RIGHT:
333 if (pView->IsAlignPossible())
334 pView->AlignMarkedObjects(SdrHorAlign::Right, SdrVertAlign::NONE);
335 break;
336 case SID_OBJECT_ALIGN_UP:
337 case SID_ALIGN_ANY_TOP:
338 if (pView->IsAlignPossible())
339 pView->AlignMarkedObjects(SdrHorAlign::NONE, SdrVertAlign::Top);
340 break;
341 case SID_OBJECT_ALIGN_MIDDLE:
342 case SID_ALIGN_ANY_VCENTER:
343 if (pView->IsAlignPossible())
344 pView->AlignMarkedObjects(SdrHorAlign::NONE, SdrVertAlign::Center);
345 break;
346 case SID_OBJECT_ALIGN_DOWN:
347 case SID_ALIGN_ANY_BOTTOM:
348 if (pView->IsAlignPossible())
349 pView->AlignMarkedObjects(SdrHorAlign::NONE, SdrVertAlign::Bottom);
350 break;
351
352 case SID_DELETE:
353 case SID_DELETE_CONTENTS:
354 pView->DeleteMarked();
356 break;
357
358 case SID_CUT:
359 pView->DoCut();
361 break;
362
363 case SID_COPY:
364 pView->DoCopy();
365 break;
366
367 case SID_PASTE:
369 break;
370
371 case SID_SELECTALL:
372 pView->MarkAll();
373 break;
374
375 case SID_ANCHOR_PAGE:
376 pView->SetPageAnchored();
377 rBindings.Invalidate( SID_ANCHOR_PAGE );
378 rBindings.Invalidate( SID_ANCHOR_CELL );
379 rBindings.Invalidate( SID_ANCHOR_CELL_RESIZE );
380 break;
381
382 case SID_ANCHOR_CELL:
383 pView->SetCellAnchored(false);
384 rBindings.Invalidate( SID_ANCHOR_PAGE );
385 rBindings.Invalidate( SID_ANCHOR_CELL );
386 rBindings.Invalidate( SID_ANCHOR_CELL_RESIZE );
387 break;
388
389 case SID_ANCHOR_CELL_RESIZE:
390 pView->SetCellAnchored(true);
391 rBindings.Invalidate( SID_ANCHOR_PAGE );
392 rBindings.Invalidate( SID_ANCHOR_CELL );
393 rBindings.Invalidate( SID_ANCHOR_CELL_RESIZE );
394 break;
395
396 case SID_ANCHOR_TOGGLE:
397 {
398 switch( pView->GetAnchorType() )
399 {
400 case SCA_CELL:
401 case SCA_CELL_RESIZE:
402 pView->SetPageAnchored();
403 break;
404 default:
405 pView->SetCellAnchored(false);
406 break;
407 }
408 }
409 rBindings.Invalidate( SID_ANCHOR_PAGE );
410 rBindings.Invalidate( SID_ANCHOR_CELL );
411 rBindings.Invalidate( SID_ANCHOR_CELL_RESIZE );
412 break;
413
414 case SID_OBJECT_ROTATE:
415 {
417 if (pView->GetDragMode() == SdrDragMode::Rotate)
418 eMode = SdrDragMode::Move;
419 else
420 eMode = SdrDragMode::Rotate;
421 pView->SetDragMode( eMode );
422 rBindings.Invalidate( SID_OBJECT_ROTATE );
423 rBindings.Invalidate( SID_OBJECT_MIRROR );
424 if (eMode == SdrDragMode::Rotate && !pView->IsFrameDragSingles())
425 {
426 pView->SetFrameDragSingles();
427 rBindings.Invalidate( SID_BEZIER_EDIT );
428 }
429 }
430 break;
431 case SID_OBJECT_MIRROR:
432 {
434 if (pView->GetDragMode() == SdrDragMode::Mirror)
435 eMode = SdrDragMode::Move;
436 else
437 eMode = SdrDragMode::Mirror;
438 pView->SetDragMode( eMode );
439 rBindings.Invalidate( SID_OBJECT_ROTATE );
440 rBindings.Invalidate( SID_OBJECT_MIRROR );
441 if (eMode == SdrDragMode::Mirror && !pView->IsFrameDragSingles())
442 {
443 pView->SetFrameDragSingles();
444 rBindings.Invalidate( SID_BEZIER_EDIT );
445 }
446 }
447 break;
448 case SID_BEZIER_EDIT:
449 {
450 bool bOld = pView->IsFrameDragSingles();
451 pView->SetFrameDragSingles( !bOld );
452 rBindings.Invalidate( SID_BEZIER_EDIT );
453 if (bOld && pView->GetDragMode() != SdrDragMode::Move)
454 {
455 pView->SetDragMode( SdrDragMode::Move );
456 rBindings.Invalidate( SID_OBJECT_ROTATE );
457 rBindings.Invalidate( SID_OBJECT_MIRROR );
458 }
459 }
460 break;
461
462 case SID_FONTWORK:
463 {
464 sal_uInt16 nId = ScGetFontWorkId();
466
467 if ( rReq.GetArgs() )
468 rViewFrm.SetChildWindow( nId,
469 static_cast<const SfxBoolItem&>(
470 (rReq.GetArgs()->Get(SID_FONTWORK))).
471 GetValue() );
472 else
473 rViewFrm.ToggleChildWindow( nId );
474
475 rBindings.Invalidate( SID_FONTWORK );
476 rReq.Done();
477 }
478 break;
479
480 case SID_ORIGINALSIZE:
481 pView->SetMarkedOriginalSize();
482 break;
483
484 case SID_FITCELLSIZE:
485 pView->FitToCellSize();
486 break;
487
488 case SID_ENABLE_HYPHENATION:
489 {
490 const SfxBoolItem* pItem = rReq.GetArg<SfxBoolItem>(SID_ENABLE_HYPHENATION);
491 if( pItem )
492 {
494 bool bValue = pItem->GetValue();
495 aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE, bValue ) );
496 pView->SetAttributes( aSet );
497 }
498 rReq.Done();
499 }
500 break;
501
502 case SID_RENAME_OBJECT:
503 {
504 if(1 == pView->GetMarkedObjectCount())
505 {
506 // #i68101#
507 SdrObject* pSelected = pView->GetMarkedObjectByIndex(0);
508 OSL_ENSURE(pSelected, "ScDrawShell::ExecDrawFunc: nMarkCount, but no object (!)");
509
510 if(SC_LAYER_INTERN != pSelected->GetLayer())
511 {
512 OUString aName = pSelected->GetName();
513
517
518 pDlg->SetCheckNameHdl(LINK(this, ScDrawShell, NameObjectHdl));
519
520 if(RET_OK == pDlg->Execute())
521 {
522 ScDocShell* pDocSh = rViewData.GetDocShell();
523 pDlg->GetName(aName);
524
525 if (aName != pSelected->GetName())
526 {
527 // handle name change
528 const SdrObjKind nObjType(pSelected->GetObjIdentifier());
529
530 if (SdrObjKind::Graphic == nObjType && aName.isEmpty())
531 {
532 // graphics objects must have names
533 // (all graphics are supposed to be in the navigator)
535
536 if(pModel)
537 {
538 aName = pModel->GetNewGraphicName();
539 }
540 }
541
542 // An undo action for renaming is missing in svdraw (99363).
543 // For OLE objects (which can be identified using the persist name),
544 // ScUndoRenameObject can be used until there is a common action for all objects.
545 if(SdrObjKind::OLE2 == nObjType)
546 {
547 const OUString aPersistName = static_cast<SdrOle2Obj*>(pSelected)->GetPersistName();
548
549 if(!aPersistName.isEmpty())
550 {
551 pDocSh->GetUndoManager()->AddUndoAction(
552 std::make_unique<ScUndoRenameObject>(pDocSh, aPersistName, pSelected->GetName(), aName));
553 }
554 }
555
556 // set new name
557 pSelected->SetName(aName);
558 }
559
560 // ChartListenerCollectionNeedsUpdate is needed for Navigator update
562 pDocSh->SetDrawModified();
563 }
564 }
565 }
566 break;
567 }
568
569 // #i68101#
570 case SID_TITLE_DESCRIPTION_OBJECT:
571 {
572 if(1 == pView->GetMarkedObjectCount())
573 {
574 SdrObject* pSelected = pView->GetMarkedObjectByIndex(0);
575 OSL_ENSURE(pSelected, "ScDrawShell::ExecDrawFunc: nMarkCount, but no object (!)");
576
577 if(SC_LAYER_INTERN != pSelected->GetLayer())
578 {
579 OUString aTitle(pSelected->GetTitle());
580 OUString aDescription(pSelected->GetDescription());
581 bool isDecorative(pSelected->IsDecorative());
582
586 pWin ? pWin->GetFrameWeld() : nullptr, aTitle, aDescription, isDecorative));
587
588 if(RET_OK == pDlg->Execute())
589 {
590 ScDocShell* pDocSh = rViewData.GetDocShell();
591
592 // handle Title and Description
593 pDlg->GetTitle(aTitle);
594 pDlg->GetDescription(aDescription);
595 pDlg->IsDecorative(isDecorative);
596 pSelected->SetTitle(aTitle);
597 pSelected->SetDescription(aDescription);
598 pSelected->SetDecorative(isDecorative);
599
600 // ChartListenerCollectionNeedsUpdate is needed for Navigator update
602 pDocSh->SetDrawModified();
603 }
604 }
605 }
606 break;
607 }
608
609 case SID_EXTRUSION_TOGGLE:
610 case SID_EXTRUSION_TILT_DOWN:
611 case SID_EXTRUSION_TILT_UP:
612 case SID_EXTRUSION_TILT_LEFT:
613 case SID_EXTRUSION_TILT_RIGHT:
614 case SID_EXTRUSION_3D_COLOR:
615 case SID_EXTRUSION_DEPTH:
616 case SID_EXTRUSION_DIRECTION:
617 case SID_EXTRUSION_PROJECTION:
618 case SID_EXTRUSION_LIGHTING_DIRECTION:
619 case SID_EXTRUSION_LIGHTING_INTENSITY:
620 case SID_EXTRUSION_SURFACE:
621 case SID_EXTRUSION_DEPTH_FLOATER:
622 case SID_EXTRUSION_DIRECTION_FLOATER:
623 case SID_EXTRUSION_LIGHTING_FLOATER:
624 case SID_EXTRUSION_SURFACE_FLOATER:
625 case SID_EXTRUSION_DEPTH_DIALOG:
626 svx::ExtrusionBar::execute( pView, rReq, rBindings );
627 rReq.Ignore ();
628 break;
629
630 case SID_FONTWORK_SHAPE:
631 case SID_FONTWORK_SHAPE_TYPE:
632 case SID_FONTWORK_ALIGNMENT:
633 case SID_FONTWORK_SAME_LETTER_HEIGHTS:
634 case SID_FONTWORK_CHARACTER_SPACING:
635 case SID_FONTWORK_KERN_CHARACTER_PAIRS:
636 case SID_FONTWORK_CHARACTER_SPACING_FLOATER:
637 case SID_FONTWORK_ALIGNMENT_FLOATER:
638 case SID_FONTWORK_CHARACTER_SPACING_DIALOG:
639 svx::FontworkBar::execute( *pView, rReq, rBindings );
640 rReq.Ignore ();
641 break;
642
643 default:
644 break;
645 }
646}
647
648IMPL_LINK( ScDrawShell, NameObjectHdl, AbstractSvxObjectNameDialog&, rDialog, bool )
649{
650 OUString aName;
651 rDialog.GetName( aName );
652
653 ScDrawLayer* pModel = rViewData.GetDocument().GetDrawLayer();
654 if ( !aName.isEmpty() && pModel )
655 {
656 SCTAB nDummyTab;
657 if ( pModel->GetNamedObject( aName, SdrObjKind::NONE, nDummyTab ) )
658 {
659 // existing object found -> name invalid
660 return false;
661 }
662 }
663
664 return true; // name is valid
665}
666
668{
670 const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
671
672 if ( rMarkList.GetMarkCount() == 1 && rReq.GetArgs() )
673 {
674 const SfxItemSet& rSet = *rReq.GetArgs();
675
676 if ( pDrView->IsTextEdit() )
677 pDrView->ScEndTextEdit();
678
679 pDrView->SetAttributes(rSet);
680 }
681}
682
684{
685 ScViewFunc* pView = rViewData.GetView();
686 if ( pView->HasPaintBrush() )
687 {
688 // cancel paintbrush mode
689 pView->ResetBrushDocument();
690 }
691 else
692 {
693 bool bLock = false;
694 const SfxItemSet *pArgs = rReq.GetArgs();
695 if( pArgs && pArgs->Count() >= 1 )
696 bLock = pArgs->Get(SID_FORMATPAINTBRUSH).GetValue();
697
698 ScDrawView* pDrawView = rViewData.GetScDrawView();
699 if ( pDrawView && pDrawView->AreObjectsMarked() )
700 {
701 std::unique_ptr<SfxItemSet> pItemSet(new SfxItemSet( pDrawView->GetAttrFromMarked(true/*bOnlyHardAttr*/) ));
702 pView->SetDrawBrushSet( std::move(pItemSet), bLock );
703 }
704 }
705}
706
708{
709 ScDrawView* pDrawView = rViewData.GetScDrawView();
710 bool bSelection = pDrawView && pDrawView->AreObjectsMarked();
711 bool bHasPaintBrush = rViewData.GetView()->HasPaintBrush();
712
713 if ( !bHasPaintBrush && !bSelection )
714 rSet.DisableItem( SID_FORMATPAINTBRUSH );
715 else
716 rSet.Put( SfxBoolItem( SID_FORMATPAINTBRUSH, bHasPaintBrush ) );
717}
718
720{
721 return rViewData.GetView()->GetScDrawView();
722}
723
724/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static OUString GetAbsURL(std::u16string_view rTheBaseURIRef, OUString const &rTheRelURIRef, EncodeMechanism eEncodeMechanism=EncodeMechanism::WasEncoded, DecodeMechanism eDecodeMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
void SetDocumentModified()
Definition: docsh.cxx:2982
const ScDocument & GetDocument() const
Definition: docsh.hxx:219
void SetDrawModified()
SetDrawModified - without Formula update.
Definition: docsh.cxx:3046
virtual SfxUndoManager * GetUndoManager() override
Definition: docsh.cxx:2968
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
Definition: document.hxx:1084
void SetChartListenerCollectionNeedsUpdate(bool bFlg)
Definition: document.hxx:2240
ScDocument * GetDocument() const
Definition: drwlayer.hxx:131
OUString GetNewGraphicName(tools::Long *pnCounter=nullptr) const
Definition: drwlayer.cxx:2478
SdrObject * GetNamedObject(std::u16string_view rName, SdrObjKind nId, SCTAB &rFoundTab) const
Definition: drwlayer.cxx:2450
void StateFormatPaintbrush(SfxItemSet &rSet)
Definition: drawsh5.cxx:707
ScDrawView * GetDrawView()
Definition: drawsh5.cxx:719
ScViewData & GetViewData()
Definition: drawsh.hxx:48
void GetHLinkState(SfxItemSet &rSet)
Definition: drawsh5.cxx:56
void ExecFormText(const SfxRequest &rReq)
Definition: drawsh5.cxx:667
void ExecuteHLink(const SfxRequest &rReq)
Definition: drawsh5.cxx:132
ScViewData & rViewData
Definition: drawsh.hxx:41
void ExecDrawFunc(SfxRequest &rReq)
Definition: drawsh5.cxx:228
void setModified()
Definition: drawsh.cxx:117
void ExecFormatPaintbrush(const SfxRequest &rReq)
Definition: drawsh5.cxx:683
void SetCellAnchored(bool bResizeWithCell)
Definition: drawvie3.cxx:90
SdrEndTextEditKind ScEndTextEdit()
Definition: drawview.cxx:887
virtual void DeleteMarked() override
Definition: drawview.cxx:849
void SetMarkedToLayer(SdrLayerID nLayerNo)
Definition: drawview.cxx:212
void DoCopy()
Definition: drawvie4.cxx:333
void SetPageAnchored()
Definition: drawvie3.cxx:65
void SetMarkedOriginalSize()
Definition: drawvie4.cxx:432
ScAnchorType GetAnchorType() const
Definition: drawvie3.cxx:116
void DoCut()
Definition: drawview.cxx:284
void FitToCellSize()
Definition: drawvie4.cxx:515
void UpdateDrawShell()
Definition: tabvwsh4.cxx:571
void ResetBrushDocument()
Definition: tabview5.cxx:651
ScDrawView * GetScDrawView()
Definition: tabview.hxx:352
void SetDrawBrushSet(std::unique_ptr< SfxItemSet > pNew, bool bLock)
Definition: tabview5.cxx:641
bool HasPaintBrush() const
Definition: tabview.hxx:598
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
ScDocShell * GetDocShell() const
Definition: viewdata.hxx:354
ScGridWindow * GetActiveWin()
Definition: viewdata.cxx:3162
ScTabViewShell * GetViewShell() const
Definition: viewdata.hxx:357
ScDBFunc * GetView() const
Definition: viewdata.cxx:864
SfxBindings & GetBindings()
Definition: viewdata.cxx:3134
ScDrawView * GetScDrawView()
Definition: viewdata.cxx:3174
SfxItemSet GetAttrFromMarked(bool bOnlyHardAttr) const
void PutMarkedToTop()
void UnGroupMarked()
void MirrorAllMarkedVertical()
void MovMarkedToTop()
void GroupMarked()
void MirrorAllMarkedHorizontal()
void MovMarkedToBtm()
void AlignMarkedObjects(SdrHorAlign eHor, SdrVertAlign eVert)
bool IsAlignPossible() const
void PutMarkedToBtm()
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
void SetFrameDragSingles(bool bOn=true)
void SetDragMode(SdrDragMode eMode)
bool IsFrameDragSingles() const
const SdrMarkList & GetMarkedObjectList() const
bool AreObjectsMarked() const
SdrObject * GetMarkedObjectByIndex(size_t nNum) const
size_t GetMarkedObjectCount() const
void EnterMarkedGroup()
SdrDragMode GetDragMode() const
bool MarkObj(const Point &rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false)
SdrObject * GetMarkedSdrObj() const
virtual bool IsTextEdit() const final override
const OUString & getHyperlink() const
virtual OUString GetTitle() const
virtual void SetTitle(const OUString &rStr)
bool isDiagram() const
virtual const std::shared_ptr< svx::diagram::IDiagramHelper > & getDiagramHelper() const
virtual void SetDescription(const OUString &rStr)
virtual SdrInventor GetObjInventor() const
virtual OUString GetDescription() const
virtual const OUString & GetName() const
virtual SdrObjKind GetObjIdentifier() const
virtual SdrLayerID GetLayer() const
virtual void SetDecorative(bool isDecorative)
virtual void SetName(const OUString &rStr, const bool bSetChanged=true)
virtual bool IsDecorative() const
void setHyperlink(const OUString &sHyperlink)
void LeaveOneGroup()
SdrPageView * GetSdrPageView() const
const css::uno::Reference< css::awt::XControlModel > & GetUnoControlModel() const
bool SetAttributes(const SfxItemSet &rSet, bool bReplaceAll=false)
void MarkAll()
void UnmarkAll()
void Invalidate(sal_uInt16 nId)
bool GetValue() const
sal_uInt16 Count() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void DisableItem(sal_uInt16 nWhich)
OUString GetBaseURL(bool bForSaving=false)
SfxMedium * GetMedium() const
sal_uInt16 GetSlot() const
void Ignore()
const SfxItemSet * GetArgs() const
const T * GetArg(sal_uInt16 nSlotId) const
void Done(bool bRemove=false)
SfxItemPool & GetPool() const
SfxViewShell * GetViewShell() const
virtual void AddUndoAction(std::unique_ptr< SfxUndoAction > pAction, bool bTryMerg=false)
void ToggleChildWindow(sal_uInt16)
void SetChildWindow(sal_uInt16 nId, bool bVisible, bool bSetFocus=true)
SfxViewFrame & GetViewFrame() const
virtual VclPtr< AbstractSvxObjectTitleDescDialog > CreateSvxObjectTitleDescDialog(weld::Window *pParent, const OUString &rTitle, const OUString &rDescription, bool isDecorative)=0
virtual VclPtr< AbstractSvxObjectNameDialog > CreateSvxObjectNameDialog(weld::Window *pParent, const OUString &rName)=0
static SvxAbstractDialogFactory * Create()
SvxLinkInsertMode GetInsertMode() const
const OUString & GetName() const
const OUString & GetURL() const
void SetName(const OUString &rName)
void SetInsertMode(SvxLinkInsertMode eNew)
void SetURL(const OUString &rURL)
const OUString & GetTargetFrame() const
void SetTargetFrame(const OUString &rTarget)
virtual VclPtr< AbstractDiagramDialog > CreateDiagramDialog(weld::Window *pParent, SdrObjGroup &rDiagram)=0
static VclAbstractDialogFactory * Create()
static void execute(SdrView *pSdrView, SfxRequest const &rReq, SfxBindings &rBindings)
static void execute(SdrView &rSdrView, SfxRequest const &rReq, SfxBindings &rBindings)
weld::Window * GetFrameWeld() const
IMPL_LINK(ScDrawShell, NameObjectHdl, AbstractSvxObjectNameDialog &, rDialog, bool)
Definition: drawsh5.cxx:648
sal_uInt16 ScGetFontWorkId()
Definition: drtxtob2.cxx:37
constexpr TypedWhichId< SfxBoolItem > EE_PARA_HYPHENATE(EE_PARA_START+6)
FilterGroup & rTarget
@ SCA_CELL_RESIZE
Definition: global.hxx:376
@ SCA_CELL
Definition: global.hxx:375
constexpr SdrLayerID SC_LAYER_FRONT(0)
constexpr SdrLayerID SC_LAYER_INTERN(2)
constexpr SdrLayerID SC_LAYER_BACK(1)
SvxLinkInsertMode
HLINK_FIELD
HLINK_BUTTON
OUString aName
Mode eMode
SC_DLLPUBLIC void PasteFromClipboard(ScViewData &rViewData, ScTabViewShell *pTabViewShell, bool bShowDialog)
Definition: cliputil.cxx:49
sal_Int16 nId
const char GetValue[]
static SfxItemSet & rSet
SdrObjKind
SdrDragMode
sal_Int16 SCTAB
Definition: types.hxx:22
RET_OK