LibreOffice Module sw (master) 1
frmsh.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 <config_features.h>
21
22#include <hintids.hxx>
23#include <svl/whiter.hxx>
24#include <sfx2/viewfrm.hxx>
25#include <basic/sbstar.hxx>
26#include <svl/ptitem.hxx>
27#include <svl/stritem.hxx>
28#include <svl/intitem.hxx>
29#include <svl/eitem.hxx>
30#include <editeng/colritem.hxx>
31#include <editeng/lineitem.hxx>
32#include <editeng/boxitem.hxx>
33#include <sfx2/dispatch.hxx>
34#include <sfx2/request.hxx>
35#include <sfx2/objface.hxx>
36#include <vcl/EnumContext.hxx>
37#include <svx/hlnkitem.hxx>
38#include <svx/svdview.hxx>
39#include <svx/sdangitm.hxx>
41#include <sal/log.hxx>
42
43#include <doc.hxx>
44#include <drawdoc.hxx>
47#include <fmturl.hxx>
48#include <fmtclds.hxx>
49#include <fmtcnct.hxx>
50#include <swmodule.hxx>
51#include <wrtsh.hxx>
52#include <wview.hxx>
53#include <uitool.hxx>
54#include <frmfmt.hxx>
55#include <frmsh.hxx>
56#include <frmmgr.hxx>
57#include <edtwin.hxx>
58#include <swdtflvr.hxx>
59#include <viewopt.hxx>
60
61#include <cmdid.h>
62#include <strings.hrc>
63#include <swabstdlg.hxx>
64
65#include <svx/svxdlg.hxx>
66
67#include <docsh.hxx>
68#include <svx/drawitem.hxx>
69#include <memory>
70
71#define ShellClass_SwFrameShell
72#include <sfx2/msg.hxx>
73#include <swslots.hxx>
74#include <grfatr.hxx>
75#include <fldmgr.hxx>
76#include <flyfrm.hxx>
77
78using ::editeng::SvxBorderLine;
79using namespace ::com::sun::star;
80using namespace ::com::sun::star::uno;
81
82// Prototypes
83static void lcl_FrameGetMaxLineWidth(const SvxBorderLine* pBorderLine, SvxBorderLine& rBorderLine);
84static const SwFrameFormat* lcl_GetFrameFormatByName(SwWrtShell const & rSh, std::u16string_view rName)
85{
86 const size_t nCount = rSh.GetFlyCount(FLYCNTTYPE_FRM);
87 for( size_t i = 0; i < nCount; ++i )
88 {
89 const SwFrameFormat* pFormat = rSh.GetFlyNum(i, FLYCNTTYPE_FRM);
90 if(pFormat->GetName() == rName)
91 return pFormat;
92 }
93 return nullptr;
94}
95
97
98void SwFrameShell::InitInterface_Impl()
99{
100 GetStaticInterface()->RegisterPopupMenu("frame");
101
102 GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT, SfxVisibilityFlags::Invisible, ToolbarId::Frame_Toolbox);
103}
104
106{
107 SwWrtShell& rSh = GetShell();
108 sal_uInt16 nSlot = rReq.GetSlot();
109 switch (nSlot)
110 {
111 case SID_SELECTALL:
112 rSh.SelAll();
113 rReq.Done();
114 break;
115 }
116}
117
119{
120 SwWrtShell& rSh = GetShell();
121 sal_uInt16 nSlot = rReq.GetSlot();
122 switch (nSlot)
123 {
124 case FN_POSTIT:
125 SwFieldMgr aFieldMgr(&rSh);
126 rSh.InsertPostIt(aFieldMgr, rReq);
127 break;
128 }
129}
130
132{
133 //First those who do not need FrameMgr.
134 SwWrtShell &rSh = GetShell();
135 bool bMore = false;
136 const SfxItemSet* pArgs = rReq.GetArgs();
137 const SfxPoolItem* pItem;
138 sal_uInt16 nSlot = rReq.GetSlot();
139
140 switch ( nSlot )
141 {
143 if ( rSh.IsFrameSelected() )
144 {
145 rSh.GotoFlyAnchor();
146 rSh.EnterStdMode();
147 rSh.CallChgLnk();
148 }
149 break;
150 case SID_FRAME_TO_TOP:
151 rSh.SelectionToTop();
152 break;
153
154 case SID_FRAME_TO_BOTTOM:
155 rSh.SelectionToBottom();
156 break;
157
158 case FN_FRAME_UP:
159 rSh.SelectionToTop( false );
160 break;
161
162 case FN_FRAME_DOWN:
163 rSh.SelectionToBottom( false );
164 break;
165 case FN_INSERT_FRAME:
166 if (!pArgs)
167 {
168 // Frame already exists, open frame dialog for editing.
169 SfxStringItem aDefPage(FN_FORMAT_FRAME_DLG, "columns");
172 SfxCallMode::SYNCHRON|SfxCallMode::RECORD,
173 { &aDefPage });
174
175 }
176 else
177 {
178 // Frame already exists, only the number of columns will be changed.
179 sal_uInt16 nCols = 1;
180 if(const SfxUInt16Item* pColsItem = pArgs->GetItemIfSet(SID_ATTR_COLUMNS, false))
181 nCols = pColsItem->GetValue();
182
184 rSh.GetFlyFrameAttr( aSet );
185 SwFormatCol aCol(aSet.Get(RES_COL));
186 // GutterWidth will not always passed, hence get firstly
187 // (see view2: Execute on this slot)
188 sal_uInt16 nGutterWidth = aCol.GetGutterWidth();
189 if(!nCols )
190 nCols++;
191 aCol.Init(nCols, nGutterWidth, aCol.GetWishWidth());
192 aSet.Put(aCol);
193 // Template AutoUpdate
194 SwFrameFormat* pFormat = rSh.GetSelectedFrameFormat();
195 if(pFormat && pFormat->IsAutoUpdateOnDirectFormat())
196 {
197 rSh.AutoUpdateFrame(pFormat, aSet);
198 }
199 else
200 {
201 rSh.StartAllAction();
202 rSh.SetFlyFrameAttr( aSet );
203 rSh.SetModified();
204 rSh.EndAllAction();
205 }
206
207 }
208 return;
209
210 case SID_HYPERLINK_SETLINK:
211 {
212 if(pArgs && SfxItemState::SET == pArgs->GetItemState(SID_HYPERLINK_SETLINK, false, &pItem))
213 {
214 const SvxHyperlinkItem& rHLinkItem = *static_cast<const SvxHyperlinkItem *>(pItem);
215 const OUString& rURL = rHLinkItem.GetURL();
216 const OUString& rTarget = rHLinkItem.GetTargetFrame();
217
219 rSh.GetFlyFrameAttr( aSet );
220 SwFormatURL aURL( aSet.Get( RES_URL ) );
221
222 OUString sOldName(rHLinkItem.GetName().toAsciiUpperCase());
223 OUString sFlyName(rSh.GetFlyName().toAsciiUpperCase());
224 if (sOldName != sFlyName)
225 {
226 OUString sName(sOldName);
227 sal_uInt16 i = 1;
228 while (rSh.FindFlyByName(sName))
229 {
230 sName = sOldName + "_" + OUString::number(i++);
231 }
232 rSh.SetFlyName(sName);
233 }
234 aURL.SetURL( rURL, false );
235 aURL.SetTargetFrameName(rTarget);
236
237 aSet.Put( aURL );
238 rSh.SetFlyFrameAttr( aSet );
239 }
240 }
241 break;
242
243 case FN_FRAME_CHAIN:
245 break;
246
247 case FN_FRAME_UNCHAIN:
248 rSh.Unchain( *rSh.GetFlyFrameFormat() );
250 break;
252 {
254 break;
255 }
257 {
259 rReq.Done();
260 break;
261 }
262 case SID_OPEN_XML_FILTERSETTINGS:
263 {
265 }
266 break;
268 {
269 GetView().UpdateWordCount(this, nSlot);
270 break;
271 }
272 default: bMore = true;
273 }
274
275 if ( !bMore )
276 {
277 return;
278 }
279
280 SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE, nullptr );
281 bool bUpdateMgr = true;
282 bool bCopyToFormat = false;
283 switch ( nSlot )
284 {
285 case SID_OBJECT_ALIGN_MIDDLE:
287 aMgr.SetVertOrientation( text::VertOrientation::CENTER );
288 break;
289 case SID_OBJECT_ALIGN_DOWN :
291 aMgr.SetVertOrientation( text::VertOrientation::BOTTOM );
292 break;
293 case SID_OBJECT_ALIGN_UP :
295 aMgr.SetVertOrientation( text::VertOrientation::TOP );
296 break;
297
299 aMgr.SetVertOrientation( text::VertOrientation::CHAR_CENTER );
300 break;
301
303 aMgr.SetVertOrientation( text::VertOrientation::CHAR_BOTTOM );
304 break;
305
307 aMgr.SetVertOrientation( text::VertOrientation::CHAR_TOP );
308 break;
309
311 aMgr.SetVertOrientation( text::VertOrientation::LINE_CENTER );
312 break;
313
315 aMgr.SetVertOrientation( text::VertOrientation::LINE_BOTTOM );
316 break;
317
319 aMgr.SetVertOrientation( text::VertOrientation::LINE_TOP );
320 break;
321 case SID_OBJECT_ALIGN_CENTER :
323 aMgr.SetHorzOrientation( text::HoriOrientation::CENTER );
324 break;
325 case SID_OBJECT_ALIGN_RIGHT:
327 aMgr.SetHorzOrientation( text::HoriOrientation::RIGHT );
328 break;
329 case SID_OBJECT_ALIGN_LEFT:
331 aMgr.SetHorzOrientation( text::HoriOrientation::LEFT );
332 break;
333
335 {
336 aMgr.SetAbsPos(static_cast<const SfxPointItem &>(pArgs->Get
338 }
339 break;
340 case SID_ATTR_BRUSH:
341 {
342 if(pArgs)
343 {
344 aMgr.SetAttrSet( *pArgs );
345 bCopyToFormat = true;
346 }
347 }
348 break;
349 case SID_ATTR_ULSPACE:
350 case SID_ATTR_LRSPACE:
351 {
352 if(pArgs && SfxItemState::SET == pArgs->GetItemState(GetPool().GetWhich(nSlot), false, &pItem))
353 {
354 aMgr.SetAttrSet( *pArgs );
355 bCopyToFormat = true;
356 }
357 }
358 break;
359
360 case SID_ATTR_TRANSFORM:
361 {
362 bool bApplyNewPos = false;
363 bool bApplyNewSize = false;
364
365 Point aNewPos = aMgr.GetPos();
366 if (pArgs)
367 {
368 if (const SfxInt32Item* pXItem = pArgs->GetItemIfSet(SID_ATTR_TRANSFORM_POS_X, false))
369 {
370 aNewPos.setX( pXItem->GetValue() );
371 bApplyNewPos = true;
372 }
373 if (const SfxInt32Item* pYItem = pArgs->GetItemIfSet(SID_ATTR_TRANSFORM_POS_Y, false))
374 {
375 aNewPos.setY( pYItem->GetValue() );
376 bApplyNewPos = true;
377 }
378 }
379
380 Size aNewSize = aMgr.GetSize();
381 if (pArgs)
382 {
383 if (const SfxUInt32Item* pWidthItem = pArgs->GetItemIfSet(SID_ATTR_TRANSFORM_WIDTH, false))
384 {
385 aNewSize.setWidth( pWidthItem->GetValue() );
386 bApplyNewSize = true;
387 }
388 if (const SfxUInt32Item* pHeightItem = pArgs->GetItemIfSet(SID_ATTR_TRANSFORM_HEIGHT, false))
389 {
390 aNewSize.setHeight( pHeightItem->GetValue() );
391 bApplyNewSize = true;
392 }
393 }
394
395 if (pArgs && (pArgs->HasItem(SID_ATTR_TRANSFORM_ANGLE) || pArgs->HasItem(SID_ATTR_TRANSFORM_DELTA_ANGLE)))
396 {
398 rSh.GetCurAttr(aSet);
399 const SwRotationGrf& rRotation = aSet.Get(RES_GRFATR_ROTATION);
400 const Degree10 nOldRot(rRotation.GetValue());
401
402 if (const SdrAngleItem* pAngleItem = pArgs->GetItemIfSet(SID_ATTR_TRANSFORM_DELTA_ANGLE, false))
403 {
404 const Degree10 nDeltaRot = to<Degree10>(pAngleItem->GetValue());
405 aMgr.SetRotation(nOldRot, nOldRot + nDeltaRot, rRotation.GetUnrotatedSize());
406 }
407
408 // RotGrfFlyFrame: Get Value and disable is in SwGrfShell::GetAttrStateForRotation, but the
409 // value setter uses SID_ATTR_TRANSFORM and a group of three values. Rotation is
410 // added now, so use it in this central place. Do no forget to convert angle from
411 // 100th degrees in SID_ATTR_TRANSFORM_ANGLE to 10th degrees in RES_GRFATR_ROTATION
412 if (const SdrAngleItem* pTransformItem = pArgs->GetItemIfSet(SID_ATTR_TRANSFORM_ANGLE, false))
413 {
414 const Degree10 nNewRot = to<Degree10>(pTransformItem->GetValue());
415
416 // RotGrfFlyFrame: Rotation change here, SwFlyFrameAttrMgr aMgr is available
417 aMgr.SetRotation(nOldRot, nNewRot, rRotation.GetUnrotatedSize());
418 }
419 }
420
421 if (bApplyNewPos)
422 {
423 aMgr.SetAbsPos(aNewPos);
424 }
425 if ( bApplyNewSize )
426 {
427 aMgr.SetSize( aNewSize );
428 }
429 if (!bApplyNewPos && !bApplyNewSize)
430 {
431 bUpdateMgr = false;
432 }
433
434 }
435 break;
436
438 case FN_DRAW_WRAP_DLG:
439 {
440 const SelectionType nSel = rSh.GetSelectionType();
441 if (nSel & SelectionType::Graphic)
442 {
444 bUpdateMgr = false;
445 }
446 else
447 {
450 // FillAttribute support:
452 SID_DOCFRAME, SID_DOCFRAME,
453 SID_ATTR_BRUSH, SID_ATTR_BRUSH,
454 SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
455 SID_ATTR_LRSPACE, SID_ATTR_ULSPACE,
456 SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
457 // Items to hand over XPropertyList things like
458 // XColorList, XHatchList, XGradientList, and
459 // XBitmapList to the Area TabPage
460 SID_COLOR_TABLE, SID_PATTERN_LIST,
461 SID_HTML_MODE, SID_HTML_MODE,
468
469 // create needed items for XPropertyList entries from the DrawModel so that
470 // the Area TabPage can access them
472 pDrawModel->PutAreaListItems(aSet);
473
474 const SwViewOption* pVOpt = rSh.GetViewOptions();
475 if(nSel & SelectionType::Ole)
476 aSet.Put( SfxBoolItem(FN_KEEP_ASPECT_RATIO, pVOpt->IsKeepRatio()) );
477 aSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell())));
478 aSet.Put(SfxStringItem(FN_SET_FRM_NAME, rSh.GetFlyName()));
480 if( nSel & SelectionType::Ole )
481 {
482 // #i73249#
483 aSet.Put( SfxStringItem( FN_SET_FRM_ALT_NAME, rSh.GetObjTitle() ) );
484 }
485
486 const SwRect &rPg = rSh.GetAnyCurRect(CurRectType::Page);
487 SwFormatFrameSize aFrameSize(SwFrameSize::Variable, rPg.Width(), rPg.Height());
488 aFrameSize.SetWhich(GetPool().GetWhich(SID_ATTR_PAGE_SIZE));
489 aSet.Put(aFrameSize);
490
491 const SwRect &rPr = rSh.GetAnyCurRect(CurRectType::PagePrt);
492 SwFormatFrameSize aPrtSize(SwFrameSize::Variable, rPr.Width(), rPr.Height());
493 aPrtSize.SetWhich(GetPool().GetWhich(FN_GET_PRINT_AREA));
494 aSet.Put(aPrtSize);
495
496 aSet.Put(aMgr.GetAttrSet());
497 aSet.SetParent( aMgr.GetAttrSet().GetParent() );
498
499 // On % values initialize size
500 SwFormatFrameSize& rSize = const_cast<SwFormatFrameSize&>(aSet.Get(RES_FRM_SIZE));
505
506 // disable vertical positioning for Math Objects anchored 'as char' if baseline alignment is activated
509 const uno::Reference < embed::XEmbeddedObject > xObj( rSh.GetOleRef() );
510 aSet.Put( SfxBoolItem( FN_OLE_IS_MATH, xObj.is() && SotExchange::IsMath( xObj->getClassID() ) ) );
511
512 OUString sDefPage;
513 const SfxStringItem* pDlgItem;
514 if(pArgs && (pDlgItem = pArgs->GetItemIfSet(FN_FORMAT_FRAME_DLG, false)))
515 sDefPage = pDlgItem->GetValue();
516
517 aSet.Put(SfxFrameItem( SID_DOCFRAME, &GetView().GetViewFrame().GetFrame()));
518 FieldUnit eMetric = ::GetDfltMetric(dynamic_cast<SwWebView*>( &GetView()) != nullptr );
519 SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric) ));
522 nSel & SelectionType::Graphic ? OUString("PictureDialog") :
523 nSel & SelectionType::Ole ? OUString("ObjectDialog"):
524 OUString("FrameDialog"),
525 GetView().GetViewFrame(),
527 aSet,
528 false,
529 sDefPage));
530
531 if ( nSlot == FN_DRAW_WRAP_DLG )
532 {
533 pDlg->SetCurPageId("wrap");
534 }
535
536 if ( pDlg->Execute() )
537 {
538 const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
539 if(pOutSet)
540 {
541 rReq.Done(*pOutSet);
542 const SfxBoolItem* pRatioItem = nullptr;
543 if(nSel & SelectionType::Ole &&
544 (pRatioItem = pOutSet->GetItemIfSet(FN_KEEP_ASPECT_RATIO)))
545 {
546 SwViewOption aUsrPref( *pVOpt );
547 aUsrPref.SetKeepRatio(pRatioItem->GetValue());
548 SW_MOD()->ApplyUsrPref(aUsrPref, &GetView());
549 }
550 if (const SfxStringItem* pAltNameItem = pOutSet->GetItemIfSet(FN_SET_FRM_ALT_NAME))
551 {
552 // #i73249#
553 rSh.SetObjTitle(pAltNameItem->GetValue());
554 }
555 if (const SfxStringItem* pDescripItem = pOutSet->GetItemIfSet(FN_UNO_DESCRIPTION))
556 rSh.SetObjDescription(pDescripItem->GetValue());
557
558 // Template AutoUpdate
559 SwFrameFormat* pFormat = rSh.GetSelectedFrameFormat();
560 if(pFormat && pFormat->IsAutoUpdateOnDirectFormat())
561 {
562 rSh.AutoUpdateFrame(pFormat, *pOutSet);
563 // Anything which is not supported by the format must be set hard.
564 if(const SfxStringItem* pFrameName = pOutSet->GetItemIfSet(FN_SET_FRM_NAME, false))
565 rSh.SetFlyName(pFrameName->GetValue());
568 RES_SURROUND, RES_ANCHOR> aShellSet( GetPool() );
569 aShellSet.Put(*pOutSet);
570 aMgr.SetAttrSet(aShellSet);
571 if(const SfxStringItem* pFrameName = pOutSet->GetItemIfSet(FN_SET_FRM_NAME, false))
572 rSh.SetFlyName(pFrameName->GetValue());
573 }
574 else
575 aMgr.SetAttrSet( *pOutSet );
576
577 const SwFrameFormat* pCurrFlyFormat = rSh.GetFlyFrameFormat();
578 if(const SfxStringItem* pPreviousItem =
579 pOutSet->GetItemIfSet(FN_PARAM_CHAIN_PREVIOUS, false))
580 {
581 rSh.HideChainMarker();
582
583 OUString sPrevName = pPreviousItem->GetValue();
584 const SwFormatChain &rChain = pCurrFlyFormat->GetChain();
585 //needs cast - no non-const method available
586 SwFlyFrameFormat* pFlyFormat =
587 rChain.GetPrev();
588 if(pFlyFormat)
589 {
590 if (pFlyFormat->GetName() != sPrevName)
591 {
592 rSh.Unchain(*pFlyFormat);
593 }
594 else
595 sPrevName.clear();
596 }
597
598 if (!sPrevName.isEmpty())
599 {
600 //needs cast - no non-const method available
601 SwFrameFormat* pPrevFormat = const_cast<SwFrameFormat*>(
602 lcl_GetFrameFormatByName(rSh, sPrevName));
603 SAL_WARN_IF(!pPrevFormat, "sw.ui", "No frame found!");
604 if(pPrevFormat)
605 {
606 rSh.Chain(*pPrevFormat, *pCurrFlyFormat);
607 }
608 }
609 rSh.SetChainMarker();
610 }
611 if(const SfxStringItem* pChainNextItem =
612 pOutSet->GetItemIfSet(FN_PARAM_CHAIN_NEXT, false))
613 {
614 rSh.HideChainMarker();
615 OUString sNextName = pChainNextItem->GetValue();
616 const SwFormatChain &rChain = pCurrFlyFormat->GetChain();
617 //needs cast - no non-const method available
618 SwFlyFrameFormat* pFlyFormat =
619 rChain.GetNext();
620 if(pFlyFormat)
621 {
622 if (pFlyFormat->GetName() != sNextName)
623 {
624 rSh.Unchain(*const_cast<SwFlyFrameFormat*>(static_cast<const SwFlyFrameFormat*>( pCurrFlyFormat)));
625 }
626 else
627 sNextName.clear();
628 }
629
630 if (!sNextName.isEmpty())
631 {
632 //needs cast - no non-const method available
633 SwFrameFormat* pNextFormat = const_cast<SwFrameFormat*>(
634 lcl_GetFrameFormatByName(rSh, sNextName));
635 SAL_WARN_IF(!pNextFormat, "sw.ui", "No frame found!");
636 if(pNextFormat)
637 {
638 rSh.Chain(*const_cast<SwFrameFormat*>(
639 pCurrFlyFormat), *pNextFormat);
640 }
641 }
642 rSh.SetChainMarker();
643 }
644 }
645 }
646 else
647 bUpdateMgr = false;
648 }
649 }
650 break;
652 {
653 SwFormatHoriOrient aHori(aMgr.GetHoriOrient());
654 bool bMirror = !aHori.IsPosToggle();
655 aHori.SetPosToggle(bMirror);
657 aSet.Put(aHori);
658 aMgr.SetAttrSet(aSet);
659 bCopyToFormat = true;
660 rReq.SetReturnValue(SfxBoolItem(nSlot, bMirror));
661 }
662 break;
663 case FN_NAME_SHAPE:
664 {
665 bUpdateMgr = false;
666 SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList();
667 if ( pSdrView &&
668 pSdrView->GetMarkedObjectCount() == 1 )
669 {
670 OUString aName(rSh.GetFlyName());
674
675 if ( pDlg->Execute() == RET_OK )
676 {
677 pDlg->GetName(aName);
678 rSh.SetFlyName(aName);
679 }
680 }
681 }
682 break;
683 // #i73249#
685 {
686 bUpdateMgr = false;
687 SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList();
688 if ( pSdrView &&
689 pSdrView->GetMarkedObjectCount() == 1 )
690 {
691 OUString aDescription(rSh.GetObjDescription());
692 OUString aTitle(rSh.GetObjTitle());
693 bool isDecorative(rSh.IsObjDecorative());
694
698 aTitle, aDescription, isDecorative));
699
700 if ( pDlg->Execute() == RET_OK )
701 {
702 pDlg->GetDescription(aDescription);
703 pDlg->GetTitle(aTitle);
704 pDlg->IsDecorative(isDecorative);
705
706 rSh.SetObjDescription(aDescription);
707 rSh.SetObjTitle(aTitle);
708 rSh.SetObjDecorative(isDecorative);
709 }
710 }
711 }
712 break;
713 default:
714 assert(!"wrong dispatcher");
715 return;
716 }
717 if ( bUpdateMgr )
718 {
719 SwFrameFormat* pFormat = rSh.GetSelectedFrameFormat();
720 if ( bCopyToFormat && pFormat && pFormat->IsAutoUpdateOnDirectFormat() )
721 {
722 rSh.AutoUpdateFrame(pFormat, aMgr.GetAttrSet());
723 }
724 else
725 {
726 aMgr.UpdateFlyFrame();
727 }
728 }
729
730}
731
733{
734 SwWrtShell &rSh = GetShell();
735 bool bHtmlMode = 0 != ::GetHtmlMode(rSh.GetView().GetDocShell());
736 if (!rSh.IsFrameSelected())
737 return;
738
742 rSh.GetFlyFrameAttr( aSet );
743
746
747 bProtect |= bParentCntProt;
748
749 const FrameTypeFlags eFrameType = rSh.GetFrameType(nullptr,true);
750 SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE, nullptr );
751
752 SfxWhichIter aIter( rSet );
753 sal_uInt16 nWhich = aIter.FirstWhich();
754 while ( nWhich )
755 {
756 switch ( nWhich )
757 {
758 case RES_FRM_SIZE:
759 {
760 const SwFormatFrameSize& aSz(aMgr.GetFrameSize());
761 rSet.Put(aSz);
762 }
763 break;
764 case RES_VERT_ORIENT:
765 case RES_HORI_ORIENT:
766 case SID_ATTR_ULSPACE:
767 case SID_ATTR_LRSPACE:
768 case RES_LR_SPACE:
769 case RES_UL_SPACE:
770 case RES_PROTECT:
771 case RES_OPAQUE:
772 case RES_PRINT:
773 case RES_SURROUND:
774 {
775 rSet.Put(aSet.Get(GetPool().GetWhich(nWhich)));
776 }
777 break;
778 case SID_OBJECT_ALIGN:
779 {
780 if ( bProtect )
781 rSet.DisableItem( nWhich );
782 }
783 break;
784 case SID_OBJECT_ALIGN_LEFT :
785 case SID_OBJECT_ALIGN_CENTER :
786 case SID_OBJECT_ALIGN_RIGHT :
790 if ( (eFrameType & FrameTypeFlags::FLY_INCNT) ||
791 bProtect ||
792 ((nWhich == FN_FRAME_ALIGN_HORZ_CENTER || nWhich == SID_OBJECT_ALIGN_CENTER) &&
793 bHtmlMode ))
794 {
795 rSet.DisableItem( nWhich );
796 }
797 else
798 {
799 sal_Int16 nHoriOrient = -1;
800 switch(nWhich)
801 {
802 case SID_OBJECT_ALIGN_LEFT:
803 nHoriOrient = text::HoriOrientation::LEFT;
804 break;
805 case SID_OBJECT_ALIGN_CENTER:
806 nHoriOrient = text::HoriOrientation::CENTER;
807 break;
808 case SID_OBJECT_ALIGN_RIGHT:
809 nHoriOrient = text::HoriOrientation::RIGHT;
810 break;
811 default:
812 break;
813 }
814 SwFormatHoriOrient aHOrient(aMgr.GetHoriOrient());
815 if (nHoriOrient != -1)
816 rSet.Put(SfxBoolItem(nWhich, nHoriOrient == aHOrient.GetHoriOrient()));
817 }
818 break;
825 if ( !(eFrameType & FrameTypeFlags::FLY_INCNT) || bProtect
826 || (bHtmlMode && FN_FRAME_ALIGN_VERT_CHAR_BOTTOM == nWhich) )
827 rSet.DisableItem( nWhich );
828 break;
829
830 case SID_OBJECT_ALIGN_UP :
831 case SID_OBJECT_ALIGN_MIDDLE :
832 case SID_OBJECT_ALIGN_DOWN :
833
837 if ( bProtect || (bHtmlMode && eFrameType & FrameTypeFlags::FLY_ATCNT))
838 rSet.DisableItem( nWhich );
839 else
840 {
841 // These slots need different labels depending on whether they are anchored in a character
842 // or on a paragraph/page etc.
843 OUString sNewLabel;
844 if (eFrameType & FrameTypeFlags::FLY_INCNT)
845 {
846 switch (nWhich)
847 {
848 case SID_OBJECT_ALIGN_UP :
850 sNewLabel = SwResId(STR_FRMUI_TOP_BASE);
851 break;
852 case SID_OBJECT_ALIGN_MIDDLE :
854 sNewLabel = SwResId(STR_FRMUI_CENTER_BASE);
855 break;
856 case SID_OBJECT_ALIGN_DOWN :
858 if(!bHtmlMode)
859 sNewLabel = SwResId(STR_FRMUI_BOTTOM_BASE);
860 else
861 rSet.DisableItem( nWhich );
862 break;
863 }
864 }
865 else
866 {
867 if (nWhich != FN_FRAME_ALIGN_VERT_TOP &&
868 nWhich != SID_OBJECT_ALIGN_UP )
869 {
870 if (aMgr.GetAnchor() == RndStdIds::FLY_AT_FLY)
871 {
872 const SwFrameFormat* pFormat = rSh.IsFlyInFly();
873 if (pFormat)
874 {
875 const SwFormatFrameSize& rFrameSz = pFormat->GetFrameSize();
876 if (rFrameSz.GetHeightSizeType() != SwFrameSize::Fixed)
877 {
878 rSet.DisableItem( nWhich );
879 break;
880 }
881 }
882 }
883 }
884 OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(GetFrame()->GetFrame().GetFrameInterface()));
885 switch (nWhich)
886 {
887 case SID_OBJECT_ALIGN_UP :
889 {
890 auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:AlignTop", aModuleName);
892 break;
893 }
894 case SID_OBJECT_ALIGN_MIDDLE:
896 {
897 auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:AlignVerticalCenter", aModuleName);
899 break;
900 }
901 case SID_OBJECT_ALIGN_DOWN:
903 {
904 auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:AlignBottom", aModuleName);
906 break;
907 }
908 }
909 }
910 if ( !sNewLabel.isEmpty() )
911 rSet.Put( SfxStringItem( nWhich, sNewLabel ));
912 }
913 break;
914 case SID_HYPERLINK_GETLINK:
915 {
916 SvxHyperlinkItem aHLinkItem;
917
919 rSh.GetFlyFrameAttr( aURLSet );
920
921 if(const SwFormatURL* pFormatURL = aURLSet.GetItemIfSet(RES_URL))
922 {
923 aHLinkItem.SetURL(pFormatURL->GetURL());
924 aHLinkItem.SetTargetFrame(pFormatURL->GetTargetFrameName());
925 aHLinkItem.SetName(rSh.GetFlyName());
926 }
927
928 aHLinkItem.SetInsertMode(static_cast<SvxLinkInsertMode>(aHLinkItem.GetInsertMode() |
929 (bHtmlMode ? HLINK_HTMLMODE : 0)));
930
931 rSet.Put(aHLinkItem);
932 }
933 break;
934
935 case FN_FRAME_CHAIN:
936 {
937 const SelectionType nSel = rSh.GetSelectionType();
938 if (nSel & SelectionType::Graphic || nSel & SelectionType::Ole)
940 else
941 {
942 const SwFrameFormat *pFormat = rSh.GetFlyFrameFormat();
943 if ( bParentCntProt || rSh.GetView().GetEditWin().GetApplyTemplate() ||
944 !pFormat || pFormat->GetChain().GetNext() )
945 {
947 }
948 else
949 {
950 bool bChainMode = rSh.GetView().GetEditWin().IsChainMode();
951 rSet.Put( SfxBoolItem( FN_FRAME_CHAIN, bChainMode ) );
952 }
953 }
954 }
955 break;
956 case FN_FRAME_UNCHAIN:
957 {
958 const SelectionType nSel = rSh.GetSelectionType();
959 if (nSel & SelectionType::Graphic || nSel & SelectionType::Ole)
961 else
962 {
963 const SwFrameFormat *pFormat = rSh.GetFlyFrameFormat();
964 if ( bParentCntProt || rSh.GetView().GetEditWin().GetApplyTemplate() ||
965 !pFormat || !pFormat->GetChain().GetNext() )
966 {
968 }
969 }
970 }
971 break;
972 case SID_FRAME_TO_TOP:
973 case SID_FRAME_TO_BOTTOM:
974 case FN_FRAME_UP:
975 case FN_FRAME_DOWN:
976 if ( bParentCntProt )
977 rSet.DisableItem( nWhich );
978 break;
979
980 case SID_ATTR_TRANSFORM:
981 {
982 rSet.DisableItem( nWhich );
983 }
984 break;
985
986 case SID_ATTR_TRANSFORM_PROTECT_SIZE:
987 {
989 if ( ( eProtection & FlyProtectFlags::Content ) ||
990 ( eProtection & FlyProtectFlags::Size ) )
991 {
992 rSet.Put( SfxBoolItem( SID_ATTR_TRANSFORM_PROTECT_SIZE, true ) );
993 }
994 else
995 {
996 rSet.Put( SfxBoolItem( SID_ATTR_TRANSFORM_PROTECT_SIZE, false ) );
997 }
998 }
999 break;
1000
1001 case SID_ATTR_TRANSFORM_WIDTH:
1002 {
1003 rSet.Put( SfxUInt32Item( SID_ATTR_TRANSFORM_WIDTH, aMgr.GetSize().getWidth() ) );
1004 }
1005 break;
1006
1007 case SID_ATTR_TRANSFORM_HEIGHT:
1008 {
1009 rSet.Put( SfxUInt32Item( SID_ATTR_TRANSFORM_HEIGHT, aMgr.GetSize().getHeight() ) );
1010 }
1011 break;
1012
1014 {
1015 const SelectionType nSel = rSh.GetSelectionType();
1016 if ( bParentCntProt || nSel & SelectionType::Graphic)
1017 rSet.DisableItem( nWhich );
1018 }
1019 break;
1020 // #i73249#
1022 case FN_NAME_SHAPE:
1023 {
1024 SwWrtShell &rWrtSh = GetShell();
1025 SdrView* pSdrView = rWrtSh.GetDrawViewWithValidMarkList();
1026 if ( !pSdrView ||
1027 pSdrView->GetMarkedObjectCount() != 1 )
1028 {
1029 rSet.DisableItem( nWhich );
1030 }
1031 }
1032 break;
1033
1034 case FN_POSTIT:
1035 {
1036 SwFlyFrame* pFly = rSh.GetSelectedFlyFrame();
1037 if (pFly)
1038 {
1039 SwFrameFormat* pFormat = pFly->GetFormat();
1040 if (pFormat)
1041 {
1042 RndStdIds eAnchorId = pFormat->GetAnchor().GetAnchorId();
1043 // SwWrtShell::InsertPostIt() only works on as-char and at-char anchored
1044 // images.
1045 if (eAnchorId != RndStdIds::FLY_AS_CHAR && eAnchorId != RndStdIds::FLY_AT_CHAR)
1046 {
1047 rSet.DisableItem(nWhich);
1048 }
1049 }
1050 }
1051 }
1052 break;
1053
1054 default:
1055 /* do nothing */;
1056 break;
1057 }
1058 nWhich = aIter.NextWhich();
1059 }
1060}
1061
1063 SwBaseShell( _rView )
1064{
1065 SetName("Frame");
1066
1067 // #96392# Use this to announce it is the frame shell who creates the selection.
1069
1071}
1072
1074{
1075 // #96392# Only clear the selection if it was this frame shell who created it.
1077}
1078
1080{
1081 SwWrtShell &rSh = GetShell();
1082 bool bDefault = false;
1083 if (!rSh.IsFrameSelected())
1084 return;
1085 // At first pick the default BoxItem out of the pool.
1086 // If unequal to regular box item, then it has already
1087 // been changed (New one is no default).
1088 const SvxBoxItem* pPoolBoxItem = ::GetDfltAttr(RES_BOX);
1089
1090 const SfxItemSet *pArgs = rReq.GetArgs();
1092
1093 rSh.GetFlyFrameAttr( aFrameSet );
1094 const SvxBoxItem& rBoxItem = aFrameSet.Get(RES_BOX);
1095
1096 if (pPoolBoxItem == &rBoxItem)
1097 bDefault = true;
1098
1099 std::unique_ptr<SvxBoxItem> aBoxItem(rBoxItem.Clone());
1100
1101 SvxBorderLine aBorderLine;
1102
1103 if(pArgs) // Any controller can sometimes deliver nothing #48169#
1104 {
1105 switch (rReq.GetSlot())
1106 {
1107 case SID_ATTR_BORDER:
1108 {
1109 if (const SvxBoxItem* pBoxItem = pArgs->GetItemIfSet(RES_BOX))
1110 {
1111 std::unique_ptr<SvxBoxItem> aNewBox(pBoxItem->Clone());
1112 const SvxBorderLine* pBorderLine;
1113
1114 pBorderLine = aBoxItem->GetTop();
1115 if (pBorderLine != nullptr)
1116 lcl_FrameGetMaxLineWidth(pBorderLine, aBorderLine);
1117 pBorderLine = aBoxItem->GetBottom();
1118 if (pBorderLine != nullptr)
1119 lcl_FrameGetMaxLineWidth(pBorderLine, aBorderLine);
1120 pBorderLine = aBoxItem->GetLeft();
1121 if (pBorderLine != nullptr)
1122 lcl_FrameGetMaxLineWidth(pBorderLine, aBorderLine);
1123 pBorderLine = aBoxItem->GetRight();
1124 if (pBorderLine != nullptr)
1125 lcl_FrameGetMaxLineWidth(pBorderLine, aBorderLine);
1126
1127 if(aBorderLine.GetOutWidth() == 0)
1128 {
1129 aBorderLine.SetBorderLineStyle(
1130 SvxBorderLineStyle::SOLID);
1131 aBorderLine.SetWidth( SvxBorderLineWidth::Hairline );
1132 }
1133 //Set distance only if the request is received from the controller.
1134
1135#if HAVE_FEATURE_SCRIPTING
1137#endif
1138 {
1139 // TODO: should this copy 4 individual Dist instead?
1140 aNewBox->SetAllDistances(rBoxItem.GetSmallestDistance());
1141 }
1142
1143 aBoxItem = std::move(aNewBox);
1144
1145 if( aBoxItem->GetTop() != nullptr )
1146 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::TOP);
1147 if( aBoxItem->GetBottom() != nullptr )
1148 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM);
1149 if( aBoxItem->GetLeft() != nullptr )
1150 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::LEFT);
1151 if( aBoxItem->GetRight() != nullptr )
1152 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::RIGHT);
1153 }
1154 }
1155 break;
1156
1157 case SID_FRAME_LINESTYLE:
1158 {
1159 if ( const SvxLineItem* pLineItem = pArgs->GetItemIfSet(SID_FRAME_LINESTYLE, false))
1160 {
1161 if ( pLineItem->GetLine() )
1162 {
1163 aBorderLine = *(pLineItem->GetLine());
1164
1165 if (!aBoxItem->GetTop() && !aBoxItem->GetBottom() &&
1166 !aBoxItem->GetLeft() && !aBoxItem->GetRight())
1167 {
1168 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::TOP);
1169 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM);
1170 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::LEFT);
1171 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::RIGHT);
1172 }
1173 else
1174 {
1175 if( aBoxItem->GetTop() )
1176 {
1177 aBorderLine.SetColor( aBoxItem->GetTop()->GetColor() );
1178 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::TOP);
1179 }
1180 if( aBoxItem->GetBottom() )
1181 {
1182 aBorderLine.SetColor( aBoxItem->GetBottom()->GetColor());
1183 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM);
1184 }
1185 if( aBoxItem->GetLeft() )
1186 {
1187 aBorderLine.SetColor( aBoxItem->GetLeft()->GetColor());
1188 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::LEFT);
1189 }
1190 if( aBoxItem->GetRight() )
1191 {
1192 aBorderLine.SetColor(aBoxItem->GetRight()->GetColor());
1193 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::RIGHT);
1194 }
1195 }
1196 }
1197 else
1198 {
1199 aBoxItem->SetLine(nullptr, SvxBoxItemLine::TOP);
1200 aBoxItem->SetLine(nullptr, SvxBoxItemLine::BOTTOM);
1201 aBoxItem->SetLine(nullptr, SvxBoxItemLine::LEFT);
1202 aBoxItem->SetLine(nullptr, SvxBoxItemLine::RIGHT);
1203 }
1204 }
1205 }
1206 break;
1207
1208 case SID_FRAME_LINECOLOR:
1209 {
1210 if (const SvxColorItem* pColorItem = pArgs->GetItemIfSet(SID_FRAME_LINECOLOR, false))
1211 {
1212 const Color& rNewColor = pColorItem->GetValue();
1213
1214 if (!aBoxItem->GetTop() && !aBoxItem->GetBottom() &&
1215 !aBoxItem->GetLeft() && !aBoxItem->GetRight())
1216 {
1217 aBorderLine.SetColor( rNewColor );
1218 aBorderLine.SetBorderLineStyle(SvxBorderLineStyle::SOLID);
1219 aBorderLine.SetWidth(SvxBorderLineWidth::Hairline);
1220
1221 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::TOP);
1222 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::BOTTOM);
1223 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::LEFT);
1224 aBoxItem->SetLine(&aBorderLine, SvxBoxItemLine::RIGHT);
1225 }
1226 else
1227 {
1228 if (aBoxItem->GetTop())
1229 aBoxItem->GetTop()->SetColor(rNewColor);
1230 if (aBoxItem->GetBottom())
1231 aBoxItem->GetBottom()->SetColor(rNewColor);
1232 if (aBoxItem->GetLeft())
1233 aBoxItem->GetLeft()->SetColor(rNewColor);
1234 if (aBoxItem->GetRight())
1235 aBoxItem->GetRight()->SetColor(rNewColor);
1236 }
1237 }
1238 }
1239 break;
1240 }
1241 }
1242 if (bDefault && (aBoxItem->GetTop() || aBoxItem->GetBottom() ||
1243 aBoxItem->GetLeft() || aBoxItem->GetRight()))
1244 {
1245 aBoxItem->SetAllDistances(MIN_BORDER_DIST);
1246 }
1247 aFrameSet.Put( std::move(aBoxItem) );
1248 // Template AutoUpdate
1249 SwFrameFormat* pFormat = rSh.GetSelectedFrameFormat();
1250 if(pFormat && pFormat->IsAutoUpdateOnDirectFormat())
1251 {
1252 rSh.AutoUpdateFrame(pFormat, aFrameSet);
1253 }
1254 else
1255 rSh.SetFlyFrameAttr( aFrameSet );
1256
1257}
1258
1259static void lcl_FrameGetMaxLineWidth(const SvxBorderLine* pBorderLine, SvxBorderLine& rBorderLine)
1260{
1261 if(pBorderLine->GetWidth() > rBorderLine.GetWidth())
1262 rBorderLine.SetWidth(pBorderLine->GetWidth());
1263
1264 rBorderLine.SetBorderLineStyle(pBorderLine->GetBorderLineStyle());
1265 rBorderLine.SetColor(pBorderLine->GetColor());
1266}
1267
1269{
1270 SwWrtShell &rSh = GetShell();
1272
1273 if (bParentCntProt)
1274 {
1275 if (rSh.IsFrameSelected())
1276 rSet.DisableItem( SID_FRAME_LINECOLOR );
1277
1278 rSet.DisableItem( SID_ATTR_BORDER );
1279 rSet.DisableItem( SID_FRAME_LINESTYLE );
1280 }
1281 else
1282 {
1283 if (rSh.IsFrameSelected())
1284 {
1286
1287 rSh.GetFlyFrameAttr(aFrameSet);
1288
1289 const SvxBorderLine* pLine = aFrameSet.Get(RES_BOX).GetTop();
1290 rSet.Put(SvxColorItem(pLine ? pLine->GetColor() : Color(), SID_FRAME_LINECOLOR));
1291 }
1292 }
1293}
1294
1296{
1297 const SelectionType nSel = GetShell().GetSelectionType();
1298 if ( (nSel & SelectionType::Graphic)
1299 || (nSel & SelectionType::Ole) )
1300 {
1302 }
1303 else if ( GetShell().CursorInsideInputField() )
1304 {
1306 }
1307}
1308
1310{
1311 SwWrtShell &rSh = GetShell();
1312
1313 if(rSh.IsFrameSelected())
1314 {
1315 rSh.GetFlyFrameAttr(rSet);
1316 }
1317 else
1318 {
1319 SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList();
1320
1321 if(pSdrView)
1322 {
1323 rSet.Put(pSdrView->GetDefaultAttr());
1324 }
1325 }
1326}
1327
1329{
1330 const SfxItemSet* pArgs = rReq.GetArgs();
1331 SwWrtShell& rSh = GetShell();
1332
1333 if(pArgs)
1334 {
1335 if(rSh.IsFrameSelected())
1336 {
1337 rSh.SetFlyFrameAttr(const_cast< SfxItemSet& >(*pArgs));
1338 }
1339 else
1340 {
1341 SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList();
1342
1343 if(pSdrView)
1344 {
1345 pSdrView->SetDefaultAttr(*pArgs, false);
1346 }
1347 }
1348 }
1349 else
1350 {
1352
1353 switch(rReq.GetSlot())
1354 {
1355 case SID_ATTR_FILL_STYLE:
1356 case SID_ATTR_FILL_COLOR:
1357 case SID_ATTR_FILL_GRADIENT:
1358 case SID_ATTR_FILL_HATCH:
1359 case SID_ATTR_FILL_BITMAP:
1360 case SID_ATTR_FILL_TRANSPARENCE:
1361 case SID_ATTR_FILL_FLOATTRANSPARENCE:
1362 {
1363 pDis->Execute(SID_ATTRIBUTES_AREA);
1364 break;
1365 }
1366 }
1367 }
1368}
1369
1371{
1372 switch(rReq.GetSlot())
1373 {
1374 case SID_ATTRIBUTES_AREA:
1375 {
1376 SwWrtShell& rSh = GetShell();
1377
1378 if(rSh.IsFrameSelected())
1379 {
1380 SdrModel& rModel = rSh.GetDrawView()->GetModel();
1381 SfxItemSet aNewAttr(rModel.GetItemPool());
1382
1383 // get attributes from FlyFrame
1384 rSh.GetFlyFrameAttr(aNewAttr);
1385
1389 &aNewAttr,
1390 &rModel,
1391 false,
1392 false));
1393
1394 pDlg->StartExecuteAsync([pDlg, this](sal_Int32 nResult){
1395 if(nResult == RET_OK)
1396 {
1397 // set attributes at FlyFrame
1398 GetShell().SetFlyFrameAttr(const_cast< SfxItemSet& >(*pDlg->GetOutputItemSet()));
1399
1400 static sal_uInt16 aInval[] =
1401 {
1402 SID_ATTR_FILL_STYLE,
1403 SID_ATTR_FILL_COLOR,
1404 SID_ATTR_FILL_TRANSPARENCE,
1405 SID_ATTR_FILL_FLOATTRANSPARENCE,
1406 0
1407 };
1408
1410
1411 rBnd.Invalidate(aInval);
1412 rBnd.Update(SID_ATTR_FILL_STYLE);
1413 rBnd.Update(SID_ATTR_FILL_COLOR);
1414 rBnd.Update(SID_ATTR_FILL_TRANSPARENCE);
1415 rBnd.Update(SID_ATTR_FILL_FLOATTRANSPARENCE);
1416 }
1417 pDlg->disposeOnce();
1418 });
1419 }
1420
1421 break;
1422 }
1423 }
1424}
1425
1427{
1428 SfxWhichIter aIter(rSet);
1429 sal_uInt16 nWhich(aIter.FirstWhich());
1430
1431 while(nWhich)
1432 {
1433 switch(nWhich)
1434 {
1435 case SID_ATTRIBUTES_AREA:
1436 {
1437 SwWrtShell& rSh = GetShell();
1438
1439 if(!rSh.IsFrameSelected())
1440 {
1441 rSet.DisableItem(nWhich);
1442 }
1443
1444 break;
1445 }
1446 default:
1447 {
1448 rSet.DisableItem(nWhich);
1449 break;
1450 }
1451 }
1452
1453 nWhich = aIter.NextWhich();
1454 }
1455}
1456
1457/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
PropertiesInfo aProperties
#define GetWhich(nSlot)
const OUString & GetValue() const
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
void setX(tools::Long nX)
void setY(tools::Long nY)
size_t GetMarkedObjectCount() const
const SfxItemPool & GetItemPool() const
const SfxItemSet & GetDefaultAttr() const
void SetDefaultAttr(const SfxItemSet &rAttr, bool bReplaceAll)
SdrModel & GetModel() const
void Update(sal_uInt16 nId)
void Invalidate(sal_uInt16 nId)
bool GetValue() const
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SfxItemSet * GetParent() const
bool HasItem(sal_uInt16 nWhich, const SfxPoolItem **ppItem=nullptr) 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)
const Point & GetValue() const
sal_uInt16 GetSlot() const
const SfxItemSet * GetArgs() const
void SetReturnValue(const SfxPoolItem &)
void Done(bool bRemove=false)
SfxItemPool & GetPool() const
void SetContextName(const OUString &rsContextName)
static void HandleOpenXmlFilterSettings(SfxRequest &)
SfxViewFrame * GetFrame() const
void SetName(const OUString &rName)
SfxBindings & GetBindings()
SfxDispatcher * GetDispatcher()
SfxViewFrame & GetViewFrame() const
sal_uInt16 FirstWhich()
sal_uInt16 NextWhich()
constexpr tools::Long getHeight() const
constexpr tools::Long getWidth() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
static sal_uInt16 IsMath(const SvGlobalName &rName)
static bool IsRunning()
virtual VclPtr< AbstractSvxAreaTabDialog > CreateSvxAreaTabDialog(weld::Window *pParent, const SfxItemSet *pAttr, SdrModel *pModel, bool bShadow, bool bSlideBackground)=0
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()
static const sal_Int16 Hairline
virtual SvxBoxItem * Clone(SfxItemPool *pPool=nullptr) const override
sal_uInt16 GetSmallestDistance() const
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)
void SetHeight(tools::Long n)
void SetWidth(tools::Long n)
virtual VclPtr< SfxAbstractTabDialog > CreateFrameTabDialog(const OUString &rDialogType, SfxViewFrame &rFrame, weld::Window *pParent, const SfxItemSet &rCoreSet, bool bNewFrame=true, const OUString &sDefPage={})=0
static SwAbstractDialogFactory * Create()
Definition: swabstdlg.cxx:36
SwWrtShell & GetShell()
Definition: basesh.cxx:3001
SwView & GetView()
Definition: basesh.hxx:59
void GotoFlyAnchor()
jump from the frame to the anchor
Definition: trvlfnfl.cxx:350
void CallChgLnk()
Definition: crsrsh.cxx:2847
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:204
IDocumentSettingAccess const & getIDocumentSettingAccess() const
Definition: doc.cxx:190
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:169
void PutAreaListItems(SfxItemSet &rSet) const
Put needed items for XPropertyList entries from the DrawModel.
Definition: drawdoc.cxx:151
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
Definition: edattr.cxx:171
void StartAllAction()
For all views of this document.
Definition: edws.cxx:86
const SwFlyFrameFormat * FindFlyByName(const OUString &rName) const
Definition: edfmt.cxx:142
void SetModified()
Definition: edws.cxx:70
void EndAllAction()
Definition: edws.cxx:97
bool IsChainMode() const
Definition: edtwin.hxx:229
void SetChainMode(bool bOn)
Definition: edtwin.cxx:6203
SwApplyTemplate * GetApplyTemplate() const
Definition: edtwin.hxx:235
SwFlyFrame * GetSelectedFlyFrame() const
Definition: fefly1.cxx:277
void Unchain(SwFrameFormat &rFormat)
Definition: feshview.cxx:2826
bool SetFlyFrameAttr(SfxItemSet &rSet)
Definition: fefly1.cxx:1103
FrameTypeFlags GetFrameType(const Point *pPt, bool bStopAtFly) const
For return values see above FrameType.
Definition: fews.cxx:237
void SetObjDescription(const OUString &rDescription)
Definition: fefly1.cxx:2026
FlyProtectFlags IsSelObjProtected(FlyProtectFlags eType) const
Which Protection is set at selected object?
Definition: feshview.cxx:2581
void HideChainMarker()
Definition: feshview.cxx:2833
OUString GetFlyName() const
Definition: fefly1.cxx:1481
OUString GetObjTitle() const
Definition: fefly1.cxx:1964
void SetObjTitle(const OUString &rTitle)
Definition: fefly1.cxx:1984
void SetFlyName(const OUString &rName)
Set name at selected FlyFrame.
Definition: fefly1.cxx:1471
bool IsFrameSelected() const
Definition: feshview.cxx:1133
void SetObjDecorative(bool isDecorative)
Definition: fefly1.cxx:2070
OUString GetObjDescription() const
Definition: fefly1.cxx:2006
css::uno::Reference< css::embed::XEmbeddedObject > GetOleRef() const
get reference to OLE object (if there is one) for selected FlyFrame
Definition: fefly1.cxx:1491
const SwFrameFormat * GetFlyNum(size_t nIdx, FlyCntType eType, bool bIgnoreTextBoxes=false) const
Definition: feshview.cxx:2556
SwFrameFormat * GetSelectedFrameFormat() const
If frame then frame style, else 0.
Definition: fefly1.cxx:1213
void SelectionToTop(bool bTop=true)
Move selection upwards or downwards (Z-Order).
Definition: feshview.cxx:928
void SelectionToBottom(bool bBottom=true)
Definition: feshview.cxx:997
void SetChainMarker()
Definition: feshview.cxx:2839
size_t GetFlyCount(FlyCntType eType, bool bIgnoreTextBoxes=false) const
Iterate over flys - for Basic-collections.
Definition: feshview.cxx:2551
SwChainRet Chain(SwFrameFormat &rSource, const Point &rPt)
Definition: feshview.cxx:2803
const SwRect & GetAnyCurRect(CurRectType eType, const Point *pPt=nullptr, const css::uno::Reference< css::embed::XEmbeddedObject > &=css::uno::Reference< css::embed::XEmbeddedObject >()) const
Definition: fews.cxx:90
bool GetFlyFrameAttr(SfxItemSet &rSet) const
Definition: fefly1.cxx:1061
bool IsObjDecorative() const
Definition: fefly1.cxx:2048
const SwFrameFormat * IsFlyInFly()
Is selected frame within another frame?
Definition: fefly1.cxx:312
const SwFrameFormat * GetFlyFrameFormat() const
Get FlyFrameFormat; for UI macro linkage at Flys.
Definition: fefly1.cxx:1270
void SetVertOrientation(sal_Int16 eOrient)
Definition: frmmgr.cxx:584
void SetAbsPos(const Point &rLPoint)
Definition: frmmgr.cxx:250
const SwFormatFrameSize & GetFrameSize() const
Definition: frmmgr.hxx:151
void SetSize(const Size &rLSize)
Definition: frmmgr.cxx:612
void SetRotation(Degree10 nOld, Degree10 nNew, const Size &rUnrotatedSize)
Definition: frmmgr.cxx:598
RndStdIds GetAnchor() const
Definition: frmmgr.hxx:167
Point GetPos() const
Definition: frmmgr.hxx:163
void SetAttrSet(const SfxItemSet &rSet)
Definition: frmmgr.cxx:619
const Size & GetSize() const
Definition: frmmgr.hxx:138
const SwFormatHoriOrient & GetHoriOrient() const
Definition: frmmgr.hxx:147
const SfxItemSet & GetAttrSet() const
Definition: frmmgr.hxx:124
void UpdateFlyFrame()
Definition: frmmgr.cxx:159
void SetHorzOrientation(sal_Int16 eOrient)
Definition: frmmgr.cxx:577
general base class for all free-flowing frames
Definition: flyfrm.hxx:79
virtual const SwFlyFrameFormat * GetFormat() const override
Definition: fly.cxx:3119
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:67
Connection (text flow) between two FlyFrames.
Definition: fmtcnct.hxx:32
SwFlyFrameFormat * GetPrev() const
Definition: fmtcnct.hxx:53
SwFlyFrameFormat * GetNext() const
Definition: fmtcnct.hxx:54
sal_uInt16 GetGutterWidth(bool bMin=false) const
Definition: atrfrm.cxx:918
sal_uInt16 GetWishWidth() const
Definition: fmtclds.hxx:122
void Init(sal_uInt16 nNumCols, sal_uInt16 nGutterWidth, sal_uInt16 nAct)
This function allows to (repeatedly) initialize the columns.
Definition: atrfrm.cxx:969
sal_uInt8 GetWidthPercent() const
Definition: fmtfsize.hxx:91
SwFrameSize GetHeightSizeType() const
Definition: fmtfsize.hxx:80
sal_uInt8 GetHeightPercent() const
Definition: fmtfsize.hxx:88
Defines the horizontal position of a fly frame.
Definition: fmtornt.hxx:73
void SetPosToggle(bool bNew)
Definition: fmtornt.hxx:103
sal_Int16 GetHoriOrient() const
Definition: fmtornt.hxx:94
bool IsPosToggle() const
Definition: fmtornt.hxx:102
SfxPoolItem subclass that wraps a URL.
Definition: fmturl.hxx:33
const SwFormatChain & GetChain(bool=true) const
Definition: fmtcnct.hxx:70
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
const OUString & GetName() const
Definition: format.hxx:131
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:88
bool IsAutoUpdateOnDirectFormat() const
Query / set m_bAutoUpdateOnDirectFormat-flag.
Definition: format.hxx:188
Style of a layout element.
Definition: frmfmt.hxx:72
void GetState(SfxItemSet &)
Definition: frmsh.cxx:732
void GetDrawAttrStateTextFrame(SfxItemSet &rSet)
Definition: frmsh.cxx:1309
void ExecDrawAttrArgsTextFrame(SfxRequest const &rReq)
Definition: frmsh.cxx:1328
virtual ~SwFrameShell() override
Definition: frmsh.cxx:1073
void GetLineStyleState(SfxItemSet &rSet)
Definition: frmsh.cxx:1268
void StateInsert(SfxItemSet &rSet)
Definition: frmsh.cxx:1295
void ExecFrameStyle(SfxRequest const &rReq)
Definition: frmsh.cxx:1079
void ExecField(const SfxRequest &rReq)
Definition: frmsh.cxx:118
void ExecDrawDlgTextFrame(SfxRequest const &rReq)
Definition: frmsh.cxx:1370
void Execute(SfxRequest &)
Definition: frmsh.cxx:131
void DisableStateTextFrame(SfxItemSet &rSet)
Definition: frmsh.cxx:1426
void ExecMove(SfxRequest &rReq)
Definition: frmsh.cxx:105
SwFrameShell(SwView &rView)
Definition: frmsh.cxx:1062
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
void Height(tools::Long nNew)
Definition: swrect.hxx:193
void Width(tools::Long nNew)
Definition: swrect.hxx:189
const Size & GetUnrotatedSize() const
Definition: grfatr.hxx:108
Degree10 GetValue() const
Definition: grfatr.hxx:109
static void ClearSelection(const SwWrtShell &rSh, const SwFrameShell *pCreator=nullptr)
Definition: swdtflvr.cxx:4382
static void CreateSelection(SwWrtShell &rSh, const SwFrameShell *pCreator=nullptr)
Definition: swdtflvr.cxx:4370
bool IsKeepRatio() const
Definition: viewopt.hxx:699
void SetKeepRatio(bool b)
Definition: viewopt.hxx:718
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:452
SdrView * GetDrawViewWithValidMarkList()
Definition: vnew.cxx:391
SwDoc * GetDoc() const
Definition: viewsh.hxx:308
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:648
SdrView * GetDrawView()
Definition: vnew.cxx:386
Definition: view.hxx:146
SwWrtShell & GetWrtShell() const
Definition: view.hxx:423
void ExecNumberingOutline(SfxItemPool &)
Definition: view0.cxx:734
SwEditWin & GetEditWin()
Definition: view.hxx:426
SwDocShell * GetDocShell()
Definition: view.cxx:1193
void UpdateWordCount(SfxShell *, sal_uInt16)
Definition: view1.cxx:202
void ExecFormatFootnote()
Definition: view0.cxx:727
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
void InsertPostIt(SwFieldMgr &rFieldMgr, const SfxRequest &rReq)
Inserts a new annotation/comment at the current cursor position / selection.
Definition: wrtsh1.cxx:2228
void AutoUpdateFrame(SwFrameFormat *pFormat, const SfxItemSet &rStyleSet)
Definition: wrtsh1.cxx:1945
SelectionType GetSelectionType() const
Definition: wrtsh1.cxx:1723
void EnterStdMode()
Definition: select.cxx:560
void SelAll()
Definition: select.cxx:124
const SwView & GetView() const
Definition: wrtsh.hxx:443
static const OUString & GetContextName(const Context eContext)
#define FN_FRAME_UP
Definition: cmdid.h:401
#define FN_SET_FRM_ALT_NAME
Definition: cmdid.h:891
#define FN_SET_FRM_POSITION
Definition: cmdid.h:372
#define FN_FRAME_MIRROR_ON_EVEN_PAGES
Definition: cmdid.h:492
#define FN_FRAME_ALIGN_VERT_CHAR_TOP
Definition: cmdid.h:441
#define FN_SET_FRM_NAME
Definition: cmdid.h:888
#define FN_FORMAT_FRAME_DLG
Definition: cmdid.h:353
#define FN_FRAME_ALIGN_VERT_BOTTOM
Definition: cmdid.h:369
#define FN_POSTIT
Definition: cmdid.h:233
#define FN_GET_PRINT_AREA
Definition: cmdid.h:773
#define FN_INSERT_FRAME
Definition: cmdid.h:238
#define FN_PARAM_CHAIN_PREVIOUS
Definition: cmdid.h:851
#define FN_FRAME_UNCHAIN
Definition: cmdid.h:487
#define FN_OLE_IS_MATH
Definition: cmdid.h:653
#define FN_FORMAT_FOOTNOTE_DLG
Definition: cmdid.h:358
#define FN_FRAME_ALIGN_VERT_ROW_TOP
Definition: cmdid.h:437
#define FN_FRAME_ALIGN_VERT_CHAR_CENTER
Definition: cmdid.h:443
#define FN_FRAME_DOWN
Definition: cmdid.h:402
#define FN_FRAME_ALIGN_VERT_ROW_BOTTOM
Definition: cmdid.h:438
#define FN_TITLE_DESCRIPTION_SHAPE
Definition: cmdid.h:475
#define FN_FORMAT_GRAFIC_DLG
Definition: cmdid.h:354
#define FN_KEEP_ASPECT_RATIO
Definition: cmdid.h:889
#define FN_FRAME_CHAIN
Definition: cmdid.h:486
#define FN_FRAME_ALIGN_HORZ_LEFT
Definition: cmdid.h:365
#define FN_DRAW_WRAP_DLG
Definition: cmdid.h:155
#define FN_NAME_SHAPE
Definition: cmdid.h:473
#define FN_MATH_BASELINE_ALIGNMENT
Definition: cmdid.h:654
#define FN_FRAME_ALIGN_HORZ_CENTER
Definition: cmdid.h:367
#define FN_NUMBERING_OUTLINE_DLG
Definition: cmdid.h:522
#define FN_FRAME_ALIGN_VERT_CENTER
Definition: cmdid.h:370
#define FN_WORDCOUNT_DIALOG
Definition: cmdid.h:627
#define FN_FRAME_TO_ANCHOR
Definition: cmdid.h:734
#define FN_FRAME_ALIGN_HORZ_RIGHT
Definition: cmdid.h:366
#define FN_FRAME_ALIGN_VERT_ROW_CENTER
Definition: cmdid.h:439
#define FN_PARAM_CHAIN_NEXT
Definition: cmdid.h:852
#define FN_FRAME_ALIGN_VERT_TOP
Definition: cmdid.h:368
#define FN_UNO_DESCRIPTION
Definition: cmdid.h:893
#define FN_SURROUND
Definition: cmdid.h:885
#define FN_FRAME_ALIGN_VERT_CHAR_BOTTOM
Definition: cmdid.h:442
int nCount
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Definition: dialoghelp.cxx:19
URL aURL
@ Page
Rect of current page.
@ FlyEmbedded
Rect of current FlyFrame.
@ PagePrt
Rect of current PrtArea of page.
FrameTypeFlags
values can be combined via logical or
Definition: fesh.hxx:63
FlyProtectFlags
values can be combined via logical or
Definition: fesh.hxx:106
@ Parent
Check only parents.
FilterGroup & rTarget
FieldUnit
@ FLYCNTTYPE_FRM
Definition: flyenum.hxx:26
@ Fixed
Frame cannot be moved in Var-direction.
@ Variable
Frame is variable in Var-direction.
OUString sName
static void lcl_FrameGetMaxLineWidth(const SvxBorderLine *pBorderLine, SvxBorderLine &rBorderLine)
Definition: frmsh.cxx:1259
static const SwFrameFormat * lcl_GetFrameFormatByName(SwWrtShell const &rSh, std::u16string_view rName)
Definition: frmsh.cxx:84
SelectionType
constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END)
constexpr TypedWhichId< SwFormatURL > RES_URL(117)
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
constexpr TypedWhichId< SwFormatCol > RES_COL(115)
constexpr TypedWhichId< SwFormatHoriOrient > RES_HORI_ORIENT(109)
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(108)
constexpr sal_uInt16 RES_FRMATR_END(141)
constexpr TypedWhichId< SvxOpaqueItem > RES_OPAQUE(105)
constexpr TypedWhichId< SvxProtectItem > RES_PROTECT(106)
constexpr TypedWhichId< SwFormatAnchor > RES_ANCHOR(110)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(112)
constexpr TypedWhichId< SwRotationGrf > RES_GRFATR_ROTATION(143)
constexpr TypedWhichId< SwFormatSurround > RES_SURROUND(107)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(97)
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(98)
constexpr TypedWhichId< SvxPrintItem > RES_PRINT(104)
const SfxPoolItem * GetDfltAttr(sal_uInt16 nWhich)
Get the default attribute from corresponding default attribute table.
Definition: hints.cxx:147
SvxLinkInsertMode
HLINK_HTMLMODE
OUString aName
#define SAL_WARN_IF(condition, area, stream)
int i
Sequence< beans::PropertyValue > GetCommandProperties(const OUString &rsCommandName, const OUString &rsModuleName)
OUString GetModuleIdentifier(const Reference< frame::XFrame > &rxFrame)
OUString GetLabelForCommand(const css::uno::Sequence< css::beans::PropertyValue > &rProperties)
#define SFX_OBJECTBAR_OBJECT
static SfxItemSet & rSet
#define SFX_IMPL_INTERFACE(Class, SuperClass)
RndStdIds
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:168
#define SW_MOD()
Definition: swmodule.hxx:254
constexpr SwTwips MIN_BORDER_DIST
Definition: swtypes.hxx:70
SvxBoxItem & rBoxItem
SW_DLLPUBLIC FieldUnit GetDfltMetric(bool bWeb)
Definition: uitool.cxx:756
RET_OK
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)
Definition: viewopt.cxx:415
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLUSESLIDEBACKGROUND)