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