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