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