LibreOffice Module sw (master)  1
basesh.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 #include <config_fuzzers.h>
22 
23 #include <sal/config.h>
24 
25 #include <hintids.hxx>
27 #include <svl/languageoptions.hxx>
28 #include <sfx2/linkmgr.hxx>
29 #include <sfx2/htmlmode.hxx>
30 #include <svx/imapdlg.hxx>
31 #include <sfx2/dispatch.hxx>
32 #include <sfx2/viewfrm.hxx>
33 #include <sfx2/request.hxx>
34 #include <svl/whiter.hxx>
35 #include <svl/visitem.hxx>
36 #include <editeng/langitem.hxx>
37 #include <svx/clipfmtitem.hxx>
38 #include <svx/contdlg.hxx>
39 #include <vcl/graph.hxx>
40 #include <vcl/inputctx.hxx>
41 #include <svl/slstitm.hxx>
42 #include <svl/ptitem.hxx>
43 #include <svl/stritem.hxx>
44 #include <editeng/colritem.hxx>
45 #include <editeng/fhgtitem.hxx>
46 #include <editeng/fontitem.hxx>
47 #include <editeng/shaditem.hxx>
48 #include <editeng/boxitem.hxx>
49 #include <editeng/brushitem.hxx>
50 #include <editeng/opaqitem.hxx>
51 #include <editeng/sizeitem.hxx>
52 #include <svx/flagsdef.hxx>
54 #include <sfx2/objface.hxx>
55 #include <fmturl.hxx>
56 #include <fmthdft.hxx>
57 #include <fmtclds.hxx>
58 #include <docsh.hxx>
59 #include <wrtsh.hxx>
60 #include <view.hxx>
61 #include <swmodule.hxx>
62 #include <swundo.hxx>
63 #include <fldbas.hxx>
64 #include <uitool.hxx>
65 #include <basesh.hxx>
66 #include <viewopt.hxx>
67 #include <fontcfg.hxx>
68 #include <fmtsrnd.hxx>
69 #include <fldmgr.hxx>
70 #include <frmmgr.hxx>
71 #include <tablemgr.hxx>
72 #include <mdiexp.hxx>
73 #include <swdtflvr.hxx>
74 #include <pagedesc.hxx>
75 #include <fmtcol.hxx>
76 #include <edtwin.hxx>
77 #include <tblafmt.hxx>
78 #include <swwait.hxx>
79 #include <cmdid.h>
80 #include <strings.hrc>
81 #include <unotxdoc.hxx>
82 #include <doc.hxx>
84 #include <IDocumentUndoRedo.hxx>
85 #include <swabstdlg.hxx>
86 #include <modcfg.hxx>
87 #include <svx/fmshell.hxx>
88 #include <SwRewriter.hxx>
89 #include <GraphicSizeCheck.hxx>
90 #include <svx/galleryitem.hxx>
92 #include <com/sun/star/gallery/GalleryItemType.hpp>
93 #include <memory>
94 
97 #include <comphelper/lok.hxx>
98 #include <osl/diagnose.h>
99 
100 #include <svx/svxdlg.hxx>
101 
102 #include <shellres.hxx>
103 #include <UndoTable.hxx>
104 
105 #include <ndtxt.hxx>
106 #include <UndoManager.hxx>
107 
109 
110 // These variables keep the state of Gallery (slot SID_GALLERY_BG_BRUSH)
111 // detected by GetGalleryState() for the subsequent ExecuteGallery() call.
112 
123 
124 #define ShellClass_SwBaseShell
125 #include <sfx2/msg.hxx>
126 #include <swslots.hxx>
127 
128 #include <AccessibilityCheck.hxx>
130 
131 namespace
132 {
133  SvxContourDlg* GetContourDlg(SwView const &rView)
134  {
135  SfxChildWindow *pWnd = rView.GetViewFrame()->GetChildWindow(SvxContourDlgChildWindow::GetChildWindowId());
136  return pWnd ? static_cast<SvxContourDlg*>(pWnd->GetController().get()) : nullptr;
137  }
138 
139  SvxIMapDlg* GetIMapDlg(SwView const &rView)
140  {
141  SfxChildWindow* pWnd = rView.GetViewFrame()->GetChildWindow(SvxIMapDlgChildWindow::GetChildWindowId());
142  return pWnd ? static_cast<SvxIMapDlg*>(pWnd->GetController().get()) : nullptr;
143  }
144 }
145 
146 using namespace ::com::sun::star;
147 using namespace ::com::sun::star::uno;
148 using namespace ::com::sun::star::frame;
149 using namespace ::com::sun::star::lang;
150 
152 
153 void SwBaseShell::InitInterface_Impl()
154 {
155  GetStaticInterface()->RegisterChildWindow(SvxIMapDlgChildWindow::GetChildWindowId());
156  GetStaticInterface()->RegisterChildWindow(SvxContourDlgChildWindow::GetChildWindowId());
157  GetStaticInterface()->RegisterChildWindow(DevelopmentToolChildWindow::GetChildWindowId());
158 }
159 
160 static void lcl_UpdateIMapDlg( SwWrtShell& rSh )
161 {
162  Graphic aGrf( rSh.GetIMapGraphic() );
163  GraphicType nGrfType = aGrf.GetType();
164  void* pEditObj = GraphicType::NONE != nGrfType && GraphicType::Default != nGrfType
165  ? rSh.GetIMapInventor() : nullptr;
166  TargetList aList;
168 
170  rSh.GetFlyFrameAttr( aSet );
171  const SwFormatURL &rURL = aSet.Get( RES_URL );
173  aGrf, rURL.GetMap(), &aList, pEditObj );
174 }
175 
177 {
178  Graphic aGraf( rSh.GetIMapGraphic() );
179  GraphicType nGrfType = aGraf.GetType();
180  bool bRet = GraphicType::NONE != nGrfType && GraphicType::Default != nGrfType;
181  if( bRet )
182  {
183  OUString aGrfName;
184  if ( nSel & SelectionType::Graphic )
185  rSh.GetGrfNms( &aGrfName, nullptr );
186 
187  SvxContourDlg *pDlg = GetContourDlg(rSh.GetView());
188  if (pDlg)
189  {
190  pDlg->Update(aGraf, !aGrfName.isEmpty(),
191  rSh.GetGraphicPolygon(), rSh.GetIMapInventor());
192  }
193  }
194  return bRet;
195 }
196 
198 {
199  SwWrtShell &rSh = GetShell();
200  SwEditWin& rTmpEditWin = GetView().GetEditWin();
201  switch(rReq.GetSlot())
202  {
203  case SID_DELETE:
205  {
206  // Disallow if the cursor is at the end of a paragraph and the document model
207  // node at this position is an outline node with folded content or the next node
208  // is an outline node with folded content.
209  if (rSh.IsEndPara())
210  {
211  SwNodeIndex aIdx(rSh.GetCursor()->GetNode());
212  if (aIdx.GetNode().IsTextNode())
213  {
214  bool bVisible = true;
215  aIdx.GetNode().GetTextNode()->GetAttrOutlineContentVisible(bVisible);
216  if (!bVisible)
217  break;
218  ++aIdx;
219  if (aIdx.GetNode().IsTextNode())
220  {
221  bVisible = true;
222  aIdx.GetNode().GetTextNode()->GetAttrOutlineContentVisible(bVisible);
223  if (!bVisible)
224  break;
225  }
226  }
227  }
228  }
229  rSh.DelRight();
230  break;
231 
232  case FN_BACKSPACE:
234  {
235  // Disallow if the cursor is at the start of a paragraph and the document model
236  // node at this position is an outline node with folded content or the previous
237  // node is a content node without a layout frame.
238  if (rSh.IsSttPara())
239  {
240  SwNodeIndex aIdx(rSh.GetCursor()->GetNode());
241  if (aIdx.GetNode().IsTextNode())
242  {
243  bool bVisible = true;
244  aIdx.GetNode().GetTextNode()->GetAttrOutlineContentVisible(bVisible);
245  if (!bVisible)
246  break;
247  --aIdx;
248  if (aIdx.GetNode().IsContentNode() &&
249  !aIdx.GetNode().GetContentNode()->getLayoutFrame(rSh.GetLayout()))
250  break;
251  }
252  }
253  }
254  if( rSh.IsNoNum() )
255  {
256  rSh.SttCursorMove();
257  bool bLeft = rSh.Left( CRSR_SKIP_CHARS, true, 1, false );
258  if( bLeft )
259  {
260  rSh.DelLeft();
261  }
262  else
263  // JP 15.07.96: If it no longer goes forward, cancel
264  // the numbering. For example at the beginning
265  // of a doc, frame, table or an area.
266  rSh.DelNumRules();
267 
268  rSh.EndCursorMove();
269  break;
270  }
271 
272  [[fallthrough]]; // otherwise call DelLeft
273  case FN_SHIFT_BACKSPACE:
274  rSh.DelLeft();
275  break;
276  default:
277  OSL_FAIL("wrong Dispatcher");
278  return;
279  }
280  rReq.Done();
281 
282  //#i42732# - notify the edit window that from now on we do not use the input language
283  rTmpEditWin.SetUseInputLanguage( false );
284 }
285 
287 {
288  // Attention: At risk of suicide!
289  // After paste, paste special the shell can be destroy.
290 
291  SwWrtShell &rSh = GetShell();
292  sal_uInt16 nId = rReq.GetSlot();
293  bool bIgnore = false;
295 
296  switch( nId )
297  {
298  case SID_CUT:
299  case SID_COPY:
301  if ( rSh.HasSelection() )
302  {
303  rtl::Reference<SwTransferable> pTransfer = new SwTransferable( rSh );
304 
306  pTransfer->Cut();
307  else
308  {
309  const bool bLockedView = rSh.IsViewLocked();
310  rSh.LockView( true ); //lock visible section
311  pTransfer->Copy();
312  rSh.LockView( bLockedView );
313  }
314  break;
315  }
316  return;
317 
321  switch ( nId )
322  {
324  ePasteTable = PasteTableType::PASTE_TABLE;
325  break;
327  ePasteTable = PasteTableType::PASTE_ROW;
328  break;
330  ePasteTable = PasteTableType::PASTE_COLUMN;
331  break;
332  default:
333  ;
334  }
335  [[fallthrough]];
336  case SID_PASTE:
337  {
338  TransferableDataHelper aDataHelper(
340  if( aDataHelper.GetXTransferable().is()
341  && SwTransferable::IsPaste( rSh, aDataHelper ) )
342  {
343  // Temporary variables, because the shell could already be
344  // destroyed after the paste.
345  SwView* pView = &m_rView;
346 
347  RndStdIds nAnchorType = RndStdIds::FLY_AT_PARA;
348  const SfxUInt16Item* pAnchorType = rReq.GetArg<SfxUInt16Item>(FN_PARAM_1);
349  if (pAnchorType)
350  nAnchorType = static_cast<RndStdIds>(pAnchorType->GetValue());
351  bool bIgnoreComments = false;
352  const SfxBoolItem* pIgnoreComments = rReq.GetArg<SfxBoolItem>(FN_PARAM_2);
353  if (pIgnoreComments)
354  bIgnoreComments = pIgnoreComments->GetValue();
355  SwTransferable::Paste(rSh, aDataHelper, nAnchorType, bIgnoreComments, ePasteTable);
356 
357  if( rSh.IsFrameSelected() || rSh.IsObjSelected() )
358  rSh.EnterSelFrameMode();
359  pView->AttrChangedNotify(nullptr);
360 
361  // Fold pasted outlines that have outline content visible attribute false
363  }
364  else
365  return;
366  }
367  break;
368 
369  case SID_CLIPBOARD_FORMAT_ITEMS:
370  {
371  const SfxItemSet* pArgs = rReq.GetArgs();
372  const SfxPoolItem* pFormat;
373  if( pArgs && SfxItemState::SET == pArgs->GetItemState( nId, false, &pFormat ) )
374  {
375  TransferableDataHelper aDataHelper(
377  &rSh.GetView().GetEditWin()) );
378  if( aDataHelper.GetXTransferable().is()
379  /*&& SwTransferable::IsPaste( rSh, aDataHelper )*/ )
380  {
381  // Temporary variables, because the shell could already be
382  // destroyed after the paste.
383  SwView* pView = &m_rView;
384 
385  SwTransferable::PasteFormat( rSh, aDataHelper,
386  static_cast<SotClipboardFormatId>(static_cast<const SfxUInt32Item*>(pFormat)->GetValue()) );
387 
388  //Done() has to be called before the shell has been removed
389  rReq.Done();
390  bIgnore = true;
391  if( rSh.IsFrameSelected() || rSh.IsObjSelected())
392  rSh.EnterSelFrameMode();
393  pView->AttrChangedNotify(nullptr);
394 
395  // Fold pasted outlines that have outline content visible attribute false
397  }
398  }
399  }
400  break;
401 
402  case SID_PASTE_UNFORMATTED:
403  {
404  TransferableDataHelper aDataHelper(
406  if( aDataHelper.GetXTransferable().is()
407  && SwTransferable::IsPaste( rSh, aDataHelper ) )
408  {
409  // Temporary variables, because the shell could already be
410  // destroyed after the paste.
411  SwView* pView = &m_rView;
412  rReq.Ignore();
413  bIgnore = true;
414  if(SwTransferable::PasteUnformatted( rSh, aDataHelper ))
415  {
416  SfxViewFrame* pViewFrame = pView->GetViewFrame();
417  uno::Reference< frame::XDispatchRecorder > xRecorder =
418  pViewFrame->GetBindings().GetRecorder();
419  if(xRecorder.is()) {
420  SfxRequest aReq( pViewFrame, SID_CLIPBOARD_FORMAT_ITEMS );
421  aReq.AppendItem( SfxUInt32Item( SID_CLIPBOARD_FORMAT_ITEMS, static_cast<sal_uInt32>(SotClipboardFormatId::STRING) ) );
422  aReq.Done();
423  }
424  }
425 
426  if (rSh.IsFrameSelected() || rSh.IsObjSelected())
427  rSh.EnterSelFrameMode();
428  pView->AttrChangedNotify(nullptr);
429 
430  // Fold pasted outlines that have outline content visible attribute false
432  }
433  else
434  return;
435  }
436  break;
437 
438  case SID_PASTE_SPECIAL:
439  {
440  std::shared_ptr<TransferableDataHelper> aDataHelper =
441  std::make_shared<TransferableDataHelper>(TransferableDataHelper::CreateFromSystemClipboard( &rSh.GetView().GetEditWin()));
442 
443  if( aDataHelper->GetXTransferable().is()
444  && SwTransferable::IsPaste( rSh, *aDataHelper )
445  && !rSh.CursorInsideInputField() )
446  {
447  rReq.Ignore();
448  bIgnore = true;
449 
451  VclPtr<SfxAbstractPasteDialog> pDlg(pFact->CreatePasteDialog( rReq.GetFrameWeld() ));
452 
453  // Prepare the dialog
454  SwTransferable::PrePasteSpecial(rSh, *aDataHelper, pDlg);
455  pDlg->PreGetFormat(*aDataHelper);
456 
457 
458  pDlg->StartExecuteAsync([aDataHelper, pDlg, &rSh, this](sal_Int32 nResult){
459  if (nResult == RET_OK)
460  {
461  // Temporary variables, because the shell could already be
462  // destroyed after the paste.
463  SwView* pView = &m_rView;
464  bool bRet = false;
465  SotClipboardFormatId nFormatId = pDlg->GetFormatOnly();
466 
467  if( nFormatId != SotClipboardFormatId::NONE )
468  bRet = SwTransferable::PasteFormat( rSh, *aDataHelper, nFormatId );
469 
470  if (bRet)
471  {
472  SfxViewFrame* pViewFrame = pView->GetViewFrame();
473  uno::Reference< frame::XDispatchRecorder > xRecorder =
474  pViewFrame->GetBindings().GetRecorder();
475  if(xRecorder.is()) {
476  SfxRequest aReq( pViewFrame, SID_CLIPBOARD_FORMAT_ITEMS );
477  aReq.AppendItem( SfxUInt32Item( SID_CLIPBOARD_FORMAT_ITEMS, static_cast<sal_uInt32>(nFormatId) ) );
478  aReq.Done();
479  }
480  }
481 
482  if (rSh.IsFrameSelected() || rSh.IsObjSelected())
483  rSh.EnterSelFrameMode();
484  pView->AttrChangedNotify(nullptr);
485 
486  // Fold pasted outlines that have outline content visible attribute false
488  }
489 
490  pDlg->disposeOnce();
491 
492  });
493  }
494  else
495  return;
496  }
497  break;
498 
499  default:
500  OSL_FAIL("wrong Dispatcher");
501  return;
502  }
503  if(!bIgnore)
504  rReq.Done();
505 }
506 
507 // ClipBoard state
508 
510 {
511  SwWrtShell &rSh = GetShell();
512  SfxWhichIter aIter(rSet);
513 
514  const bool bCopy = rSh.HasSelection();
515 
516  sal_uInt16 nWhich = aIter.FirstWhich();
517 
518  while(nWhich)
519  {
520  switch(nWhich)
521  {
522  case SID_CUT:
524  {
525  rSet.DisableItem( nWhich );
526  break;
527  }
528  [[fallthrough]];
529  case SID_COPY:
530  if( !bCopy || GetObjectShell()->isContentExtractionLocked())
531  rSet.DisableItem( nWhich );
532  break;
533 
537  if( !rSh.IsCursorInTable()
539  || rSh.CursorInsideInputField()
540  // disable if not a native Writer table and not a spreadsheet format
542  {
543  rSet.DisableItem( nWhich );
544  }
545  break;
546 
547  case SID_PASTE:
548  if( !GetView().IsPasteAllowed() )
549  {
550  rSet.DisableItem( nWhich );
551  }
552  break;
553 
554  case SID_PASTE_SPECIAL:
555  if( !GetView().IsPasteSpecialAllowed()
556  || rSh.CursorInsideInputField() )
557  {
558  rSet.DisableItem( nWhich );
559  }
560  break;
561 
562  case SID_PASTE_UNFORMATTED:
563  if( !GetView().IsPasteSpecialAllowed() )
564  {
565  rSet.DisableItem( nWhich );
566  }
567  break;
568 
569  case SID_CLIPBOARD_FORMAT_ITEMS:
570  {
571  TransferableDataHelper aDataHelper(
573  &rSh.GetView().GetEditWin()) );
574 
575  SvxClipboardFormatItem aFormatItem( SID_CLIPBOARD_FORMAT_ITEMS );
576  SwTransferable::FillClipFormatItem( rSh, aDataHelper, aFormatItem );
577  rSet.Put( aFormatItem );
578  }
579  break;
580  }
581  nWhich = aIter.NextWhich();
582  }
583 }
584 
585 // Perform undo
586 
588 {
590 
591  SwWrtShell &rWrtShell = GetShell();
592 
593  SwUndoId nUndoId(SwUndoId::EMPTY);
594  sal_uInt16 nId = rReq.GetSlot(), nCnt = 1;
595  const SfxItemSet* pArgs = rReq.GetArgs();
596  const SfxPoolItem* pItem;
597  if( pArgs && SfxItemState::SET == pArgs->GetItemState( nId, false, &pItem ))
598  nCnt = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
599 
600  // Repair mode: allow undo/redo of all undo actions, even if access would
601  // be limited based on the view shell ID.
602  bool bRepair = false;
603  const SfxBoolItem* pRepairItem;
604  if (pArgs && (pRepairItem = pArgs->GetItemIfSet(SID_REPAIRPACKAGE, false)))
605  bRepair = pRepairItem->GetValue();
606 
607  // #i106349#: save pointer: undo/redo may delete the shell, i.e., this!
608  SfxViewFrame *const pViewFrame( GetView().GetViewFrame() );
609 
610  IDocumentUndoRedo& rUndoRedo = rWrtShell.GetIDocumentUndoRedo();
611  bool bWasRepair = rUndoRedo.DoesRepair();
612  rUndoRedo.DoRepair(bRepair);
613  comphelper::ScopeGuard aGuard([&rUndoRedo, bWasRepair]()
614  {
615  rUndoRedo.DoRepair(bWasRepair);
616  });
617 
618  switch( nId )
619  {
620  case SID_UNDO:
621  if (rUndoRedo.GetLastUndoInfo(nullptr, &nUndoId, &rWrtShell.GetView()))
622  {
623  for (SwViewShell& rShell : rWrtShell.GetRingContainer())
624  rShell.LockPaint();
625 
626  sal_uInt16 nUndoOffset = 0;
627  if (comphelper::LibreOfficeKit::isActive() && !bRepair && nCnt == 1)
628  {
629  sw::UndoManager& rManager = rWrtShell.GetDoc()->GetUndoManager();
630  const SfxUndoAction* pAction = rManager.GetUndoAction();
631  SwView& rView = rWrtShell.GetView();
632  ViewShellId nViewShellId = rView.GetViewShellId();
633  sal_uInt16 nOffset = 0;
634  if (pAction->GetViewShellId() != nViewShellId
635  && rManager.IsViewUndoActionIndependent(&rView, nOffset))
636  {
637  // Execute the undo with an offset: don't undo the top action, but an
638  // earlier one, since it's independent and that belongs to our view.
639  nUndoOffset += nOffset;
640  }
641  }
642 
643  rWrtShell.Do(SwWrtShell::UNDO, nCnt, nUndoOffset);
644 
645  for (SwViewShell& rShell : rWrtShell.GetRingContainer())
646  rShell.UnlockPaint();
647 
648  // tdf#141613 FIXME: Disable redoing header/footer changes for now.
649  // The proper solution would be to write a SwUndoHeaderFooter class
650  // to represent the addition of a header or footer to the current page.
651  if (nUndoId == SwUndoId::HEADER_FOOTER)
652  rUndoRedo.ClearRedo();
653  }
654  break;
655 
656  case SID_REDO:
657  if (rUndoRedo.GetFirstRedoInfo(nullptr, &nUndoId, &rWrtShell.GetView()))
658  {
659  for (SwViewShell& rShell : rWrtShell.GetRingContainer())
660  rShell.LockPaint();
661  rWrtShell.Do( SwWrtShell::REDO, nCnt );
662  for (SwViewShell& rShell : rWrtShell.GetRingContainer())
663  rShell.UnlockPaint();
664  }
665  break;
666 
667  case SID_REPEAT:
668  rWrtShell.Do( SwWrtShell::REPEAT );
669  break;
670  default:
671  OSL_FAIL("wrong Dispatcher");
672  }
673 
674  if (nUndoId == SwUndoId::CONFLICT)
675  {
676  rReq.SetReturnValue( SfxUInt32Item(nId, static_cast<sal_uInt32>(SID_REPAIRPACKAGE)) );
677  }
678  else if (nUndoId == SwUndoId::INSFMTATTR)
679  {
680  rWrtShell.GetDoc()->GetDocShell()->GetStyleSheetPool()->Broadcast(SfxHint(SfxHintId::StyleSheetModified));
681  }
682 
683  if (pViewFrame) { pViewFrame->GetBindings().InvalidateAll(false); }
684 }
685 
686 // State of undo
687 
689 {
690  SwUndoId nUndoId(SwUndoId::EMPTY);
691  SwWrtShell &rSh = GetShell();
692  SfxWhichIter aIter(rSet);
693  sal_uInt16 nWhich = aIter.FirstWhich();
694  while(nWhich)
695  {
696  switch(nWhich)
697  {
698  case SID_UNDO:
699  {
700  if (rSh.GetLastUndoInfo(nullptr, &nUndoId, &rSh.GetView()))
701  {
702  rSet.Put( SfxStringItem(nWhich,
704  }
705  else if (nUndoId == SwUndoId::CONFLICT)
706  {
707  rSet.Put( SfxUInt32Item(nWhich, static_cast<sal_uInt32>(SID_REPAIRPACKAGE)) );
708  }
709  else
710  rSet.DisableItem(nWhich);
711 
712  break;
713  }
714  case SID_REDO:
715  {
716  if (rSh.GetFirstRedoInfo(nullptr, &nUndoId, &rSh.GetView()))
717  {
718  rSet.Put(SfxStringItem(nWhich,
720  }
721  else if (nUndoId == SwUndoId::CONFLICT)
722  {
723  rSet.Put( SfxInt32Item(nWhich, static_cast<sal_uInt32>(SID_REPAIRPACKAGE)) );
724  }
725  else
726  rSet.DisableItem(nWhich);
727  break;
728  }
729  case SID_REPEAT:
730  { // Repeat is only possible if no REDO is possible - UI-Restriction
731  if ((!rSh.GetFirstRedoInfo(nullptr, nullptr)) &&
732  !rSh.IsSelFrameMode() &&
733  (SwUndoId::EMPTY != rSh.GetRepeatInfo(nullptr)))
734  {
735  rSet.Put(SfxStringItem(nWhich, rSh.GetRepeatString()));
736  }
737  else
738  rSet.DisableItem(nWhich);
739  break;
740  }
741 
742  case SID_GETUNDOSTRINGS:
743  if (rSh.GetLastUndoInfo(nullptr, nullptr))
744  {
745  SfxStringListItem aStrLst( nWhich );
746  rSh.GetDoStrings( SwWrtShell::UNDO, aStrLst );
747  rSet.Put( aStrLst );
748  }
749  else
750  rSet.DisableItem( nWhich );
751  break;
752 
753  case SID_GETREDOSTRINGS:
754  if (rSh.GetFirstRedoInfo(nullptr, nullptr))
755  {
756  SfxStringListItem aStrLst( nWhich );
757  rSh.GetDoStrings( SwWrtShell::REDO, aStrLst );
758  rSet.Put( aStrLst );
759  }
760  else
761  rSet.DisableItem( nWhich );
762  break;
763  }
764  nWhich = aIter.NextWhich();
765  }
766 }
767 
768 // Evaluate respectively dispatching the slot Id
769 
771 {
772  const SfxPoolItem *pItem;
773  SwWrtShell &rSh = GetShell();
774  const SfxItemSet* pArgs = rReq.GetArgs();
775  bool bMore = false;
776 
777  sal_uInt16 nSlot = rReq.GetSlot();
778  switch(nSlot)
779  {
780  case FN_REPAGINATE:
781  {
782  Reference < XModel > xModel = GetView().GetDocShell()->GetModel();
783  auto pDoc = comphelper::getFromUnoTunnel<SwXTextDocument>(xModel);
784  pDoc->NotifyRefreshListeners();
785  rSh.CalcLayout();
786  }
787  break;
788  case FN_UPDATE_FIELDS:
789  {
790  rSh.UpdateDocStat();
791  rSh.EndAllTableBoxEdit();
792  rSh.SwViewShell::UpdateFields(true);
793 
794  if( rSh.IsCursorInTable() )
795  {
796  if( !rSh.IsTableComplexForChart() )
797  SwTableFUNC( &rSh ).UpdateChart();
798  rSh.ClearTableBoxContent();
799  rSh.SaveTableBoxContent();
800  }
801  }
802  break;
803  case FN_UPDATE_CHARTS:
804  {
805  SwWait aWait( *m_rView.GetDocShell(), true );
806  rSh.UpdateAllCharts();
807  }
808  break;
809 
810  case FN_UPDATE_ALL:
811  {
812  comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer
814  rEmbeddedObjectContainer.setUserAllowsLinkUpdate(true);
815 
816  SwView& rTempView = GetView();
817  rSh.EnterStdMode();
818  if( !rSh.GetLinkManager().GetLinks().empty() )
819  {
820  rSh.StartAllAction();
821  rSh.GetLinkManager().UpdateAllLinks( false, true, nullptr );
822  rSh.EndAllAction();
823  }
824  SfxDispatcher &rDis = *rTempView.GetViewFrame()->GetDispatcher();
825  rDis.Execute( FN_UPDATE_FIELDS );
826  rDis.Execute( FN_UPDATE_TOX );
827  rDis.Execute( FN_UPDATE_CHARTS );
828  rSh.Reformat();
830  }
831  break;
832 
834  rSh.UpdateInputFields();
835  break;
836 
837  case FN_PREV_BOOKMARK:
838  rReq.SetReturnValue(SfxBoolItem( nSlot, rSh.GoPrevBookmark()));
839  break;
840  case FN_NEXT_BOOKMARK:
841  rReq.SetReturnValue(SfxBoolItem( nSlot, rSh.GoNextBookmark()));
842  break;
843 
844  case FN_GOTO_NEXT_MARK:
845  case FN_GOTO_PREV_MARK:
846  {
847  SwFieldMgr aFieldMgr;
848  SwFieldType* pFieldType = aFieldMgr.GetFieldType(SwFieldIds::JumpEdit);
849 
850  if (pFieldType)
851  {
852  if (rSh.IsSelFrameMode())
853  {
854  rSh.UnSelectFrame();
855  rSh.LeaveSelFrameMode();
856  }
857 
858  if (rSh.HasMark())
859  {
860  SwMvContext aMvContext(&rSh);
861  if (rSh.IsCursorPtAtEnd())
862  rSh.SwapPam();
863  rSh.ClearMark();
864  rSh.EndSelect();
865  }
866  bool bRet = rSh.MoveFieldType( pFieldType, nSlot == FN_GOTO_NEXT_MARK );
867  SwField* pCurField = bRet ? rSh.GetCurField() : nullptr;
868  if (pCurField)
869  rSh.ClickToField(*pCurField, /*bExecHyperlinks=*/false);
870  rReq.SetReturnValue(SfxBoolItem( nSlot, bRet));
871  }
872  }
873  break;
874 
875  case FN_START_DOC_DIRECT:
876  case FN_END_DOC_DIRECT:
877  {
878  if (rSh.IsSelFrameMode())
879  {
880  rSh.UnSelectFrame();
881  rSh.LeaveSelFrameMode();
882  }
883  rSh.EnterStdMode();
884  nSlot == FN_START_DOC_DIRECT ?
885  rSh.SttEndDoc(true) :
886  rSh.SttEndDoc(false);
887  }
888  break;
889  case FN_GOTO_PREV_OBJ:
890  case FN_GOTO_NEXT_OBJ:
891  {
892  bool bSuccess = rSh.GotoObj( nSlot == FN_GOTO_NEXT_OBJ );
893  rReq.SetReturnValue(SfxBoolItem(nSlot, bSuccess));
894  if (bSuccess && !rSh.IsSelFrameMode())
895  {
896  rSh.HideCursor();
897  rSh.EnterSelFrameMode();
898  GetView().AttrChangedNotify(nullptr);
899  }
900  }
901  break;
902  case SID_GALLERY_FORMATS:
903  {
904  const SvxGalleryItem* pGalleryItem = SfxItemSet::GetItem<SvxGalleryItem>(pArgs, SID_GALLERY_FORMATS, false);
905  if ( !pGalleryItem )
906  break;
907 
908  const SelectionType nSelType = rSh.GetSelectionType();
909  sal_Int8 nGalleryItemType( pGalleryItem->GetType() );
910 
911  if ( (!rSh.IsSelFrameMode() || nSelType & SelectionType::Graphic) &&
912  nGalleryItemType == css::gallery::GalleryItemType::GRAPHIC )
913  {
914  SwWait aWait( *m_rView.GetDocShell(), true );
915 
916  OUString aGrfName, aFltName;
917  const Graphic aGrf( pGalleryItem->GetGraphic() );
918 
919  if ( nSelType & SelectionType::Graphic )
920  rSh.ReRead( aGrfName, aFltName, &aGrf );
921  else
922  rSh.InsertGraphic( aGrfName, aFltName, aGrf );
923 
925  }
926  else if(!rSh.IsSelFrameMode() &&
927  nGalleryItemType == css::gallery::GalleryItemType::MEDIA )
928  {
929  const SfxStringItem aMediaURLItem( SID_INSERT_AVMEDIA, pGalleryItem->GetURL() );
931  SID_INSERT_AVMEDIA, SfxCallMode::SYNCHRON,
932  { &aMediaURLItem });
933  }
934  }
935  break;
937  {
938  if (pArgs)
939  {
940  // Determine the current PageDescriptor and fill the set with that.
941  const size_t nCurIdx = rSh.GetCurPageDesc();
942  SwPageDesc aPageDesc(rSh.GetPageDesc(nCurIdx));
943 
944  SwFrameFormat &rFormat = aPageDesc.GetMaster();
945 
946  SwFormatCol aFormatCol = rFormat.GetCol();
947 
948  sal_uInt16 nCount;
949  if(SfxItemState::SET == pArgs->GetItemState(nSlot))
950  nCount = static_cast<const SfxUInt16Item &>(pArgs->Get(nSlot)).GetValue();
951  else
952  nCount = pArgs->Get(SID_ATTR_COLUMNS).GetValue();
953  sal_uInt16 nGutterWidth = DEF_GUTTER_WIDTH;
954 
955  aFormatCol.Init(nCount ? nCount : 1, nGutterWidth, USHRT_MAX);
956  aFormatCol.SetWishWidth(USHRT_MAX);
957  aFormatCol.SetGutterWidth(nGutterWidth, USHRT_MAX);
958 
959  rFormat.SetFormatAttr(aFormatCol);
960 
961  rSh.ChgPageDesc(nCurIdx, aPageDesc);
962  }
963  else
965  }
966  break;
970  {
971  sal_Unicode cDelim = 0;
972  bool bToTable = false;
973  if( nSlot == FN_CONVERT_TEXT_TO_TABLE ||
974  ( nSlot == FN_CONVERT_TEXT_TABLE && nullptr == rSh.GetTableFormat() ))
975  bToTable = true;
976  SwInsertTableOptions aInsTableOpts( SwInsertTableFlags::All, 1 );
977  SwTableAutoFormat const* pTAFormat = nullptr;
978  std::unique_ptr<SwTableAutoFormatTable> pAutoFormatTable;
979  bool bDeleteFormat = true;
980  if(pArgs && SfxItemState::SET == pArgs->GetItemState( FN_PARAM_1, true, &pItem))
981  {
982  aInsTableOpts.mnInsMode = SwInsertTableFlags::NONE;
983  // Delimiter
984  OUString sDelim = static_cast< const SfxStringItem* >(pItem)->GetValue();
985  if(!sDelim.isEmpty())
986  cDelim = sDelim[0];
987  // AutoFormat
988  if(SfxItemState::SET == pArgs->GetItemState( FN_PARAM_2, true, &pItem))
989  {
990  OUString sAutoFormat = static_cast< const SfxStringItem* >(pItem)->GetValue();
991 
992  pAutoFormatTable.reset(new SwTableAutoFormatTable);
993  pAutoFormatTable->Load();
994 
995  for( sal_uInt16 i = 0, nCount = pAutoFormatTable->size(); i < nCount; i++ )
996  {
997  SwTableAutoFormat const*const pFormat = &(*pAutoFormatTable)[ i ];
998  if( pFormat->GetName() == sAutoFormat )
999  {
1000  pTAFormat = pFormat;
1001  bDeleteFormat = false;
1002  break;
1003  }
1004  }
1005  }
1006  //WithHeader
1007  if(SfxItemState::SET == pArgs->GetItemState( FN_PARAM_3, true, &pItem) &&
1008  static_cast< const SfxBoolItem* >(pItem)->GetValue())
1009  aInsTableOpts.mnInsMode |= SwInsertTableFlags::Headline;
1010  // RepeatHeaderLines
1011  if(SfxItemState::SET == pArgs->GetItemState( FN_PARAM_4, true, &pItem))
1012  aInsTableOpts.mnRowsToRepeat =
1013  o3tl::narrowing<sal_uInt16>(static_cast< const SfxInt16Item* >(pItem)->GetValue());
1014  //WithBorder
1015  if(SfxItemState::SET == pArgs->GetItemState( FN_PARAM_5, true, &pItem) &&
1016  static_cast< const SfxBoolItem* >(pItem)->GetValue())
1018  //DontSplitTable
1019  if(SfxItemState::SET == pArgs->GetItemState( FN_PARAM_6, true, &pItem) &&
1020  !static_cast< const SfxBoolItem* >(pItem)->GetValue() )
1021  aInsTableOpts.mnInsMode |= SwInsertTableFlags::SplitLayout;
1022  }
1023  else
1024  {
1027  if( RET_OK == pDlg->Execute() )
1028  {
1029  pDlg->GetValues( cDelim, aInsTableOpts, pTAFormat );
1030 
1031  }
1032  }
1033 
1034  if( cDelim )
1035  {
1036  //Shell change!
1037  SwView& rSaveView = m_rView;
1038  bool bInserted = false;
1039  //recording:
1040  SfxViewFrame* pViewFrame = GetView().GetViewFrame();
1041  if( SfxRequest::HasMacroRecorder(pViewFrame) )
1042  {
1043  SfxRequest aReq( pViewFrame, nSlot);
1044  aReq.AppendItem( SfxStringItem( FN_PARAM_1, OUString(cDelim) ));
1045  if(bToTable)
1046  {
1047  if(pTAFormat)
1048  aReq.AppendItem( SfxStringItem( FN_PARAM_2, pTAFormat->GetName()));
1049  aReq.AppendItem( SfxBoolItem ( FN_PARAM_3, bool(aInsTableOpts.mnInsMode & SwInsertTableFlags::Headline)));
1050  aReq.AppendItem( SfxInt16Item( FN_PARAM_4, static_cast<short>(aInsTableOpts.mnRowsToRepeat) ));
1051  aReq.AppendItem( SfxBoolItem ( FN_PARAM_5, bool(aInsTableOpts.mnInsMode & SwInsertTableFlags::DefaultBorder) ));
1052  aReq.AppendItem( SfxBoolItem ( FN_PARAM_6, !(aInsTableOpts.mnInsMode & SwInsertTableFlags::SplitLayout)));
1053  }
1054  aReq.Done();
1055  }
1056 
1057  if( !bToTable )
1058  rSh.TableToText( cDelim );
1059  else
1060  {
1061  bInserted = rSh.TextToTable( aInsTableOpts, cDelim, pTAFormat );
1062  }
1063  rSh.EnterStdMode();
1064 
1065  if( bInserted )
1066  rSaveView.AutoCaption( TABLE_CAP );
1067  }
1068  if(bDeleteFormat)
1069  delete pTAFormat;
1070  }
1071  break;
1072  case SID_STYLE_WATERCAN:
1073  case SID_STYLE_UPDATE_BY_EXAMPLE:
1074  case SID_STYLE_NEW_BY_EXAMPLE:
1075  case SID_STYLE_APPLY:
1076  {
1078  if ( ShellMode::Draw != eMode &&
1079  ShellMode::DrawForm != eMode &&
1080  ShellMode::DrawText != eMode &&
1081  ShellMode::Bezier != eMode )
1082  {
1083  // oj #107754#
1084  if ( SID_STYLE_WATERCAN == nSlot )
1085  {
1086  const bool bLockedView = rSh.IsViewLocked();
1087  rSh.LockView( true ); //lock visible section
1088 
1089  GetView().GetDocShell()->ExecStyleSheet(rReq);
1090 
1091  rSh.LockView( bLockedView );
1092  }
1093  else
1094  // Will be recorded from the DocShell
1095  GetView().GetDocShell()->ExecStyleSheet(rReq);
1096  }
1097  }
1098  break;
1099  case SID_CLASSIFICATION_APPLY:
1100  {
1101  GetView().GetDocShell()->Execute(rReq);
1102  }
1103  break;
1104  case SID_CLASSIFICATION_DIALOG:
1105  {
1106  GetView().GetDocShell()->Execute(rReq);
1107  }
1108  break;
1109  case SID_PARAGRAPH_SIGN_CLASSIFY_DLG:
1110  {
1111  GetView().GetDocShell()->Execute(rReq);
1112  }
1113  break;
1114  case SID_WATERMARK:
1115  {
1116  GetView().GetDocShell()->Execute(rReq);
1117  }
1118  break;
1119  case FN_ESCAPE:
1120  GetView().ExecuteSlot(rReq);
1121  break;
1122  case SID_IMAP:
1123  {
1124  sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId();
1125 
1126  SfxViewFrame* pVFrame = GetView().GetViewFrame();
1127  pVFrame->ToggleChildWindow( nId );
1128  pVFrame->GetBindings().Invalidate( SID_IMAP );
1129 
1130  if ( pVFrame->HasChildWindow( nId ) && rSh.IsFrameSelected() )
1131  lcl_UpdateIMapDlg( rSh );
1132  }
1133  break;
1134  case SID_IMAP_EXEC:
1135  {
1136  SvxIMapDlg* pDlg = GetIMapDlg(GetView());
1137 
1138  // Check, if the allocation is useful or allowed at all.
1139  if ( rSh.IsFrameSelected() &&
1140  pDlg->GetEditingObject() == rSh.GetIMapInventor() )
1141  {
1143  rSh.GetFlyFrameAttr( aSet );
1144  SwFormatURL aURL( aSet.Get( RES_URL ) );
1145  aURL.SetMap( &pDlg->GetImageMap() );
1146  aSet.Put( aURL );
1147  rSh.SetFlyFrameAttr( aSet );
1148  }
1149  }
1150  break;
1154  {
1155  SwViewOption aViewOption = *rSh.GetViewOptions();
1156  bool bAllInText = FN_SET_TRACKED_CHANGES_IN_TEXT == nSlot;
1157  aViewOption.SetShowChangesInMargin( !bAllInText );
1158  if ( !bAllInText )
1160  rSh.ApplyViewOptions( aViewOption );
1161 
1162  // tdf#140982 restore annotation ranges stored in temporary bookmarks
1163  // (only remove temporary bookmarks during file saving to avoid possible
1164  // conflict with lazy deletion of the bookmarks of the moved tracked deletions)
1165  if ( bAllInText || FN_SET_TRACKED_INSERTIONS_IN_MARGIN == nSlot )
1167  }
1168  break;
1169  case SID_CONTOUR_DLG:
1170  {
1171  sal_uInt16 nId = SvxContourDlgChildWindow::GetChildWindowId();
1172 
1173  SfxViewFrame* pVFrame = GetView().GetViewFrame();
1174  pVFrame->ToggleChildWindow( nId );
1175  pVFrame->GetBindings().Invalidate( SID_CONTOUR_DLG );
1176 
1177  SelectionType nSel = rSh.GetSelectionType();
1178  if ( pVFrame->HasChildWindow( nId ) &&
1180  {
1181  lcl_UpdateContourDlg( rSh, nSel );
1182  }
1183  }
1184  break;
1185  case SID_CONTOUR_EXEC:
1186  {
1187  SvxContourDlg *pDlg = GetContourDlg(GetView());
1188  // Check, if the allocation is useful or allowed at all.
1189  SelectionType nSel = rSh.GetSelectionType();
1191  {
1192  if (pDlg && pDlg->GetEditingObject() == rSh.GetIMapInventor())
1193  {
1194  rSh.StartAction();
1196  rSh.GetFlyFrameAttr( aSet );
1197  SwFormatSurround aSur( aSet.Get( RES_SURROUND ) );
1198  if ( !aSur.IsContour() )
1199  {
1200  aSur.SetContour( true );
1201  if ( aSur.GetSurround() == css::text::WrapTextMode_NONE )
1202  aSur.SetSurround( css::text::WrapTextMode_PARALLEL );
1203  aSet.Put( aSur );
1204  rSh.SetFlyFrameAttr( aSet );
1205  }
1206  const tools::PolyPolygon aPoly( pDlg->GetPolyPolygon() );
1207  rSh.SetGraphicPolygon( &aPoly );
1208  if ( pDlg->IsGraphicChanged() )
1209  rSh.ReRead( OUString(), OUString(), &pDlg->GetGraphic());
1210  rSh.EndAction();
1211  }
1212  }
1213  }
1214  break;
1215  case FN_FRAME_TO_ANCHOR:
1216  {
1217  rSh.GotoFlyAnchor();
1218  rSh.EnterStdMode();
1219  rSh.CallChgLnk();
1220  }
1221  break;
1222  case FN_TOOL_ANCHOR_PAGE:
1224  case FN_TOOL_ANCHOR_CHAR:
1226  case FN_TOOL_ANCHOR_FRAME:
1227  {
1228  RndStdIds eSet = nSlot == FN_TOOL_ANCHOR_PAGE
1229  ? RndStdIds::FLY_AT_PAGE
1230  : nSlot == FN_TOOL_ANCHOR_PARAGRAPH
1231  ? RndStdIds::FLY_AT_PARA
1232  : nSlot == FN_TOOL_ANCHOR_FRAME
1233  ? RndStdIds::FLY_AT_FLY
1234  : nSlot == FN_TOOL_ANCHOR_CHAR
1235  ? RndStdIds::FLY_AS_CHAR
1236  : RndStdIds::FLY_AT_CHAR;
1237  rSh.StartUndo();
1238  if (rSh.IsObjSelected())
1239  rSh.ChgAnchor(eSet);
1240  else if (rSh.IsFrameSelected())
1241  {
1242  SwFormatAnchor aAnc(eSet, rSh.GetPhyPageNum());
1244  rSh.SetFlyFrameAttr(aSet);
1245  }
1246  // if new anchor is 'as char' and it is a Math object and the usual
1247  // pre-conditions are met then align the formula to the baseline of the text
1248  const uno::Reference < embed::XEmbeddedObject > xObj( rSh.GetOleRef() );
1249  const bool bDoMathBaselineAlignment = xObj.is() && SotExchange::IsMath( xObj->getClassID() )
1250  && RndStdIds::FLY_AS_CHAR == eSet && rSh.GetDoc()->getIDocumentSettingAccess().get( DocumentSettingId::MATH_BASELINE_ALIGNMENT );
1251  if (bDoMathBaselineAlignment)
1252  rSh.AlignFormulaToBaseline( xObj );
1253 
1254  sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
1255  if( nHtmlMode )
1256  {
1258  rSh.GetFlyFrameAttr(aSet);
1259 
1260  const SwFormatSurround& rSurround = aSet.Get(RES_SURROUND);
1261  const SwFormatVertOrient& rVert = aSet.Get(RES_VERT_ORIENT);
1262  const SwFormatHoriOrient& rHori = aSet.Get(RES_HORI_ORIENT);
1263  sal_Int16 eVOrient = rVert.GetVertOrient();
1264  sal_Int16 eHOrient = rHori.GetHoriOrient();
1265  css::text::WrapTextMode eSurround = rSurround.GetSurround();
1266 
1267  switch( eSet )
1268  {
1269  case RndStdIds::FLY_AT_FLY:
1270  case RndStdIds::FLY_AT_PAGE:
1271  //Wrap through, left or from left, top, from top
1272  if(eSurround != css::text::WrapTextMode_THROUGH)
1273  aSet.Put(SwFormatSurround(css::text::WrapTextMode_THROUGH));
1274 
1275  if( eVOrient != text::VertOrientation::TOP && eVOrient != text::VertOrientation::NONE)
1276  aSet.Put(SwFormatVertOrient(0, text::VertOrientation::TOP));
1277 
1278  if (eHOrient != text::HoriOrientation::NONE && eHOrient != text::HoriOrientation::LEFT)
1279  aSet.Put(SwFormatHoriOrient(0, text::HoriOrientation::LEFT));
1280  break;
1281 
1282  case RndStdIds::FLY_AT_PARA:
1283  // left, from left, right, top, no wrap, wrap left and right
1284  if (eSurround != css::text::WrapTextMode_LEFT && eSurround != css::text::WrapTextMode_RIGHT)
1285  aSet.Put(SwFormatSurround(css::text::WrapTextMode_LEFT));
1286 
1287  if( eVOrient != text::VertOrientation::TOP)
1288  aSet.Put(SwFormatVertOrient(0, text::VertOrientation::TOP));
1289 
1290  if (eHOrient != text::HoriOrientation::NONE && eHOrient != text::HoriOrientation::LEFT && eHOrient != text::HoriOrientation::RIGHT)
1291  aSet.Put(SwFormatHoriOrient(0, text::HoriOrientation::LEFT));
1292  break;
1293 
1294  case RndStdIds::FLY_AT_CHAR:
1295  // left, from left, right, top, wrap through
1296  if(eSurround != css::text::WrapTextMode_THROUGH)
1297  aSet.Put(SwFormatSurround(css::text::WrapTextMode_THROUGH));
1298 
1299  if( eVOrient != text::VertOrientation::TOP)
1300  aSet.Put(SwFormatVertOrient(0, text::VertOrientation::TOP));
1301 
1302  if (eHOrient != text::HoriOrientation::NONE && eHOrient != text::HoriOrientation::LEFT && eHOrient != text::HoriOrientation::RIGHT)
1303  aSet.Put(SwFormatHoriOrient(0, text::HoriOrientation::LEFT));
1304  break;
1305 
1306  default:
1307  ;
1308  }
1309 
1310  if( aSet.Count() )
1311  rSh.SetFlyFrameAttr( aSet );
1312  }
1313  rSh.EndUndo();
1314 
1315  GetView().GetViewFrame()->GetBindings().Invalidate( SID_ANCHOR_MENU );
1316  }
1317  break;
1318 
1319  case FN_FRAME_NOWRAP:
1320  case FN_FRAME_WRAP:
1321  case FN_FRAME_WRAP_IDEAL:
1322  case FN_FRAME_WRAPTHRU:
1325  case FN_FRAME_WRAP_CONTOUR:
1326  case FN_WRAP_ANCHOR_ONLY:
1327  case FN_FRAME_WRAP_LEFT:
1328  case FN_FRAME_WRAP_RIGHT:
1329  SetWrapMode( nSlot );
1330  break;
1331 
1332  case FN_UPDATE_ALL_LINKS:
1333  {
1334  if( !rSh.GetLinkManager().GetLinks().empty() )
1335  {
1336  rSh.EnterStdMode();
1337  rSh.StartAllAction();
1338  rSh.GetLinkManager().UpdateAllLinks( false, false, nullptr );
1339  rSh.EndAllAction();
1340  }
1341  }
1342  break;
1343 
1344  case FN_XFORMS_DESIGN_MODE:
1345  if (pArgs && pArgs->GetItemState(nSlot, true, &pItem) == SfxItemState::SET)
1346  {
1347  if (const SfxBoolItem* pBoolItem = dynamic_cast<const SfxBoolItem*>(pItem))
1348  {
1349  bool bDesignMode = pBoolItem->GetValue();
1350 
1351  // set from design mode
1352  OSL_ENSURE( GetView().GetFormShell() != nullptr, "form shell?" );
1353  SfxRequest aReq( GetView().GetViewFrame(), SID_FM_DESIGN_MODE );
1354  aReq.AppendItem( SfxBoolItem( SID_FM_DESIGN_MODE, bDesignMode ) );
1355  GetView().GetFormShell()->Execute( aReq );
1356  aReq.Done();
1357 
1358  // also set suitable view options
1359  SwViewOption aViewOption = *rSh.GetViewOptions();
1360  aViewOption.SetFormView( ! bDesignMode );
1361  rSh.ApplyViewOptions( aViewOption );
1362  }
1363  }
1364  break;
1365 
1366  default:
1367  bMore = true;
1368  }
1369 
1370 
1371  if(!bMore || !pArgs)
1372  return;
1373 
1374  pItem = nullptr;
1375  pArgs->GetItemState(GetPool().GetWhich(nSlot), false, &pItem);
1376  if(!pItem)
1377  return;
1378 
1379  switch(nSlot)
1380  {
1381  case SID_ATTR_BRUSH:
1382  case SID_ATTR_BORDER_SHADOW:
1383  case RES_SHADOW:
1384  {
1385  rSh.StartAllAction();
1386  // Table cell(s) selected?
1387  if ( rSh.IsTableMode() )
1388  {
1389  SwFrameFormat *pFormat = rSh.GetTableFormat();
1390  pFormat->SetFormatAttr( *pItem );
1391  }
1392  else if ( rSh.IsFrameSelected() )
1393  {
1394  // Set border attributes via Frame-Manager.
1395  SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE, nullptr );
1396  aMgr.SetAttrSet( *pArgs );
1397  aMgr.UpdateFlyFrame();
1398  }
1399  else
1400  {
1401  rSh.SetAttrSet( *pArgs );
1402  }
1403  rSh.EndAllAction();
1404  }
1405  break;
1411  {
1412  OSL_FAIL("not implemented");
1413  }
1414  break;
1415 
1416  case SID_ATTR_BORDER_OUTER:
1417  {
1418  // Table cell(s) selected?
1419  if ( rSh.IsTableMode() )
1420  {
1421  // Set border attributes Get/SetTabBorders()
1422  rSh.SetTabBorders(*pArgs);
1423  }
1424  else if ( rSh.IsFrameSelected() )
1425  {
1426  // Set border attributes via Frame-Manager.
1427  SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE, nullptr );
1428  aMgr.SetAttrSet(*pArgs);
1429  aMgr.UpdateFlyFrame();
1430  }
1431  else
1432  {
1433  // Set border attributes via shell quite normally.
1434  rSh.SetAttrItem( *pItem );
1435  }
1436  }
1437  break;
1438  default:
1439  OSL_FAIL("wrong Dispatcher");
1440  }
1441 }
1442 
1443 // Here the state for SID_IMAP / SID_CONTOUR will be handled
1444 // until the swapping of the graphic is finished.
1445 
1446 IMPL_LINK_NOARG(SwBaseShell, GraphicArrivedHdl, SwCursorShell&, void)
1447 {
1448  SwWrtShell &rSh = GetShell();
1449  if (CNT_GRF != rSh.SwEditShell::GetCntType())
1450  return;
1451  GraphicType const nGrfType(rSh.GetGraphicType());
1452  if (GraphicType::NONE == nGrfType || m_aGrfUpdateSlots.empty())
1453  return;
1454 
1456  SfxViewFrame* pVFrame = GetView().GetViewFrame();
1457  for( const auto nSlot : m_aGrfUpdateSlots )
1458  {
1459  bool bSetState = false;
1460  bool bState = false;
1461  switch( nSlot )
1462  {
1463  case SID_IMAP:
1464  case SID_IMAP_EXEC:
1465  {
1466  sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId();
1467  SfxChildWindow *pChildWindow = pVFrame->HasChildWindow(nId) ?
1468  pVFrame->GetChildWindow(nId) : nullptr;
1469  SvxIMapDlg *pDlg = pChildWindow ?
1470  static_cast<SvxIMapDlg*>(pChildWindow->GetController().get()) : nullptr;
1471 
1472  if( pDlg && ( SID_IMAP_EXEC == nSlot ||
1473  ( SID_IMAP == nSlot && !bProtect)) &&
1474  pDlg->GetEditingObject() != rSh.GetIMapInventor())
1475  lcl_UpdateIMapDlg( rSh );
1476 
1477  if( !bProtect && SID_IMAP == nSlot )
1478  {
1479  bSetState = true;
1480  bState = nullptr != pDlg;
1481  }
1482  }
1483  break;
1484 
1485  case SID_CONTOUR_DLG:
1486  if( !bProtect )
1487  {
1488  sal_uInt16 nId = SvxContourDlgChildWindow::GetChildWindowId();
1489  SfxChildWindow *pChildWindow = pVFrame->HasChildWindow(nId) ?
1490  pVFrame->GetChildWindow(nId) : nullptr;
1491  SvxIMapDlg *pDlg = pChildWindow ?
1492  static_cast<SvxIMapDlg*>(pChildWindow->GetController().get()) : nullptr;
1493  if( pDlg && pDlg->GetEditingObject() !=
1494  rSh.GetIMapInventor() )
1496 
1497  bSetState = true;
1498  bState = nullptr != pDlg;
1499  }
1500  break;
1501 
1502  case FN_FRAME_WRAP_CONTOUR:
1503  if( !bProtect )
1504  {
1506  rSh.GetFlyFrameAttr(aSet);
1507  const SwFormatSurround& rWrap = aSet.Get(RES_SURROUND);
1508  bSetState = true;
1509  bState = rWrap.IsContour();
1510  }
1511  break;
1512 
1513  case SID_GRFFILTER:
1514  case SID_GRFFILTER_INVERT:
1515  case SID_GRFFILTER_SMOOTH:
1516  case SID_GRFFILTER_SHARPEN:
1517  case SID_GRFFILTER_REMOVENOISE:
1518  case SID_GRFFILTER_SOBEL:
1519  case SID_GRFFILTER_MOSAIC:
1520  case SID_GRFFILTER_EMBOSS:
1521  case SID_GRFFILTER_POSTER:
1522  case SID_GRFFILTER_POPART:
1523  case SID_GRFFILTER_SEPIA:
1524  case SID_GRFFILTER_SOLARIZE:
1525  bSetState = bState = GraphicType::Bitmap == nGrfType;
1526  break;
1527  }
1528 
1529  if( bSetState )
1530  {
1531  SfxBoolItem aBool( nSlot, bState );
1532  if( m_pGetStateSet )
1533  m_pGetStateSet->Put( aBool );
1534  else
1535  pVFrame->GetBindings().SetState( aBool );
1536  }
1537  }
1538  m_aGrfUpdateSlots.clear();
1539 }
1540 
1542 {
1543  SwWrtShell &rSh = GetShell();
1544  SfxViewFrame* pVFrame = GetView().GetViewFrame();
1545  SfxWhichIter aIter( rSet );
1546  sal_uInt16 nWhich = aIter.FirstWhich();
1547  m_pGetStateSet = &rSet;
1548  while ( nWhich )
1549  {
1550  switch ( nWhich )
1551  {
1552  case SID_GALLERY_FORMATS:
1553  if ( rSh.IsObjSelected() ||
1554  (rSh.IsSelFrameMode() &&
1556  rSet.DisableItem( nWhich );
1557  break;
1558  case SID_GALLERY_ENABLE_ADDCOPY:
1559  // #108230# allow copy from gallery in Writer AND Writer/Web!
1560  rSet.Put( SfxBoolItem( SID_GALLERY_ENABLE_ADDCOPY, true ) );
1561  break;
1562  case FN_EDIT_REGION:
1563  if( !rSh.IsAnySectionInDoc() )
1564  rSet.DisableItem(nWhich);
1565  break;
1566 
1568  //tdf#112808 if cursor is in an index, don't show the edit section.
1569  if( !rSh.GetCurrSection() ||
1572  {
1573  rSet.DisableItem(nWhich);
1574  }
1575  break;
1576 
1577  case FN_INSERT_REGION:
1578  if( rSh.CursorInsideInputField()
1579  || rSh.IsSelFrameMode()
1580  || !rSh.IsInsRegionAvailable() )
1581  {
1582  rSet.DisableItem( nWhich );
1583  }
1584  break;
1585 
1587  {
1588  FrameTypeFlags eFrameType = rSh.GetFrameType(nullptr,true);
1589  if( (eFrameType & FrameTypeFlags::FOOTNOTE) ||
1590  !rSh.GetTableFormat() )
1591  rSet.DisableItem( nWhich );
1592  }
1593  break;
1595  {
1596  FrameTypeFlags eFrameType = rSh.GetFrameType(nullptr,true);
1597  if( (eFrameType & FrameTypeFlags::FOOTNOTE) ||
1598  !rSh.IsTextToTableAvailable() )
1599  rSet.DisableItem( nWhich );
1600  }
1601  break;
1602  case FN_CONVERT_TEXT_TABLE:
1603  {
1604  FrameTypeFlags eFrameType = rSh.GetFrameType(nullptr,true);
1605  if( (eFrameType & FrameTypeFlags::FOOTNOTE) ||
1606  (!rSh.GetTableFormat() && !rSh.IsTextToTableAvailable() ) )
1607  rSet.DisableItem( nWhich );
1608  }
1609  break;
1610  case RES_SHADOW:
1611  {
1613 
1614  // Table cell(s) selected?
1615  if ( rSh.IsTableMode() )
1616  {
1617  SwFrameFormat *pFormat = rSh.GetTableFormat();
1618  aSet.Put(pFormat->GetFormatAttr( nWhich ));
1619  }
1620  else if( rSh.IsFrameSelected() )
1621  {
1622  SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE, nullptr );
1623  aSet.Put( aMgr.GetAttrSet() );
1624  }
1625  else
1626  rSh.GetCurAttr( aSet );
1627 
1628  const SvxShadowItem& rShItem = static_cast<const SvxShadowItem&>(aSet.Get(nWhich));
1629  rSet.Put(rShItem);
1630  }
1631  break;
1632  case SID_IMAP:
1633  {
1634  // #i59688#
1635  // Improve efficiency:
1636  // If selected object is protected, item has to disabled.
1638  if ( bProtect )
1639  {
1640  rSet.DisableItem( nWhich );
1641  }
1642  else
1643  {
1644  const sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId();
1645  const bool bHas = pVFrame->HasChildWindow( nId );
1646  const bool bFrameSel = rSh.IsFrameSelected();
1647  const bool bIsGraphicSelection =
1649 
1650  // #i59688#
1651  // Avoid unnecessary loading of selected graphic.
1652  // The graphic is only needed, if the dialog is open.
1653  // If the swapping of the graphic is finished, the status
1654  // must be determined asynchronously, until this the slot
1655  // will be disabled.
1656  if ( bHas && bIsGraphicSelection && rSh.IsLinkedGrfSwapOut() )
1657  {
1658  if( AddGrfUpdateSlot( nWhich ))
1659  rSh.GetGraphic(false); // start the loading
1660  }
1661  else
1662  {
1663  if ( !bHas &&
1664  ( !bFrameSel ||
1665  ( bIsGraphicSelection &&
1666  rSh.GetGraphicType() == GraphicType::NONE ) ) )
1667  {
1668  rSet.DisableItem( nWhich );
1669  }
1670  else
1671  {
1672  SfxBoolItem aBool(nWhich, bHas);
1673  if ( bHas && bFrameSel )
1674  lcl_UpdateIMapDlg( rSh );
1675  rSet.Put(aBool);
1676  }
1677  }
1678  }
1679  }
1680  break;
1681  case SID_IMAP_EXEC:
1682  {
1683  bool bDisable = false;
1684  if( !rSh.IsFrameSelected())
1685  bDisable = true;
1686  sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId();
1687  if(!bDisable && pVFrame->HasChildWindow( nId ))
1688  {
1690  && rSh.IsLinkedGrfSwapOut())
1691  {
1692  if( AddGrfUpdateSlot( nWhich ))
1693  rSh.GetGraphic(false); // start the loading
1694  }
1695  else
1696  {
1697  SvxIMapDlg *pDlg = GetIMapDlg(GetView());
1698  if (pDlg && pDlg->GetEditingObject() != rSh.GetIMapInventor())
1699  lcl_UpdateIMapDlg( rSh );
1700  }
1701  }
1702  rSet.Put(SfxBoolItem(nWhich, bDisable));
1703  }
1704  break;
1705 
1706  case FN_BACKSPACE:
1707  case SID_DELETE:
1708  if ( ( rSh.HasReadonlySel() && !rSh.CursorInsideInputField() )
1710  {
1711  rSet.DisableItem( nWhich );
1712  }
1713  break;
1714 
1715  case SID_CONTOUR_DLG:
1716  {
1718 
1719  if( bParentCntProt || 0 != (HTMLMODE_ON & ::GetHtmlMode(
1720  GetView().GetDocShell() )) )
1721  rSet.DisableItem( nWhich );
1722  else
1723  {
1724  sal_uInt16 nId = SvxContourDlgChildWindow::GetChildWindowId();
1725  bool bHas = GetView().GetViewFrame()->HasChildWindow( nId );
1726  SelectionType nSel = rSh.GetSelectionType();
1727  bool bOk(nSel & (SelectionType::Graphic|SelectionType::Ole));
1728 
1729  bool bDisable = false;
1730  if( !bHas && !bOk )
1731  bDisable = true;
1732  // #i59688#
1733  // Avoid unnecessary loading of selected graphic.
1734  // The graphic is only needed, if the dialog is open.
1735  // If the swapping of the graphic is finished, the status
1736  // must be determined asynchronously, until this the slot
1737  // will be disabled.
1738  else if ( bHas && (nSel & SelectionType::Graphic) &&
1739  rSh.IsLinkedGrfSwapOut() )
1740  {
1741  if( AddGrfUpdateSlot( nWhich ))
1742  rSh.GetGraphic(false); // start the loading
1743  // #i75481#
1744  bDisable = true;
1745  }
1746  else if( bHas && bOk )
1747  bDisable = !lcl_UpdateContourDlg( rSh, nSel );
1748  else if( bOk )
1749  {
1750  // #i75481#
1751  // apply fix #i59688# only for selected graphics
1752  if ( nSel & SelectionType::Graphic )
1753  bDisable = GraphicType::NONE == rSh.GetGraphicType();
1754  else
1755  bDisable = GraphicType::NONE == rSh.GetIMapGraphic().GetType();
1756  }
1757 
1758  if( bDisable )
1759  rSet.DisableItem( nWhich );
1760  else
1761  rSet.Put( SfxBoolItem(nWhich, bHas) );
1762  }
1763  }
1764  break;
1765  case SID_CONTOUR_EXEC:
1766  {
1767  bool bDisable = false;
1768  SelectionType nSel = rSh.GetSelectionType();
1769  if( !(nSel & (SelectionType::Graphic|SelectionType::Ole)) )
1770  bDisable = true;
1771  sal_uInt16 nId = SvxContourDlgChildWindow::GetChildWindowId();
1772  if( !bDisable && GetView().GetViewFrame()->HasChildWindow( nId ))
1773  {
1774  SvxContourDlg *pDlg = GetContourDlg(GetView());
1775  if (pDlg && pDlg->GetEditingObject() != rSh.GetIMapInventor())
1776  bDisable = true;
1777  }
1778  rSet.Put(SfxBoolItem(nWhich, bDisable));
1779  }
1780  break;
1781 
1782  case SID_ANCHOR_MENU:
1783  case FN_TOOL_ANCHOR_PAGE:
1785  case FN_TOOL_ANCHOR_CHAR:
1787  case FN_TOOL_ANCHOR_FRAME:
1788  {
1789  bool bObj = 0 != rSh.IsObjSelected();
1791 
1792  if( !bParentCntProt && (bObj || rSh.IsFrameSelected()))
1793  {
1795  if(bObj)
1796  rSh.GetObjAttr(aSet);
1797  else
1798  rSh.GetFlyFrameAttr(aSet);
1799  RndStdIds eSet = aSet.Get(RES_ANCHOR).GetAnchorId();
1800  const bool bSet =
1801  ((nWhich == FN_TOOL_ANCHOR_PAGE) &&
1802  (eSet == RndStdIds::FLY_AT_PAGE))
1803  || ((nWhich == FN_TOOL_ANCHOR_PARAGRAPH) &&
1804  (eSet == RndStdIds::FLY_AT_PARA))
1805  || ((nWhich == FN_TOOL_ANCHOR_FRAME) &&
1806  (eSet == RndStdIds::FLY_AT_FLY))
1807  || ((nWhich == FN_TOOL_ANCHOR_AT_CHAR) &&
1808  (eSet == RndStdIds::FLY_AT_CHAR))
1809  || ((nWhich == FN_TOOL_ANCHOR_CHAR) &&
1810  (eSet == RndStdIds::FLY_AS_CHAR));
1811 
1812  if( nWhich == FN_TOOL_ANCHOR_FRAME && !rSh.IsFlyInFly() )
1813  rSet.DisableItem(nWhich);
1814  else if(nWhich != SID_ANCHOR_MENU)
1815  rSet.Put(SfxBoolItem(nWhich, bSet));
1816 
1818  {
1819  if (nWhich == FN_TOOL_ANCHOR_PAGE || nWhich == FN_TOOL_ANCHOR_FRAME)
1820  {
1821  rSet.DisableItem(nWhich);
1822  }
1823  }
1824  }
1825  else
1826  rSet.DisableItem( nWhich );
1827  }
1828  break;
1829  case FN_FRAME_NOWRAP:
1830  case FN_FRAME_WRAP:
1831  case FN_FRAME_WRAP_IDEAL:
1832  case FN_FRAME_WRAPTHRU:
1835  case FN_FRAME_WRAP_CONTOUR:
1836  case FN_WRAP_ANCHOR_ONLY:
1837  case FN_FRAME_WRAP_LEFT:
1838  case FN_FRAME_WRAP_RIGHT:
1839  {
1840  bool bObj = 0 != rSh.IsObjSelected();
1842 
1843  if( !bParentCntProt && (bObj || rSh.IsFrameSelected()))
1844  {
1846  RndStdIds nAnchorType;
1847  if(bObj)
1848  {
1849  rSh.GetObjAttr(aSet);
1850  nAnchorType = rSh.GetAnchorId();
1851  }
1852  else
1853  {
1854  rSh.GetFlyFrameAttr(aSet);
1855  nAnchorType = aSet.Get(RES_ANCHOR).GetAnchorId();
1856  }
1857  const SwFormatSurround& rWrap = aSet.Get(RES_SURROUND);
1858 
1859  const SvxOpaqueItem& rOpaque = aSet.Get(RES_OPAQUE);
1860  bool bOpaque = rOpaque.GetValue();
1861  css::text::WrapTextMode nSurround = rWrap.GetSurround();
1862  bool bSet = false;
1863 
1864  bool bDisable =
1865  (nAnchorType == RndStdIds::UNKNOWN) || (nAnchorType == RndStdIds::FLY_AS_CHAR);
1866  const bool bHtmlMode =
1867  0 != ::GetHtmlMode(GetView().GetDocShell());
1868 
1869  switch( nWhich )
1870  {
1871  case FN_FRAME_NOWRAP:
1872  bDisable |=
1873  ( (nAnchorType != RndStdIds::FLY_AT_PARA)
1874  && (nAnchorType != RndStdIds::FLY_AT_CHAR)
1875  && (nAnchorType != RndStdIds::FLY_AT_PAGE));
1876  bSet = nSurround == css::text::WrapTextMode_NONE;
1877  break;
1878  case FN_FRAME_WRAP:
1879  bDisable |= bHtmlMode;
1880  bSet = nSurround == css::text::WrapTextMode_PARALLEL;
1881  break;
1882  case FN_FRAME_WRAP_IDEAL:
1883  bDisable |= bHtmlMode;
1884  bSet = nSurround == css::text::WrapTextMode_DYNAMIC;
1885  break;
1886  case FN_FRAME_WRAPTHRU:
1887  bDisable |= (bHtmlMode ||
1888  ( (nAnchorType != RndStdIds::FLY_AT_PARA)
1889  && (nAnchorType != RndStdIds::FLY_AT_CHAR)
1890  && (nAnchorType != RndStdIds::FLY_AT_PAGE)));
1891  if(bObj)
1892  bSet = nSurround == css::text::WrapTextMode_THROUGH && rSh.GetLayerId();
1893  else
1894  bSet = nSurround == css::text::WrapTextMode_THROUGH && bOpaque;
1895  break;
1898  bDisable |= bHtmlMode;
1899  if(bObj)
1900  bSet = nSurround == css::text::WrapTextMode_THROUGH && !rSh.GetLayerId();
1901  else
1902  bSet = nSurround == css::text::WrapTextMode_THROUGH && !bOpaque;
1903  break;
1904  case FN_FRAME_WRAP_CONTOUR:
1905  bDisable |= bHtmlMode;
1906  //no contour available when no wrap or wrap through is set
1907  bDisable |= (nSurround == css::text::WrapTextMode_NONE || nSurround == css::text::WrapTextMode_THROUGH);
1908  if( !bDisable )
1909  {
1910  SelectionType nSel = rSh.GetSelectionType();
1911  if( (nSel & SelectionType::Graphic) &&
1912  rSh.IsLinkedGrfSwapOut())
1913  {
1914  if( AddGrfUpdateSlot( nWhich ))
1915  rSh.GetGraphic(false); // start the loading
1916  }
1917  else if( rSh.IsFrameSelected() )
1918  {
1919  // #i102253# applied patch from OD (see task)
1920  bDisable =
1921  nSel & SelectionType::Frame ||
1922  GraphicType::NONE == rSh.GetIMapGraphic().GetType();
1923  }
1924  }
1925  bSet = !bDisable && rWrap.IsContour();
1926 
1927  break;
1928  case FN_WRAP_ANCHOR_ONLY:
1929  bDisable |= (bHtmlMode ||
1930  (nAnchorType != RndStdIds::FLY_AT_PARA));
1931  bSet = rWrap.IsAnchorOnly();
1932  break;
1933  case FN_FRAME_WRAP_LEFT:
1934  bSet = nSurround == css::text::WrapTextMode_LEFT;
1935  break;
1936  case FN_FRAME_WRAP_RIGHT:
1937  bSet = nSurround == css::text::WrapTextMode_RIGHT;
1938  break;
1939  }
1940 
1941  if(bDisable)
1942  rSet.DisableItem(nWhich);
1943  else
1944  rSet.Put(SfxBoolItem(nWhich, bSet));
1945  }
1946  else
1947  rSet.DisableItem(nWhich);
1948  }
1949  break;
1950  case FN_UPDATE_CHARTS:
1951  if( !rSh.HasCharts() )
1952  rSet.DisableItem( nWhich );
1953  break;
1954  case FN_UPDATE_ALL_LINKS:
1955  if ( rSh.GetLinkManager().GetLinks().empty() )
1956  rSet.DisableItem(nWhich);
1957  break;
1958  case FN_XFORMS_DESIGN_MODE:
1959  // enable if in XForms document
1960  if( rSh.GetDoc()->isXForms() )
1961  {
1962  // determine current state from view options
1963  bool bValue = ! rSh.GetViewOptions()->IsFormView();
1964  rSet.Put( SfxBoolItem( nWhich, bValue ) );
1965  }
1966  else
1967  rSet.Put( SfxVisibilityItem( nWhich, false ) );
1968  break;
1969  case SID_GRAPHIC_SIZE_CHECK:
1970  {
1971  sal_Int32 nDPI = rSh.GetDoc()->getIDocumentSettingAccess().getImagePreferredDPI();
1972  if (nDPI <= 0)
1973  rSet.DisableItem(nWhich);
1974  }
1975  break;
1976  }
1977  nWhich = aIter.NextWhich();
1978  }
1979  m_pGetStateSet = nullptr;
1980 }
1981 
1982 // Disable the slots with this status method
1983 
1985 {
1986  SfxWhichIter aIter(rSet);
1987  sal_uInt16 nWhich = aIter.FirstWhich();
1988 
1989  while (nWhich)
1990  {
1991  rSet.DisableItem( nWhich );
1992  nWhich = aIter.NextWhich();
1993  }
1994 }
1995 
1996 // Disable the slots with this status method
1997 
1999 {
2002 
2003  if ( bParentCntProt ||
2004  ShellMode::Draw == eMode ||
2005  ShellMode::DrawForm == eMode ||
2006  ShellMode::DrawText == eMode ||
2007  ShellMode::Bezier == eMode )
2008  {
2009  SfxWhichIter aIter( rSet );
2010  sal_uInt16 nWhich = aIter.FirstWhich();
2011  while ( nWhich )
2012  {
2013  rSet.DisableItem( nWhich );
2014  nWhich = aIter.NextWhich();
2015  }
2016  }
2017  else
2019 }
2020 
2021 void SwBaseShell::SetWrapMode( sal_uInt16 nSlot )
2022 {
2023  SwWrtShell &rSh = GetShell();
2024  bool bObj = 0 != rSh.IsObjSelected();
2025  if( !bObj && !rSh.IsFrameSelected())
2026  return;
2027 
2029  if(bObj)
2030  rSh.GetObjAttr(aSet);
2031  else
2032  rSh.GetFlyFrameAttr(aSet);
2033  SwFormatSurround aWrap( aSet.Get(RES_SURROUND) );
2034  css::text::WrapTextMode nOldSurround(aWrap.GetSurround());
2035  css::text::WrapTextMode nSurround = css::text::WrapTextMode_PARALLEL;
2036 
2037  switch (nSlot)
2038  {
2039  case FN_FRAME_NOWRAP:
2040  nSurround = css::text::WrapTextMode_NONE;
2041  if (aWrap.IsContour())
2042  aWrap.SetContour(false);
2043  break;
2044  case FN_FRAME_WRAP_IDEAL:
2045  nSurround = css::text::WrapTextMode_DYNAMIC;
2046  break;
2047  case FN_WRAP_ANCHOR_ONLY:
2048  aWrap.SetAnchorOnly(!aWrap.IsAnchorOnly());
2049 
2050  // keep previous wrapping
2051 
2052  // switch to wrap css::text::WrapTextMode_PARALLEL, if previous wrap is css::text::WrapTextMode_NONE
2053  if ( nOldSurround != css::text::WrapTextMode_NONE )
2054  {
2055  nSurround = nOldSurround;
2056  }
2057  break;
2058  case FN_FRAME_WRAP_CONTOUR:
2059  aWrap.SetContour(!aWrap.IsContour());
2060  // Contour is meaningless in no-wrap or wrap-through context. Otherwise keep existing wrap.
2061  if ( !aWrap.IsContour() ||
2062  ( nOldSurround != css::text::WrapTextMode_NONE &&
2063  nOldSurround != css::text::WrapTextMode_THROUGH ) )
2064  {
2065  nSurround = nOldSurround;
2066  }
2067  break;
2070  if (aWrap.IsContour())
2071  aWrap.SetContour(false);
2072  [[fallthrough]];
2073  case FN_FRAME_WRAPTHRU:
2074  nSurround = css::text::WrapTextMode_THROUGH;
2075  break;
2076 
2077  case FN_FRAME_WRAP_LEFT:
2078  nSurround = css::text::WrapTextMode_LEFT;
2079  break;
2080 
2081  case FN_FRAME_WRAP_RIGHT:
2082  nSurround = css::text::WrapTextMode_RIGHT;
2083  break;
2084 
2085  default:
2086  break;
2087  }
2088  aWrap.SetSurround(nSurround);
2089 
2090  if (nSlot != FN_FRAME_WRAP_CONTOUR)
2091  {
2092  // Defaulting the contour wrap on draw objects.
2093  if (bObj && nOldSurround != nSurround &&
2094  (nOldSurround == css::text::WrapTextMode_NONE || nOldSurround == css::text::WrapTextMode_THROUGH))
2095  {
2096  aWrap.SetContour(true);
2097  }
2098  }
2099 
2100  aSet.Put( aWrap );
2101 
2102  bool bOpaque = nSlot != FN_FRAME_WRAPTHRU_TRANSP && nSlot != FN_FRAME_WRAPTHRU_TOGGLE;
2103  if( nSlot == FN_FRAME_WRAPTHRU_TOGGLE )
2104  {
2105  if( bObj )
2106  bOpaque = !rSh.GetLayerId();
2107  else
2108  {
2109  const SvxOpaqueItem& aOpaque( aSet.Get(RES_OPAQUE) );
2110  bOpaque = !aOpaque.GetValue();
2111  }
2112  }
2113  aSet.Put(SvxOpaqueItem(RES_OPAQUE, bOpaque ));
2114 
2115  if(bObj)
2116  {
2117  rSh.SetObjAttr(aSet);
2118  if ( bOpaque )
2119  rSh.SelectionToHeaven();
2120  else
2121  rSh.SelectionToHell();
2122  }
2123  else
2124  rSh.SetFlyFrameAttr(aSet);
2125 
2126 }
2127 
2128 //Force update of the status line
2129 
2131 {
2132  s_eFrameMode = eMode;
2133  SfxBindings &rBnd = pSh->GetView().GetViewFrame()->GetBindings();
2134 
2135  if( eMode == FLY_DRAG || pSh->IsFrameSelected() || pSh->IsObjSelected() )
2136  {
2137  const SfxPointItem aTmp1( SID_ATTR_POSITION, pSh->GetAnchorObjDiff());
2138  const SvxSizeItem aTmp2( SID_ATTR_SIZE, pSh->GetObjSize());
2139  rBnd.SetState( aTmp1 );
2140  rBnd.SetState( aTmp2 );
2141  }
2142  else if( eMode == FLY_DRAG_END )
2143  {
2144  static sal_uInt16 aInval[] =
2145  {
2146  SID_ATTR_POSITION, SID_ATTR_SIZE, 0
2147  };
2148  rBnd.Invalidate(aInval);
2149  }
2150 }
2151 
2153  SfxShell( &rVw ),
2154  m_rView(rVw),
2155  m_pGetStateSet(nullptr)
2156 {
2157  SwWrtShell& rWrtSh = m_rView.GetWrtShell();
2158 
2159  SetPool(&rWrtSh.GetAttrPool());
2160  SetName("Base");
2161  rWrtSh.SetGrfArrivedLnk( LINK( this, SwBaseShell, GraphicArrivedHdl));
2162 }
2163 
2165 {
2166  if( m_rView.GetCurShell() == this )
2168 
2169  Link<SwCursorShell&,void> aTmp( LINK( this, SwBaseShell, GraphicArrivedHdl));
2170  if( aTmp == m_rView.GetWrtShell().GetGrfArrivedLnk() )
2172 }
2173 
2175 {
2176  const SfxItemSet *pArgs = rReq.GetArgs();
2177  const sal_uInt16 nSlot = rReq.GetSlot();
2178 
2179  if( pArgs)
2180  {
2181  SwWrtShell &rSh = GetShell();
2182  std::unique_ptr<SvxScriptSetItem> pSSetItem;
2183  SfxItemPool& rPool = rSh.GetAttrPool();
2184  sal_uInt16 nWhich = rPool.GetWhich( nSlot );
2185  SvtScriptType nScripts = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
2188  RES_CHRATR_CTL_FONTSIZE, RES_CHRATR_CTL_FONTSIZE>
2189  aHeightSet( GetPool() );
2190 
2191  switch( nSlot )
2192  {
2193  case SID_ATTR_CHAR_FONT:
2194  {
2195  nScripts = rSh.GetScriptType();
2196  // #i42732# input language should be preferred over
2197  // current cursor position to detect script type
2198  if(!rSh.HasSelection())
2199  {
2200  LanguageType nInputLang = GetView().GetEditWin().GetInputLanguage();
2201  if(nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM)
2202  nScripts = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang );
2203  }
2204  [[fallthrough]];
2205  }
2206  case SID_ATTR_CHAR_POSTURE:
2207  case SID_ATTR_CHAR_WEIGHT:
2208  {
2209  pSSetItem.reset(new SvxScriptSetItem( nSlot, rPool ));
2210  pSSetItem->PutItemForScriptType( nScripts, pArgs->Get( nWhich ));
2211  pArgs = &pSSetItem->GetItemSet();
2212  }
2213  break;
2214  case SID_ATTR_CHAR_FONTHEIGHT:
2215  {
2216  if(rSh.HasSelection())
2217  {
2218  pSSetItem.reset(new SvxScriptSetItem( nSlot, rPool ));
2219  pSSetItem->PutItemForScriptType( nScripts, pArgs->Get( nWhich ));
2220  pArgs = &pSSetItem->GetItemSet();
2221  }
2222  else
2223  {
2224  nScripts = rSh.GetScriptType();
2225  LanguageType nInputLang = GetView().GetEditWin().GetInputLanguage();
2226  if(nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM)
2227  nScripts = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang );
2228  sal_uInt32 nHeight = static_cast< const SvxFontHeightItem& >(pArgs->Get( nWhich )).GetHeight();
2229  SwStdFontConfig* pStdFont = SW_MOD()->GetStdFontConfig();
2230 
2233  RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE>
2234  aLangSet( GetPool() );
2235  rSh.GetCurAttr( aLangSet );
2236 
2237  sal_Int32 nWesternSize =
2239  aLangSet.Get( RES_CHRATR_LANGUAGE).GetLanguage());
2240  sal_Int32 nCJKSize =
2242  aLangSet.Get( RES_CHRATR_CJK_LANGUAGE).GetLanguage());
2243  sal_Int32 nCTLSize =
2245  aLangSet.Get( RES_CHRATR_CTL_LANGUAGE).GetLanguage());
2246 
2247  switch(nScripts)
2248  {
2249  case SvtScriptType::LATIN:
2250  nCJKSize = nHeight * nCJKSize / nWesternSize;
2251  nCTLSize = nHeight * nCTLSize / nWesternSize;
2252  nWesternSize = static_cast<sal_Int32>(nHeight);
2253  break;
2254  case SvtScriptType::ASIAN:
2255  nCTLSize = nHeight* nCTLSize / nCJKSize;
2256  nWesternSize = nHeight * nWesternSize / nCJKSize;
2257  nCJKSize = static_cast<sal_Int32>(nHeight);
2258  break;
2259  case SvtScriptType::COMPLEX:
2260  nCJKSize = nHeight * nCJKSize / nCTLSize;
2261  nWesternSize = nHeight * nWesternSize / nCTLSize;
2262  nCTLSize = static_cast<sal_Int32>(nHeight);
2263  break;
2264  default: break;
2265  }
2266  aHeightSet.Put( SvxFontHeightItem( static_cast<sal_uInt32>(nWesternSize), 100, RES_CHRATR_FONTSIZE ));
2267  aHeightSet.Put( SvxFontHeightItem( static_cast<sal_uInt32>(nCJKSize), 100, RES_CHRATR_CJK_FONTSIZE ));
2268  aHeightSet.Put( SvxFontHeightItem( static_cast<sal_uInt32>(nCTLSize), 100, RES_CHRATR_CTL_FONTSIZE ));
2269  pArgs = &aHeightSet;
2270  }
2271  }
2272  break;
2273  }
2274 
2275  if( pArgs )
2276  {
2277  bool bAuto = false;
2278  if ( !isCHRATR(nWhich) ||
2279  ( rSh.HasSelection() && rSh.IsSelFullPara() ) )
2280  {
2281  SwTextFormatColl * pColl = rSh.GetCurTextFormatColl();
2282  if ( pColl && pColl->IsAutoUpdateFormat() )
2283  {
2284  rSh.AutoUpdatePara( pColl, *pArgs );
2285  bAuto = true;
2286  }
2287  }
2288 
2289  if (!bAuto)
2290  {
2291  rSh.SetAttrSet( *pArgs );
2292  }
2293  }
2294  }
2295  else
2296  {
2297  if (nSlot == SID_ATTR_CHAR_KERNING)
2298  GetView().GetViewFrame()->GetDispatcher()->Execute(SID_CHAR_DLG_POSITION);
2299  else if (nSlot == SID_ATTR_CHAR_COLOR)
2300  GetView().GetViewFrame()->GetDispatcher()->Execute(SID_CHAR_DLG_EFFECT);
2301  else
2302  GetView().GetViewFrame()->GetDispatcher()->Execute(SID_CHAR_DLG);
2303  }
2304  rReq.Done();
2305 }
2306 
2308 {
2309  SwWrtShell &rSh = GetShell();
2310  rSh.GetCurAttr( rSet );
2311 }
2312 
2314 {
2315  SwWrtShell &rSh = GetShell();
2316  bool bFirst = true;
2317  std::optional<SfxItemSet> pFntCoreSet;
2318  SvtScriptType nScriptType = SvtScriptType::LATIN;
2319  SfxWhichIter aIter( rSet );
2320  sal_uInt16 nWhich = aIter.FirstWhich();
2321  while( nWhich )
2322  {
2323  switch( nWhich )
2324  {
2325  case RES_CHRATR_FONT:
2326  case RES_CHRATR_FONTSIZE:
2327  case RES_CHRATR_WEIGHT:
2328  case RES_CHRATR_POSTURE:
2329  {
2330  if( !pFntCoreSet )
2331  {
2332  pFntCoreSet.emplace( *rSet.GetPool(),
2334  rSh.GetCurAttr( *pFntCoreSet );
2335  nScriptType = rSh.GetScriptType();
2336  // #i42732# input language should be preferred over
2337  // current cursor position to detect script type
2338  SwEditWin& rEditWin = GetView().GetEditWin();
2339  if( rEditWin.IsUseInputLanguage() )
2340  {
2341  if(!rSh.HasSelection() && (
2342  nWhich == RES_CHRATR_FONT ||
2343  nWhich == RES_CHRATR_FONTSIZE ))
2344  {
2345  LanguageType nInputLang = rEditWin.GetInputLanguage();
2346  if(nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM)
2347  nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang );
2348  }
2349  }
2350  }
2351  SfxItemPool& rPool = *rSet.GetPool();
2352  SvxScriptSetItem aSetItem( rPool.GetSlotId( nWhich ), rPool );
2353  aSetItem.GetItemSet().Put( *pFntCoreSet, false );
2354  const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType );
2355  if( pI )
2356  {
2357  rSet.Put( pI->CloneSetWhich(nWhich) );
2358  }
2359  else
2360  rSet.InvalidateItem( nWhich );
2361  // Set input context of the SwEditWin according to the selected font and script type
2362  if(RES_CHRATR_FONT == nWhich)
2363  {
2364  vcl::Font aFont;
2365  if (const SvxFontItem* pFontItem = dynamic_cast<const SvxFontItem*>(pI))
2366  {
2367  aFont.SetFamilyName(pFontItem->GetFamilyName());
2368  aFont.SetStyleName(pFontItem->GetStyleName());
2369  aFont.SetFamily(pFontItem->GetFamily());
2370  aFont.SetPitch(pFontItem->GetPitch());
2371  aFont.SetCharSet(pFontItem->GetCharSet());
2372  }
2373 
2374  bool bVertical = rSh.IsInVerticalText();
2375  aFont.SetOrientation(Degree10(bVertical ? 2700 : 0));
2376  aFont.SetVertical(bVertical);
2377  GetView().GetEditWin().SetInputContext( InputContext( aFont, InputContextFlags::Text |
2378  InputContextFlags::ExtText ) );
2379  }
2380  }
2381  break;
2382 
2383  default:
2384  if( bFirst )
2385  {
2386  rSh.GetCurAttr( rSet );
2387  bFirst = false;
2388  }
2389  }
2390  nWhich = aIter.NextWhich();
2391  }
2392 }
2393 
2395 {
2396  SwWrtShell &rSh = GetShell();
2397  SfxWhichIter aIter(rSet);
2398  sal_uInt16 nWhich(aIter.FirstWhich());
2399  SelectionType nSelType(rSh.GetSelectionType());
2400  std::unique_ptr<SvxBrushItem> aBrushItem(std::make_unique<SvxBrushItem>(RES_BACKGROUND));
2401 
2402  if( nWhich == SID_TABLE_CELL_BACKGROUND_COLOR )
2403  {
2404  rSh.GetBoxBackground( aBrushItem );
2405  }
2406  else
2407  {
2408  // Adapt to new DrawingLayer FillStyle; use a parent which has XFILL_NONE set
2410 
2411  aCoreSet.SetParent(&GetView().GetDocShell()->GetDoc()->GetDfltFrameFormat()->GetAttrSet());
2412 
2413  if(nSelType & SelectionType::Graphic || SelectionType::Frame & nSelType)
2414  {
2415  rSh.GetFlyFrameAttr(aCoreSet);
2416  }
2417  else
2418  {
2419  rSh.GetCurAttr(aCoreSet);
2420  }
2421 
2422  aBrushItem = getSvxBrushItemFromSourceSet(aCoreSet, RES_BACKGROUND);
2423  }
2424 
2425  while(nWhich)
2426  {
2427  switch(nWhich)
2428  {
2429  case SID_BACKGROUND_COLOR:
2430  case SID_TABLE_CELL_BACKGROUND_COLOR:
2431  {
2432  SvxColorItem aColorItem(aBrushItem->GetColor(), nWhich);
2433  rSet.Put(aColorItem);
2434  break;
2435  }
2436  case SID_ATTR_BRUSH:
2437  case RES_BACKGROUND:
2438  {
2439  // if this was intended to have a independent copy of the Item to be set
2440  // this is not needed due to the ItemSet/Pool cloning Items which get set anyways.
2441  // Keeping code as reference - it may have had other reasons I do notz see (?!?)
2442  // std::unique_ptr<SfxPoolItem> pNewItem(aBrushItem.CloneSetWhich(GetPool().GetWhich(nWhich)));
2443  rSet.Put(*aBrushItem);
2444  break;
2445  }
2446  }
2447 
2448  nWhich = aIter.NextWhich();
2449  }
2450 }
2451 
2453 {
2454  SwWrtShell &rSh = GetShell();
2455  SelectionType nSelType(rSh.GetSelectionType());
2456  const SfxItemSet* pArgs = rReq.GetArgs();
2457  sal_uInt16 nSlot(rReq.GetSlot());
2458 
2459  if (!pArgs && nSlot != SID_BACKGROUND_COLOR && nSlot != SID_TABLE_CELL_BACKGROUND_COLOR)
2460  {
2461  return;
2462  }
2463 
2464  std::unique_ptr<SvxBrushItem> aBrushItem(std::make_unique<SvxBrushItem>(RES_BACKGROUND));
2465 
2466  if ( nSlot == SID_TABLE_CELL_BACKGROUND_COLOR )
2467  {
2468  rSh.GetBoxBackground( aBrushItem );
2469  }
2470  else
2471  {
2472  // Adapt to new DrawingLayer FillStyle; use a parent which has XFILL_NONE set
2474 
2475  aCoreSet.SetParent(&GetView().GetDocShell()->GetDoc()->GetDfltFrameFormat()->GetAttrSet());
2476 
2477  if((SelectionType::Frame & nSelType) || (SelectionType::Graphic & nSelType))
2478  {
2479  rSh.GetFlyFrameAttr(aCoreSet);
2480  }
2481  else
2482  {
2483  rSh.GetCurAttr(aCoreSet);
2484  }
2485 
2486  aBrushItem = getSvxBrushItemFromSourceSet(aCoreSet, RES_BACKGROUND);
2487  }
2488 
2489  switch(nSlot)
2490  {
2491  case SID_BACKGROUND_COLOR:
2492  case SID_TABLE_CELL_BACKGROUND_COLOR:
2493  {
2494  const SfxPoolItem* pColorStringItem = nullptr;
2495  bool bIsTransparent = false;
2496 
2497  aBrushItem->SetGraphicPos(GPOS_NONE);
2498 
2499  sal_uInt16 nSlotId = (nSlot == SID_BACKGROUND_COLOR) ? SID_BACKGROUND_COLOR : SID_TABLE_CELL_BACKGROUND_COLOR;
2500  if (pArgs && SfxItemState::SET == pArgs->GetItemState(SID_ATTR_COLOR_STR, false, &pColorStringItem))
2501  {
2502  OUString sColor = static_cast<const SfxStringItem*>(pColorStringItem)->GetValue();
2503  if (sColor == "transparent")
2504  {
2505  bIsTransparent = true;
2506  }
2507  else
2508  {
2509  Color aColor(ColorTransparency, sColor.toInt32(16));
2510 
2511  aBrushItem->SetColor(aColor);
2512 
2513  SvxColorItem aNewColorItem(nSlotId);
2514  aNewColorItem.SetValue(aColor);
2515 
2516  GetView().GetViewFrame()->GetBindings().SetState(aNewColorItem);
2517  }
2518  }
2519  else if (pArgs)
2520  {
2521  const SvxColorItem& rNewColorItem = static_cast<const SvxColorItem&>(pArgs->Get(nSlotId));
2522  const Color& rNewColor = rNewColorItem.GetValue();
2523  aBrushItem->SetColor(rNewColor);
2524  GetView().GetViewFrame()->GetBindings().SetState(rNewColorItem);
2525  }
2526  else
2527  {
2528  bIsTransparent = true;
2529  }
2530 
2531  if (bIsTransparent)
2532  {
2533  aBrushItem->SetColor(COL_TRANSPARENT);
2535  }
2536  break;
2537  }
2538 
2539  case SID_ATTR_BRUSH:
2540  case RES_BACKGROUND:
2541  {
2542  assert(pArgs && "only SID_BACKGROUND_COLOR can have !pArgs, checked at entry");
2543  aBrushItem.reset(static_cast<SvxBrushItem*>(pArgs->Get(GetPool().GetWhich(nSlot)).Clone()));
2544  break;
2545  }
2546  default:
2547  {
2548  rReq.Ignore();
2549  OSL_FAIL("unknown message in ExecuteAttr!" );
2550  return;
2551  }
2552  }
2553 
2554  if ( nSlot == SID_TABLE_CELL_BACKGROUND_COLOR )
2555  {
2556  rSh.SetBoxBackground( *aBrushItem );
2557  }
2558  else
2559  {
2560  // Adapt to new DrawingLayer FillStyle; use a parent which has XFILL_NONE set
2562 
2563  aCoreSet.SetParent(&GetView().GetDocShell()->GetDoc()->GetDfltFrameFormat()->GetAttrSet());
2564  setSvxBrushItemAsFillAttributesToTargetSet(*aBrushItem, aCoreSet);
2565 
2566  if((SelectionType::Frame & nSelType) || (SelectionType::Graphic & nSelType))
2567  {
2568  // Template autoupdate
2569  SwFrameFormat* pFormat = rSh.GetSelectedFrameFormat();
2570 
2571  if(pFormat && pFormat->IsAutoUpdateFormat())
2572  {
2573  rSh.AutoUpdateFrame(pFormat, aCoreSet);
2574  }
2575  else
2576  {
2577  rSh.SetFlyFrameAttr(aCoreSet);
2578  }
2579  }
2580  else
2581  {
2582  SwTextFormatColl* pColl = rSh.GetCurTextFormatColl();
2583 
2584  if(pColl && pColl->IsAutoUpdateFormat())
2585  {
2586  rSh.AutoUpdatePara(pColl, aCoreSet);
2587  }
2588  else
2589  {
2590  rSh.SetAttrSet(aCoreSet);
2591  }
2592  }
2593  }
2594 
2595  rReq.Done();
2596 }
2597 
2599 {
2600  SwWrtShell &rSh = GetShell();
2601  // Table cell(s) selected?
2602  bool bPrepare = true;
2603  bool bTableMode = rSh.IsTableMode();
2604  if ( bTableMode )
2605  {
2607  SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER> aCoreSet( GetPool() );
2608  SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
2609  aCoreSet.Put( aBoxInfo );
2610  rSh.GetTabBorders( aCoreSet );
2611  rSet.Put( aCoreSet );
2612  }
2613  else if ( rSh.IsFrameSelected() )
2614  {
2615  SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE, nullptr );
2616  rSet.Put( aMgr.GetAttrSet() );
2617  bPrepare = false;
2618  }
2619  else
2620  // Get border attributes via shell quite normal
2621  rSh.GetCurAttr( rSet );
2622  if ( bPrepare )
2623  ::PrepareBoxInfo( rSet, rSh );
2624  // Switch the border toolbox controller mode
2625  rSet.Put( SfxBoolItem( SID_BORDER_REDUCED_MODE, !bTableMode ));
2626 }
2627 
2629 {
2630  SwWrtShell &rSh = GetShell();
2631  weld::Window* pMDI = GetView().GetFrameWeld();
2632  // So that from the basic no dialogues for the background views are called:
2633  bool bBackground = (&GetView() != GetActiveView());
2634  const SfxPoolItem* pItem = nullptr;
2635  const SfxItemSet* pArgs = rReq.GetArgs();
2636 
2637  sal_uInt16 nSlot = rReq.GetSlot();
2638  const SfxItemSet* pOutSet = nullptr;
2639  bool bDone = false;
2640  if(pArgs)
2641  pArgs->GetItemState( GetPool().GetWhich(nSlot), false, &pItem );
2642 
2643  switch ( nSlot )
2644  {
2646  {
2650  aContext.maEndDialogFn = [](sal_Int32){};
2651  pDlg->StartExecuteAsync(aContext);
2652  }
2653  break;
2654  case FN_FORMAT_PAGE_DLG:
2657  {
2658  if( !bBackground )
2659  {
2660  const size_t nCurIdx = rSh.GetCurPageDesc();
2661  const SwPageDesc& rPageDesc = rSh.GetPageDesc( nCurIdx );
2662  // Temporary view, because the shell does not need to be valid after the dialog
2663  // for example disable header
2664  SwView& rTempView = GetView();
2665 
2666  OString sPageId;
2667  switch (nSlot)
2668  {
2670  sPageId = "columns";
2671  break;
2673  sPageId = "page";
2674  break;
2675  case FN_FORMAT_PAGE_DLG:
2676  if (pItem)
2677  sPageId = OUStringToOString(static_cast<const SfxStringItem*>(pItem)->GetValue(), RTL_TEXTENCODING_UTF8);
2678  break;
2679  }
2680  rTempView.GetDocShell()->FormatPage(rReq.GetFrameWeld(), rPageDesc.GetName(), sPageId, rSh, &rReq);
2681  rTempView.InvalidateRulerPos();
2682 
2683  bDone = true; // FormatPage() takes care of calling Done()
2684  }
2685  }
2686  break;
2687  case FN_FORMAT_BORDER_DLG:
2688  {
2690  SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER> aSet( rSh.GetAttrPool() );
2692  // Table cell(s) selected?
2693  if ( rSh.IsTableMode() )
2694  {
2695  // Set border attributes Get/SetTabBorders()
2696  ::PrepareBoxInfo( aSet, rSh );
2697  rSh.GetTabBorders( aSet );
2699  pDlg.disposeAndReset(pFact->CreateSwBorderDlg(pMDI, aSet, SwBorderModes::TABLE));
2700  if ( pDlg->Execute() == RET_OK )
2701  {
2702  rSh.SetTabBorders( *pDlg->GetOutputItemSet() );
2703  pOutSet = pDlg->GetOutputItemSet();
2704  }
2705  }
2706  else if ( rSh.IsFrameSelected() )
2707  {
2708  // Set border attributes via Frame-Manager
2709  SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE, nullptr );
2710  aSet.Put( aMgr.GetAttrSet() );
2711 
2713  pDlg.disposeAndReset(pFact->CreateSwBorderDlg(pMDI, aSet, SwBorderModes::FRAME));
2714  if ( pDlg->Execute() == RET_OK )
2715  {
2716  aMgr.SetAttrSet( *pDlg->GetOutputItemSet() );
2717  aMgr.UpdateFlyFrame();
2718  pOutSet = pDlg->GetOutputItemSet();
2719  }
2720  }
2721  else
2722  {
2723  // Set border attributes via Shell quite normal
2724  rSh.GetCurAttr( aSet );
2725  ::PrepareBoxInfo( aSet, rSh );
2726 
2728  pDlg.disposeAndReset(pFact->CreateSwBorderDlg(pMDI, aSet, SwBorderModes::PARA));
2729  if ( pDlg->Execute() == RET_OK )
2730  {
2731  rSh.SetAttrSet( *pDlg->GetOutputItemSet() );
2732  pOutSet = pDlg->GetOutputItemSet();
2733  }
2734  }
2735  if(pOutSet)
2736  {
2737  rReq.Done(*pOutSet);
2738  bDone = true;
2739  }
2740  }
2741  break;
2743  {
2746 
2749 
2750  // Table cell(s) selected?
2751  if ( rSh.IsTableMode() )
2752  {
2753  // Get background attributes of the table and put it in the set
2754  // tdf#144843 calling GetBoxBackground *requires* an incarnation to be handed over
2755  std::unique_ptr<SvxBrushItem> aBrush(std::make_unique<SvxBrushItem>(RES_BACKGROUND));
2756  rSh.GetBoxBackground( aBrush );
2757  pDlg.disposeAndReset(pFact->CreateSwBackgroundDialog(pMDI, aSet));
2758  aSet.Put( *aBrush );
2759  if ( pDlg->Execute() == RET_OK )
2760  {
2761 
2762  rSh.SetBoxBackground( pDlg->GetOutputItemSet()->Get( RES_BACKGROUND ) );
2763  pOutSet = pDlg->GetOutputItemSet();
2764  }
2765  }
2766  else if ( rSh.IsFrameSelected() )
2767  {
2768 
2769  rSh.GetFlyFrameAttr( aSet );
2770 
2771  pDlg.disposeAndReset(pFact->CreateSwBackgroundDialog(pMDI, aSet));
2772  if ( pDlg->Execute() == RET_OK )
2773  {
2774  rSh.SetFlyFrameAttr(const_cast<SfxItemSet &>(*pDlg->GetOutputItemSet()) );
2775  pOutSet = pDlg->GetOutputItemSet();
2776  }
2777  }
2778  else
2779  {
2780  // Set border attributes Umrandungsattribute with the shell quite normal.
2781  rSh.GetCurAttr( aSet );
2782 
2783  pDlg.disposeAndReset(pFact->CreateSwBackgroundDialog(pMDI, aSet));
2784  if ( pDlg->Execute() == RET_OK )
2785  {
2786  rSh.SetAttrSet( *pDlg->GetOutputItemSet() );
2787  pOutSet = pDlg->GetOutputItemSet();
2788  }
2789  }
2790  if(pOutSet)
2791  {
2792  rReq.Done(*pOutSet);
2793  bDone = true;
2794  }
2795  }
2796  break;
2797  case SID_ACCESSIBILITY_CHECK:
2798  {
2799  sw::AccessibilityCheck aCheck(rSh.GetDoc());
2800  aCheck.check();
2801  std::shared_ptr<svx::AccessibilityCheckDialog> aDialog = std::make_shared<svx::AccessibilityCheckDialog>(pMDI, aCheck.getIssueCollection());
2802  weld::DialogController::runAsync(aDialog, [](int){});
2803  }
2804  break;
2805 
2806  case SID_GRAPHIC_SIZE_CHECK:
2807  {
2808  sw::GraphicSizeCheckGUIResult aResult(rSh.GetDoc());
2809  svx::GenericCheckDialog aDialog(pMDI, aResult);
2810  aDialog.run();
2811  }
2812  break;
2813 
2814  default:OSL_FAIL("wrong Dispatcher (basesh.cxx)");
2815  }
2816  if(!bDone)
2817  rReq.Done();
2818 }
2819 
2821 {
2822  return m_rView.GetWrtShell();
2823 }
2824 
2826 {
2827  return m_rView.GetWrtShellPtr();
2828 }
2829 
2830 static void EndUndo(SwWrtShell& rSh)
2831 {
2832  SwRewriter aRewriter;
2833 
2834  if (rSh.GetTableFormat())
2835  {
2836  aRewriter.AddRule(UndoArg1, SwResId(STR_START_QUOTE));
2837  aRewriter.AddRule(UndoArg2, rSh.GetTableFormat()->GetName());
2838  aRewriter.AddRule(UndoArg3, SwResId(STR_END_QUOTE));
2839 
2840  }
2841  rSh.EndUndo(SwUndoId::INSTABLE, &aRewriter); // If possible change the Shell
2842 }
2843 
2844 static void InsertTableImpl(SwWrtShell& rSh,
2845  SwView &rTempView,
2846  const OUString& aTableName,
2847  sal_uInt16 nRows,
2848  sal_uInt16 nCols,
2849  SwInsertTableOptions aInsTableOpts,
2850  const OUString& aAutoName,
2851  const std::unique_ptr<SwTableAutoFormat>& pTAFormat)
2852 {
2854 
2855  rSh.StartAllAction();
2856  if( rSh.HasSelection() )
2857  rSh.DelRight();
2858 
2859  rSh.InsertTable( aInsTableOpts, nRows, nCols, pTAFormat.get() );
2861 
2862  if( !aTableName.isEmpty() && !rSh.GetTableStyle( aTableName ) )
2863  rSh.GetTableFormat()->SetName( aTableName );
2864 
2865  if( pTAFormat != nullptr && !aAutoName.isEmpty()
2866  && aAutoName != SwViewShell::GetShellRes()->aStrNone )
2867  {
2868  SwTableNode* pTableNode = const_cast<SwTableNode*>( rSh.IsCursorInTable() );
2869  if ( pTableNode )
2870  {
2871  pTableNode->GetTable().SetTableStyleName( aAutoName );
2872  SwUndoTableAutoFormat* pUndo = new SwUndoTableAutoFormat( *pTableNode, *pTAFormat );
2873  if ( pUndo )
2874  rSh.GetIDocumentUndoRedo().AppendUndo( std::unique_ptr<SwUndo>(pUndo) );
2875  }
2876  }
2877 
2878  rSh.EndAllAction();
2879  rTempView.AutoCaption(TABLE_CAP);
2880 }
2881 
2883 {
2884  const SfxItemSet* pArgs = _rRequest.GetArgs();
2885  SwWrtShell& rSh = GetShell();
2886 
2887  if ( rSh.GetFrameType( nullptr, true ) & FrameTypeFlags::FOOTNOTE )
2888  return;
2889 
2890  SwView &rTempView = GetView(); // Because GetView() does not work after the shell exchange
2891  bool bHTMLMode = 0 != (::GetHtmlMode(rTempView.GetDocShell())&HTMLMODE_ON);
2892  bool bCallEndUndo = false;
2893 
2894  if( !pArgs && rSh.IsSelection() && !rSh.IsInClickToEdit() &&
2895  !rSh.IsTableMode() )
2896  {
2897  const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
2898  SwInsertTableOptions aInsTableOpts = pModOpt->GetInsTableFlags(bHTMLMode);
2899 
2901  bCallEndUndo = true;
2902 
2903  bool bInserted = rSh.TextToTable( aInsTableOpts, '\t' );
2904  rSh.EnterStdMode();
2905  if (bInserted)
2906  rTempView.AutoCaption(TABLE_CAP);
2907  _rRequest.Done();
2908  }
2909  else
2910  {
2911  sal_uInt16 nColsIn = 0;
2912  sal_uInt16 nRowsIn = 0;
2913  SwInsertTableOptions aInsTableOptsIn( SwInsertTableFlags::All, 1 );
2914  OUString aTableNameIn;
2915  OUString aAutoNameIn;
2916  std::unique_ptr<SwTableAutoFormat> pTAFormatIn;
2917 
2918  if( pArgs && pArgs->Count() >= 2 )
2919  {
2921  const SfxUInt16Item* pCols = _rRequest.GetArg<SfxUInt16Item>(SID_ATTR_TABLE_COLUMN);
2922  const SfxUInt16Item* pRows = _rRequest.GetArg<SfxUInt16Item>(SID_ATTR_TABLE_ROW);
2923  const SfxInt32Item* pFlags = _rRequest.GetArg<SfxInt32Item>(FN_PARAM_1);
2924  const SfxStringItem* pAuto = _rRequest.GetArg<SfxStringItem>(FN_PARAM_2);
2925 
2926  if ( pName )
2927  aTableNameIn = pName->GetValue();
2928  if ( pCols )
2929  nColsIn = pCols->GetValue();
2930  if ( pRows )
2931  nRowsIn = pRows->GetValue();
2932  if ( pAuto )
2933  {
2934  aAutoNameIn = pAuto->GetValue();
2935  if ( !aAutoNameIn.isEmpty() )
2936  {
2937  SwTableAutoFormatTable aTableTable;
2938  aTableTable.Load();
2939  for ( size_t n=0; n<aTableTable.size(); n++ )
2940  {
2941  if ( aTableTable[n].GetName() == aAutoNameIn )
2942  {
2943  pTAFormatIn.reset(new SwTableAutoFormat( aTableTable[n] ));
2944  break;
2945  }
2946  }
2947  }
2948  }
2949 
2950  if ( pFlags )
2951  aInsTableOptsIn.mnInsMode = static_cast<SwInsertTableFlags>(pFlags->GetValue());
2952  else
2953  {
2954  const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
2955  aInsTableOptsIn = pModOpt->GetInsTableFlags(bHTMLMode);
2956  }
2957  }
2958 
2959  if( !nColsIn || !nRowsIn )
2960  {
2962  std::shared_ptr<AbstractInsTableDlg> pAbstractDialog(pFact->CreateInsTableDlg(rTempView));
2963  std::shared_ptr<weld::DialogController> pDialogController(pAbstractDialog->getDialogController());
2964 
2965  weld::DialogController::runAsync(pDialogController,
2966  [pAbstractDialog, &rSh, &rTempView, aTableNameIn, nRowsIn, nColsIn, aInsTableOptsIn, aAutoNameIn] (sal_Int32 nResult) {
2967  if( RET_OK == nResult )
2968  {
2969  sal_uInt16 nCols = nColsIn;
2970  sal_uInt16 nRows = nRowsIn;
2971  SwInsertTableOptions aInsTableOpts = aInsTableOptsIn;
2972  OUString aTableName = aTableNameIn;
2973  OUString aAutoName = aAutoNameIn;
2974  std::unique_ptr<SwTableAutoFormat> pTAFormat;
2975 
2976  pAbstractDialog->GetValues( aTableName, nRows, nCols, aInsTableOpts, aAutoName, pTAFormat );
2977 
2978  if( nCols && nRows )
2979  {
2980  InsertTableImpl( rSh, rTempView, aTableName, nRows, nCols, aInsTableOpts, aAutoName, pTAFormat );
2981  EndUndo(rSh);
2982  }
2983  }
2984  }
2985  );
2986  }
2987  else
2988  {
2989  // record before shell change
2990  _rRequest.AppendItem( SfxStringItem( FN_INSERT_TABLE, aTableNameIn ) );
2991  if ( !aAutoNameIn.isEmpty() )
2992  _rRequest.AppendItem( SfxStringItem( FN_PARAM_2, aAutoNameIn ) );
2993  _rRequest.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_COLUMN, nColsIn ) );
2994  _rRequest.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_ROW, nRowsIn ) );
2995  _rRequest.AppendItem( SfxInt32Item( FN_PARAM_1, static_cast<sal_Int32>(aInsTableOptsIn.mnInsMode) ) );
2996  _rRequest.Done();
2997 
2998  InsertTableImpl( rSh, rTempView, aTableNameIn, nRowsIn, nColsIn, aInsTableOptsIn, aAutoNameIn, pTAFormatIn );
2999 
3000  bCallEndUndo = true;
3001  }
3002  }
3003 
3004  if( bCallEndUndo )
3005  EndUndo(rSh);
3006 }
3007 
3009 {
3010  SwWrtShell &rSh = GetShell();
3011  SfxWhichIter aIter( rSet );
3012  sal_uInt16 nWhich = aIter.FirstWhich();
3013  switch ( nWhich )
3014  {
3015  case SID_GALLERY_BG_BRUSH:
3016  {
3017  SelectionType nSel = rSh.GetSelectionType();
3018  SfxStringListItem aLst( nWhich );
3019  std::vector<OUString> &rLst = aLst.GetList();
3022  nHeaderPos = nFooterPos = 0;
3023  sal_uInt8 nPos = 1;
3024  rLst.push_back( SwResId( STR_SWBG_PAGE ) );
3025  nPagePos = nPos++;
3026  sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
3027  bool bHtmlMode = 0 != (nHtmlMode & HTMLMODE_ON);
3028 
3029  if ( (!bHtmlMode || (nHtmlMode & HTMLMODE_FULL_STYLES)) &&
3030  (nSel & SelectionType::Text) )
3031  {
3032  rLst.push_back( SwResId( STR_SWBG_PARAGRAPH ) );
3033  nParagraphPos = nPos++;
3034  }
3035  if ( (!bHtmlMode || (nHtmlMode & HTMLMODE_SOME_STYLES)) &&
3037  {
3038  rLst.push_back( SwResId( STR_SWBG_TABLE ) );
3039  nTablePos = nPos++;
3040 
3041  if(!bHtmlMode)
3042  {
3043  rLst.push_back( SwResId( STR_SWBG_TABLE_ROW ) );
3044  nTableRowPos = nPos++;
3045  }
3046 
3047  rLst.push_back( SwResId( STR_SWBG_TABLE_CELL) );
3048  nTableCellPos = nPos++;
3049  }
3050  if(!bHtmlMode)
3051  {
3052  if ( nSel & SelectionType::Frame )
3053  {
3054  rLst.push_back( SwResId( STR_SWBG_FRAME ) );
3055  nFramePos = nPos++;
3056  }
3057  if ( nSel & SelectionType::Graphic )
3058  {
3059  rLst.push_back( SwResId( STR_SWBG_GRAPHIC ) );
3060  nGraphicPos = nPos++;
3061  }
3062  if ( nSel & SelectionType::Ole )
3063  {
3064  rLst.push_back( SwResId( STR_SWBG_OLE ) );
3065  nOlePos = nPos++;
3066  }
3067  const FrameTypeFlags nType = rSh.GetFrameType(nullptr,true);
3068  if ( nType & FrameTypeFlags::HEADER )
3069  {
3070  rLst.push_back( SwResId( STR_SWBG_HEADER ) );
3071  nHeaderPos = nPos++;
3072  }
3073  if ( nType & FrameTypeFlags::FOOTER )
3074  {
3075  rLst.push_back( SwResId( STR_SWBG_FOOTER ) );
3076  nFooterPos = nPos;
3077  }
3078  }
3079  if ( rLst.empty() )
3080  rSet.DisableItem( nWhich );
3081  else
3082  rSet.Put( aLst );
3083  break;
3084  }
3085  }
3086 }
3087 
3089 {
3090  SwWrtShell &rSh = GetShell();
3091  rSh.StartAction();
3092  const SfxItemSet* pArgs = rReq.GetArgs();
3093  sal_uInt16 nSlot = rReq.GetSlot();
3094  switch(nSlot)
3095  {
3096  case SID_GALLERY_BG_BRUSH:
3097  {
3098  if ( !pArgs )
3099  break;
3100 
3101  SelectionType nSel = rSh.GetSelectionType();
3102  if ( nSel & SelectionType::DrawObjectEditMode )
3103  break;
3104 
3105  const SfxUInt16Item* pPos = rReq.GetArg<SfxUInt16Item>(SID_GALLERY_BG_POS);
3106  const SvxBrushItem* pBrush = rReq.GetArg<SvxBrushItem>(SID_GALLERY_BG_BRUSH);
3107  if ( !pPos || !pBrush )
3108  break;
3109 
3110  sal_uInt8 nPos = pPos->GetValue();
3111  ++nPos;
3112 
3113  SvxBrushItem aBrush( *pBrush );
3114  aBrush.SetWhich( RES_BACKGROUND );
3115  if ( nPos == nParagraphPos )
3116  rSh.SetAttrItem( aBrush );
3117  else if ( nPos == nTablePos )
3118  rSh.SetTabBackground( aBrush );
3119  else if ( nPos == nTableRowPos )
3120  rSh.SetRowBackground( aBrush );
3121  else if ( nPos == nTableCellPos )
3122  rSh.SetBoxBackground( aBrush );
3123  else if ( nPos == nFramePos || nPos == nGraphicPos || nPos == nOlePos )
3124  {
3126  aCoreSet.Put( aBrush );
3127  rSh.SetFlyFrameAttr( aCoreSet );
3128  }
3129  else if ( nPos == nPagePos || nPos == nHeaderPos || nPos == nFooterPos )
3130  {
3131  sal_uInt16 nDesc = rSh.GetCurPageDesc();
3132  SwPageDesc aDesc( rSh.GetPageDesc( nDesc ) );
3133  if ( nPos == nPagePos )
3134  aDesc.GetMaster().SetFormatAttr( aBrush );
3135  else if ( nPos == nHeaderPos )
3136  {
3137  SwFormatHeader aHead( aDesc.GetMaster().GetHeader() );
3138  aHead.GetHeaderFormat()->SetFormatAttr( aBrush );
3139  aDesc.GetMaster().SetFormatAttr( aHead );
3140  }
3141  else if ( nPos == nFooterPos )
3142  {
3143  SwFormatFooter aFoot( aDesc.GetMaster().GetFooter() );
3144  aFoot.GetFooterFormat()->SetFormatAttr( aBrush );
3145  aDesc.GetMaster().SetFormatAttr( aFoot );
3146  }
3147  rSh.ChgPageDesc( nDesc, aDesc );
3148  }
3149  break;
3150  }
3151  }
3152  rSh.EndAction();
3153  rReq.Done();
3154 }
3155 
3157 {
3158  sal_uInt16 nSlot = rReq.GetSlot();
3159  switch( nSlot )
3160  {
3161 #if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
3162  case FN_CHANGE_DBFIELD:
3163  {
3166  pDlg->Execute();
3167  }
3168  break;
3169 #endif
3170  default:
3171  OSL_FAIL("wrong dispatcher");
3172  }
3173 }
3174 
3175 std::shared_ptr<std::vector<std::unique_ptr<SwPaM>>> SwBaseShell::CopyPaMRing(SwPaM& rOrig)
3176 {
3177  auto vCursors = std::make_shared<std::vector<std::unique_ptr<SwPaM>>>();
3178  vCursors->emplace_back(std::make_unique<SwPaM>(rOrig, nullptr));
3179  for (auto& rCursor : rOrig.GetRingContainer())
3180  {
3181  if (&rCursor != &rOrig)
3182  vCursors->emplace_back(std::make_unique<SwPaM>(rCursor, vCursors->front().get()));
3183  }
3184  return vCursors;
3185 }
3186 
3187 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetFamily(FontFamily)
const SfxPoolItem * ExecuteSlot(SfxRequest &rReq, const SfxInterface *pIF=nullptr)
std::shared_ptr< SfxDialogController > & GetController()
#define FN_SET_TRACKED_DELETIONS_IN_MARGIN
Definition: cmdid.h:199
SwFieldType * GetFieldType(SwFieldIds nResId, size_t nField=0) const
Definition: fldmgr.cxx:415
SfxViewFrame * GetViewFrame() const
SFX_IMPL_SUPERCLASS_INTERFACE(DrawDocShell, SfxObjectShell)
static sal_uInt8 nOlePos
Definition: basesh.cxx:115
bool GetValue() const
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:241
#define FN_PAGE_STYLE_SET_COLS
Definition: cmdid.h:396
bool IsContour() const
Definition: fmtsrnd.hxx:53
#define FN_FRAME_WRAP_RIGHT
Definition: cmdid.h:425
#define FN_UPDATE_ALL_LINKS
Definition: cmdid.h:127
#define FONT_GROUP_CTL
Definition: fontcfg.hxx:48
void SetWishWidth(sal_uInt16 nNew)
Definition: fmtclds.hxx:134
bool IsInClickToEdit() const
Definition: wrtsh.hxx:656
constexpr TypedWhichId< SwFormatSurround > RES_SURROUND(101)
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 * >())
#define FN_UPDATE_TOX
Definition: cmdid.h:516
URL aURL
const css::uno::Reference< css::graphic::XGraphic > & GetGraphic() const
SwNode & GetNode(bool bPoint=true) const
Definition: pam.hxx:224
SwTextFormatColl * GetCurTextFormatColl() const
Get the named paragraph format of the current selection.
Definition: edattr.cxx:238
#define FN_FRAME_WRAP
Definition: cmdid.h:341
FlyMode
Definition: mdiexp.hxx:41
void SetGrfArrivedLnk(const Link< SwCursorShell &, void > &rLnk)
Definition: crsrsh.hxx:492
bool bVisible
Represents the style of a paragraph.
Definition: fmtcol.hxx:56
bool IsInVerticalText(const Point *pPt=nullptr) const
Definition: crsrsh.cxx:3445
#define FN_EDIT_REGION
Definition: cmdid.h:115
static sal_uInt8 nGraphicPos
Definition: basesh.cxx:114
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
bool IsPasteSpecialAllowed()
Definition: view.cxx:1866
void GetTextCtrlState(SfxItemSet &rSet)
Definition: basesh.cxx:2307
void ChgAnchor(RndStdIds eAnchorId, bool bSameOnly=false, bool bPosCorr=true)
frmatr.hxx.
Definition: feshview.cxx:2361
SfxChildWindow * GetChildWindow(sal_uInt16)
#define FONT_STANDARD
Definition: fontcfg.hxx:27
SwView & GetView()
Definition: basesh.hxx:59
void ExecTextCtrl(SfxRequest &rReq)
Definition: basesh.cxx:2174
void GetGalleryState(SfxItemSet &)
Definition: basesh.cxx:3008
void AutoCaption(const sal_uInt16 nType, const SvGlobalName *pOleId=nullptr)
Definition: viewdlg2.cxx:180
bool HasCharts() const
Definition: viewsh.cxx:774
const Link< SwCursorShell &, void > & GetGrfArrivedLnk() const
Definition: crsrsh.hxx:493
#define FN_GOTO_NEXT_OBJ
Definition: cmdid.h:694
OUString GetRepeatString() const
Definition: wrtundo.cxx:138
#define FN_FRAME_TO_ANCHOR
Definition: cmdid.h:712
virtual std::shared_ptr< AbstractInsTableDlg > CreateInsTableDlg(SwView &rView)=0
virtual void DoRepair(bool bRepair)=0
Enable repair mode.
void SaveTableBoxContent(const SwPosition *pPos=nullptr)
Definition: trvltbl.cxx:870
bool isCHRATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:479
static std::shared_ptr< std::vector< std::unique_ptr< SwPaM > > > CopyPaMRing(SwPaM &rOrig)
Definition: basesh.cxx:3175
SwView * GetActiveView()
Definition: swmodul1.cxx:116
void ReRead(const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic=nullptr)
Re-read if graphic is not ok. Current graphic is replaced by the new one.
Definition: editsh.cxx:295
void SetState(const SfxItemSet &rSet)
static constexpr auto Items
static ShellResource * GetShellRes()
Definition: viewsh.cxx:2662
bool GotoPrevTable(SwPaM &rCurrentCursor, SwMoveFnCollection const &fnPosTable, bool bInReadOnly)
Definition: trvltbl.cxx:481
static void GetDefaultTargetList(TargetList &)
bool SttEndDoc(bool bStt)
Definition: crsrsh.cxx:574
SwUndoId
Definition: swundo.hxx:29
SwDocShell * GetDocShell()
Definition: doc.hxx:1351
virtual VclPtr< VclAbstractDialog > CreateSwChangeDBDlg(SwView &rVw)=0
sfx2::LinkManager & GetLinkManager()
Definition: editsh.cxx:593
void ClearTableBoxContent()
Definition: trvltbl.cxx:909
std::string GetValue
void UpdateChart()
Definition: tablemgr.cxx:172
void SetRowBackground(const SvxBrushItem &rNew)
Definition: fetab.cxx:818
std::unique_ptr< SvxBrushItem > getSvxBrushItemFromSourceSet(const SfxItemSet &rSourceSet, sal_uInt16 nBackgroundID, bool bSearchInParents, bool bXMLImportHack)
static SfxItemSetFixed< RES_VERT_ORIENT, RES_ANCHOR > makeItemSetFromFormatAnchor(SfxItemPool &rPool, const SwFormatAnchor &rAnchor)
Definition: fefly1.cxx:1137
signed char sal_Int8
bool IsPasteSpreadsheet(bool bHasOwnTableCopied)
Definition: view.cxx:1892
void ExecuteGallery(SfxRequest &)
Definition: basesh.cxx:3088
void * GetIMapInventor() const
Unique identification of object (for ImageMapDlg).
Definition: editsh.cxx:598
bool IsTableMode() const
Definition: crsrsh.hxx:648
GPOS_NONE
bool IsSttPara() const
Definition: crsrsh.cxx:1095
bool MoveFieldType(const SwFieldType *pFieldType, const bool bNext, const SwFieldIds nResType=SwFieldIds::Unknown, const bool bAddSetExpressionFieldsToInputFields=true)
Definition: crstrvl.cxx:695
SwWrtShell * GetShellPtr()
Definition: basesh.cxx:2825
SfxDispatcher * GetDispatcher()
SwWrtShell & GetShell()
Definition: basesh.cxx:2820
void SelectionToHeaven()
Above document.
Definition: feshview.cxx:1236
static SvxAbstractDialogFactory * Create()
void SetWrapMode(sal_uInt16 nSlot)
Definition: basesh.cxx:2021
static bool IsPaste(const SwWrtShell &, const TransferableDataHelper &)
Definition: swdtflvr.cxx:1374
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
constexpr::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
Size GetObjSize() const
Definition: feshview.cxx:2392
#define CNT_GRF
Definition: editsh.hxx:130
bool GetLastUndoInfo(OUString *const o_pStr, SwUndoId *const o_pId, const SwView *pView=nullptr) const
Definition: edws.cxx:237
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_FONTSIZE(8)
#define FN_TOOL_ANCHOR_PAGE
Definition: cmdid.h:236
Base class of all fields.
Definition: fldbas.hxx:291
static sal_uInt8 nTableCellPos
Definition: basesh.cxx:119
void SetAttrSet(const SfxItemSet &, SetAttrMode nFlags=SetAttrMode::DEFAULT, SwPaM *pCursor=nullptr, const bool bParagraphSetting=false)
Definition: edatmisc.cxx:151
#define FN_INSERT_REGION
Definition: cmdid.h:293
SwInsertTableFlags mnInsMode
Definition: itabenum.hxx:40
sal_Int64 n
Check only parents.
GraphicType
css::uno::Reference< css::frame::XModel3 > GetModel() const
static bool PasteFormat(SwWrtShell &rSh, TransferableDataHelper &rData, SotClipboardFormatId nFormat)
Definition: swdtflvr.cxx:3375
sal_uInt16 GetValue() const
virtual void restoreAnnotationMarks(bool bDelete=true)=0
void InvalidateItem(sal_uInt16 nWhich)
sal_Int16 nId
sal_uInt16 FirstWhich()
virtual VclPtr< SfxAbstractDialog > CreateSwBackgroundDialog(weld::Window *pParent, const SfxItemSet &rSet)=0
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
Definition: edws.cxx:234
void UpdateAllCharts()
update all charts for which any table exists
Definition: viewsh.cxx:767
void GetTextFontCtrlState(SfxItemSet &rSet)
Definition: basesh.cxx:2313
void UpdateInputFields(SwInputFieldList *pLst=nullptr)
Definition: wrtsh2.cxx:146
bool TextToTable(const SwInsertTableOptions &rInsTableOpts, sal_Unicode cCh, const SwTableAutoFormat *pTAFormat=nullptr)
Definition: edtab.cxx:132
void GetDoStrings(DoType eDoType, SfxStringListItem &rStrLstItem) const
Definition: wrtundo.cxx:115
void EnterStdMode()
Definition: select.cxx:551
void ExecClpbrd(SfxRequest &)
Definition: basesh.cxx:286
#define FN_XFORMS_DESIGN_MODE
Definition: cmdid.h:607
SwEditWin & GetEditWin()
Definition: view.hxx:416
bool IsSelFullPara() const
Definition: crsrsh.cxx:3409
void Done(bool bRemove=false)
constexpr TypedWhichId< SvxOpaqueItem > RES_OPAQUE(99)
void SetCharSet(rtl_TextEncoding)
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1792
void InsertGraphic(const OUString &rPath, const OUString &rFilter, const Graphic &, SwFlyFrameAttrMgr *=nullptr, RndStdIds nAnchorType=RndStdIds::FLY_AT_PARA)
Definition: wrtsh1.cxx:271
void AutoUpdatePara(SwTextFormatColl *pColl, const SfxItemSet &rStyleSet, SwPaM *pPaM=nullptr)
Definition: wrtsh1.cxx:1860
const SfxItemSet * GetArgs() const
void Invalidate(sal_uInt16 nId)
virtual void PreGetFormat(const TransferableDataHelper &aHelper)=0
void ResetSubShell()
Definition: view.hxx:582
sal_Int32 GetFontHeight(sal_uInt8 nFont, sal_uInt8 nScriptType, LanguageType eLang)
Definition: fontcfg.cxx:299
void EndAllAction()
Definition: edws.cxx:97
static sal_uInt8 nTableRowPos
Definition: basesh.cxx:118
#define FN_PASTE_NESTED_TABLE
Definition: cmdid.h:310
void SetContour(bool bNew)
Definition: fmtsrnd.hxx:57
void FlushInBuffer()
Character buffer is inserted into the document.
Definition: edtwin.cxx:879
sal_uInt16 mnRowsToRepeat
Definition: itabenum.hxx:41
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
SfxShell * GetCurShell()
Definition: view.hxx:575
void SetUseInputLanguage(bool bNew)
#i42732# display status of font size/name depending on either the input language or the selection pos...
Definition: edtwin.cxx:6482
#define FN_FRAME_WRAP_IDEAL
Definition: cmdid.h:412
void ExecBckCol(SfxRequest &rReq)
Definition: basesh.cxx:2452
sal_uInt16 NextWhich()
void StateStyle(SfxItemSet &)
Definition: basesh.cxx:1998
SwInsertTableFlags
Definition: itabenum.hxx:25
bool DelRight()
Definition: delete.cxx:294
constexpr SwTwips DEF_GUTTER_WIDTH
Definition: swtypes.hxx:65
const OUString & GetName() const
Definition: pagedesc.hxx:196
SwWrtShell & GetWrtShell() const
Definition: view.hxx:413
const SwSection * GetCurrSection() const
Definition: edsect.cxx:71
#define FONT_GROUP_DEFAULT
Definition: fontcfg.hxx:46
void SwapPam()
Definition: crsrsh.cxx:976
void SetTabBackground(const SvxBrushItem &rNew)
Definition: fetab.cxx:899
static sal_uInt8 nPagePos
Definition: basesh.cxx:120
#define FN_PAGE_STYLE_SET_PAPER_BIN
Definition: cmdid.h:394
Used by the UI to modify the document model.
Definition: wrtsh.hxx:96
void ToggleChildWindow(sal_uInt16)
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:164
SvtScriptType
static bool runAsync(const std::shared_ptr< DialogController > &rController, const std::function< void(sal_Int32)> &)
constexpr TypedWhichId< SwFormatVertOrient > RES_VERT_ORIENT(102)
sal_uInt16 sal_Unicode
#define FN_SET_TRACKED_INSERTIONS_IN_MARGIN
Definition: cmdid.h:200
const SwTable & InsertTable(const SwInsertTableOptions &rInsTableOpts, sal_uInt16 nRows, sal_uInt16 nCols, const SwTableAutoFormat *pTAFormat=nullptr)
Inserts an nRows x nCols table to the document at the current position.
Definition: edtab.cxx:101
const SwView & GetView() const
Definition: wrtsh.hxx:437
const Graphic & GetGraphic() const
const SwFrameFormat * IsFlyInFly()
Is selected frame within another frame?
Definition: fefly1.cxx:312
void SttCursorMove()
Definition: crsrsh.cxx:302
virtual bool GetFirstRedoInfo(OUString *const o_pStr, SwUndoId *const o_pId, const SwView *pView=nullptr) const =0
Get Id and comment of first Redo action.
constexpr TypedWhichId< SwFormatHoriOrient > RES_HORI_ORIENT(103)
#define FN_EDIT_CURRENT_REGION
Definition: cmdid.h:117
SvxIMapDlg * GetIMapDlg()
void ExecStyleSheet(SfxRequest &)
Definition: docst.cxx:291
#define FN_PAGE_STYLE_SET_PAPER_SIZE
Definition: cmdid.h:393
const tools::PolyPolygon * GetGraphicPolygon() const
Definition: editsh.cxx:319
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CTL_LANGUAGE(29)
OUString aStrNone
Definition: shellres.hxx:46
void ExecDlg(SfxRequest &)
Definition: basesh.cxx:2628
#define FN_PAGE_STYLE_SET_NUMBER_FORMAT
Definition: cmdid.h:395
const OUString & GetName() const
Definition: format.hxx:131
SwField * GetCurField(const bool bIncludeInputFieldAtStart=false) const
Definition: crstrvl.cxx:974
Footer, for pageformats Client of FrameFormat describing the footer.
Definition: fmthdft.hxx:64
int nCount
#define FN_FRAME_WRAP_LEFT
Definition: cmdid.h:424
#define FN_TOOL_ANCHOR_CHAR
Definition: cmdid.h:259
virtual void SetName(const OUString &rNewName, bool bBroadcast=false) override
Definition: atrfrm.cxx:2560
static TransferableDataHelper CreateFromSystemClipboard(vcl::Window *pWindow)
sal_Int8 GetType() const
Point GetAnchorObjDiff() const
Methods for status line.
Definition: feshview.cxx:2405
bool IsAnchorOnly() const
Definition: fmtsrnd.hxx:52
#define FN_GOTO_NEXT_MARK
Definition: cmdid.h:726
const SfxItemSet & GetAttrSet() const
Definition: frmmgr.hxx:124
Mode eMode
static bool HasMacroRecorder(SfxViewFrame const *pFrame)
const SwTable & GetTable() const
Definition: node.hxx:506
static bool Paste(SwWrtShell &, TransferableDataHelper &, RndStdIds nAnchorType=RndStdIds::FLY_AT_PARA, bool bIgnoreComments=false, PasteTableType ePasteTable=PasteTableType::PASTE_DEFAULT)
Definition: swdtflvr.cxx:1462
SwDoc * GetDoc() const
Definition: viewsh.hxx:282
void GetGrfNms(OUString *pGrfName, OUString *pFltName, const SwFlyFrameFormat *=nullptr) const
Returns the name and the filter name of a graphic if the pointer is on a graphic. ...
Definition: editsh.cxx:305
void ExecField(SfxRequest const &rReq)
Definition: basesh.cxx:3156
tools::PolyPolygon GetPolyPolygon()
SotClipboardFormatId
#define FN_FRAME_WRAPTHRU_TOGGLE
Definition: cmdid.h:413
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
SwFrameFormat * GetTableStyle(std::u16string_view rFormatName)
Definition: wrtsh1.cxx:1809
const OUString & GetName() const
void FormatPage(weld::Window *pDialogParent, const OUString &rPage, const OString &rPageId, SwWrtShell &rActShell, SfxRequest *pRequest=nullptr)
Show page style format dialog.
Definition: docst.cxx:1627
bool IsGraphicChanged() const
ShellMode
Definition: view.hxx:85
void DelNumRules()
Delete, split enumeration list.
Definition: ednumber.cxx:269
OUString GetDoString(DoType eDoType) const
Definition: wrtundo.cxx:95
static sal_uInt16 IsMath(const SvGlobalName &rName)
const sal_Unicode cDelim
void GetBorderState(SfxItemSet &rSet)
Definition: basesh.cxx:2598
virtual sal_Int32 getImagePreferredDPI()=0
const OUStringLiteral sColor
#define FN_PAGE_STYLE_SET_LR_MARGIN
Definition: cmdid.h:391
void SetShowChangesInMargin(bool b)
Definition: viewopt.hxx:296
static sal_uInt8 nTablePos
Definition: basesh.cxx:117
css::uno::Reference< css::embed::XEmbeddedObject > GetOleRef() const
get reference to OLE object (if there is one) for selected FlyFrame
Definition: fefly1.cxx:1491
void Execute(SfxRequest &)
Definition: basesh.cxx:770
const void * GetEditingObject() const
void SetPitch(FontPitch ePitch)
SfxItemPool & GetPool() const
IMPL_LINK_NOARG(SwBaseShell, GraphicArrivedHdl, SwCursorShell &, void)
Definition: basesh.cxx:1446
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_WEIGHT(15)
void SelectionToHell()
Below document.
Definition: feshview.cxx:1241
#define FN_NEXT_BOOKMARK
Definition: cmdid.h:120
static sal_uInt8 nFramePos
Definition: basesh.cxx:116
const ImageMap & GetImageMap() const
bool IsShowOutlineContentVisibilityButton() const
Definition: viewopt.cxx:99
bool GetFlyFrameAttr(SfxItemSet &rSet) const
Definition: fefly1.cxx:1061
void EndCursorMove(const bool bIdleEnd=false)
Definition: crsrsh.cxx:311
#define FN_TABLE_PASTE_ROW_BEFORE
Definition: cmdid.h:311
virtual VclPtr< AbstractSwConvertTableDlg > CreateSwConvertTableDlg(SwView &rView, bool bToTable)=0
static bool lcl_UpdateContourDlg(SwWrtShell &rSh, SelectionType nSel)
Definition: basesh.cxx:176
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:137
void EndSelect()
Definition: select.cxx:425
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:617
bool IsSelection() const
Definition: crsrsh.hxx:888
void SetTabBorders(const SfxItemSet &rSet)
Definition: fetab.cxx:831
void SetBoxBackground(const SvxBrushItem &rNew)
Definition: fetab.cxx:854
virtual void AppendUndo(std::unique_ptr< SwUndo > pUndo)=0
Add new Undo action.
static void EndUndo(SwWrtShell &rSh)
Definition: basesh.cxx:2830
sal_uInt16 char * pName
virtual void ClearRedo()=0
Delete all Redo actions.
virtual FmFormShell * GetFormShell() override
Definition: view.hxx:578
const SwTableNode * IsCursorInTable() const
Definition: crsrsh.hxx:898
Style of a layout element.
Definition: frmfmt.hxx:59
::sw::UndoManager & GetUndoManager()
Definition: doc.cxx:133
void SetFormView(bool bSet)
Definition: viewopt.hxx:470
SvtScriptType GetScriptType() const
returns the script type of the selection
Definition: edattr.cxx:662
bool HasSelection() const
Definition: wrtsh.hxx:147
#define SW_MOD()
Definition: swmodule.hxx:255
void SetFamilyName(const OUString &rFamilyName)
void SetInputContext(const InputContext &rInputContext)
void AlignFormulaToBaseline(const css::uno::Reference< css::embed::XEmbeddedObject > &xObj)
for starmath formulas anchored 'as char' it aligns it baseline to baseline changing the previous vert...
Definition: fefly1.cxx:2048
bool IsInsRegionAvailable() const
Definition: edsect.cxx:58
Shell * GetShell()
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
#define FN_CHANGE_DBFIELD
Definition: cmdid.h:208
static void InsertTableImpl(SwWrtShell &rSh, SwView &rTempView, const OUString &aTableName, sal_uInt16 nRows, sal_uInt16 nCols, SwInsertTableOptions aInsTableOpts, const OUString &aAutoName, const std::unique_ptr< SwTableAutoFormat > &pTAFormat)
Definition: basesh.cxx:2844
const SvBaseLinks & GetLinks() const
int i
#define FN_INSERT_TABLE
Definition: cmdid.h:228
GraphicType GetGraphicType() const
Definition: editsh.cxx:271
uno_Any a
bool GetObjAttr(SfxItemSet &rSet) const
Attention: Ambiguities if multiple selections.
Definition: feshview.cxx:2773
bool IsViewUndoActionIndependent(const SwView *pView, sal_uInt16 &rOffset) const
Checks if the topmost undo action owned by pView is independent from the topmost action undo action...
Definition: docundo.cxx:362
const SwFrameFormat * GetFooterFormat() const
Definition: fmthdft.hxx:85
GraphicType GetType() const
bool IsAnySectionInDoc() const
Definition: edsect.cxx:119
bool IsFormView() const
Definition: viewopt.hxx:469
bool EndAllTableBoxEdit()
Definition: trvltbl.cxx:916
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:59
bool GoNextBookmark()
Definition: wrtsh3.cxx:250
SfxItemSet * m_pGetStateSet
Definition: basesh.hxx:48
#define FN_UPDATE_CHARTS
Definition: cmdid.h:141
#define FN_FORMAT_PAGE_SETTING_DLG
Definition: cmdid.h:324
css::uno::Reference< css::datatransfer::XTransferable > GetXTransferable() const
#define LANGUAGE_SYSTEM
SelectionType
void SetOrientation(Degree10 nLineOrientation)
constexpr TypedWhichId< SwFormatURL > RES_URL(111)
sal_uInt16 GetPhyPageNum() const
Phy: real page count.
Definition: fews.cxx:335
static void PrePasteSpecial(const SwWrtShell &rSh, TransferableDataHelper &, const VclPtr< SfxAbstractPasteDialog > &pDlg)
PrePasteSpecial Prepares the given dialog without actually running it.
Definition: swdtflvr.cxx:3465
SfxBindings & GetBindings()
bool HasMark() const
Definition: crsrsh.hxx:886
void SetAttrItem(const SfxPoolItem &, SetAttrMode nFlags=SetAttrMode::DEFAULT, const bool bParagraphSetting=false)
Definition: edatmisc.cxx:112
void Reformat()
Invalidates complete Layout (ApplyViewOption).
Definition: viewsh.cxx:1057
const OUString & GetValue() const
sal_uInt16 Count() const
FlyAnchors.
Definition: fmtanchr.hxx:34
const SwPageDesc & GetPageDesc(size_t i) const
Definition: fedesc.cxx:126
HTMLMODE_ON
bool SetFlyFrameAttr(SfxItemSet &rSet)
Definition: fefly1.cxx:1103
FrameTypeFlags
values can be combined via logical or
Definition: fesh.hxx:63
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)
Definition: viewopt.cxx:354
size_t size() const
Definition: tblafmt.cxx:916
const T * GetArg(sal_uInt16 nSlotId) const
#define FN_REPAGINATE
Definition: cmdid.h:112
void SetAttrSet(const SfxItemSet &rSet)
Definition: frmmgr.cxx:618
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
Definition: edws.cxx:223
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
void SetPool(SfxItemPool *pNewPool)
virtual SfxStyleSheetBasePool * GetStyleSheetPool() override
For Style PI.
Definition: docsh.cxx:1154
static void UpdateIMapDlg(const Graphic &rGraphic, const ImageMap *pImageMap, const TargetList *pTargetList, void *pEditingObj)
#define FN_UPDATE_FIELDS
Definition: cmdid.h:82
void AddRule(SwUndoArg eWhat, const OUString &rWith)
Definition: SwRewriter.cxx:25
#define FN_WRAP_ANCHOR_ONLY
Definition: cmdid.h:427
sal_Int16 GetHoriOrient() const
Definition: fmtornt.hxx:87
SvtScriptType GetScriptTypeOfLanguage(LanguageType nLang)
#define LANGUAGE_DONTKNOW
css::text::WrapTextMode GetSurround() const
Definition: fmtsrnd.hxx:51
void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem &rBrush, SfxItemSet &rToSet)
bool IsUseInputLanguage() const
Definition: edtwin.hxx:267
void Execute(SfxRequest &)
Dispatcher.
Definition: docsh2.cxx:394
#define FN_FORMAT_TITLEPAGE_DLG
Definition: cmdid.h:355
static FlyMode s_eFrameMode
Definition: basesh.hxx:44
static SwAbstractDialogFactory * Create()
Definition: swabstdlg.cxx:36
static void SetFrameMode(FlyMode eMode, SwWrtShell *pShell)
Definition: basesh.cxx:2130
virtual comphelper::EmbeddedObjectContainer & getEmbeddedObjectContainer() const override
Marks a node in the document model.
Definition: ndindex.hxx:30
static void StateDisableItems(SfxItemSet &)
Definition: basesh.cxx:1984
static sal_uInt8 nParagraphPos
Definition: basesh.cxx:113
virtual ~SwBaseShell() override
Definition: basesh.cxx:2164
ColorTransparency
ring_container GetRingContainer()
Definition: ring.hxx:240
sal_uInt16 GetSlotId(sal_uInt16 nWhich) const
static void lcl_UpdateIMapDlg(SwWrtShell &rSh)
Definition: basesh.cxx:160
bool DelLeft()
Definition: delete.cxx:134
void ExecUndo(SfxRequest &)
Definition: basesh.cxx:587
void SetName(const OUString &rName)
Graphic GetIMapGraphic() const
Remove default parameter, because method always called this default value.
Definition: editsh.cxx:605
bool IsAutoUpdateFormat() const
Query / set bAutoUpdateFormat-flag.
Definition: format.hxx:188
#define FN_TOOL_ANCHOR_FRAME
Definition: cmdid.h:241
bool HasReadonlySel() const
Definition: crsrsh.cxx:3355
bool StartExecuteAsync(const std::function< void(sal_Int32)> &rEndDialogFn)
void GrabFocus()
RndStdIds GetAnchorId() const
Anchor type of selected object, RndStdIds::UNKNOWN if ambiguous or in case of frame selection...
Definition: feshview.cxx:2331
std::unique_ptr< SfxPoolItem > CloneSetWhich(sal_uInt16 nNewWhich) const
bool isXForms() const
Definition: docxforms.cxx:44
const Graphic * GetGraphic(bool bWait=true) const
Definition: editsh.cxx:239
SfxItemPool * GetPool() const
std::vector< OUString > & GetList()
#define FONT_GROUP_CJK
Definition: fontcfg.hxx:47
FlyProtectFlags IsSelObjProtected(FlyProtectFlags eType) const
Which Protection is set at selected object?
Definition: feshview.cxx:2705
static sal_uInt8 nFooterPos
Definition: basesh.cxx:122
bool GoPrevBookmark()
Definition: wrtsh3.cxx:271
SwDocShell * GetDocShell()
Definition: view.cxx:1132
SwFrameFormat * GetTableFormat()
Definition: edws.cxx:183
const void * GetEditingObject() const
#define FN_FORMAT_BORDER_DLG
Definition: cmdid.h:326
#define FN_FRAME_WRAPTHRU_TRANSP
Definition: cmdid.h:414
SwFrameFormat * GetSelectedFrameFormat() const
If frame then frame style, else 0.
Definition: fefly1.cxx:1213
void SetShowChangesInMargin2(bool b)
Definition: viewopt.hxx:302
void StartAction()
Definition: crsrsh.cxx:227
static void FillClipFormatItem(const SwWrtShell &rSh, const TransferableDataHelper &rData, SvxClipboardFormatItem &rToFill)
Definition: swdtflvr.cxx:3521
void StateClpbrd(SfxItemSet &)
Definition: basesh.cxx:509
void SetParent(const SfxItemSet *pNew)
const ImageMap * GetMap() const
Definition: fmturl.hxx:68
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:448
void GetBckColState(SfxItemSet &rSet)
Definition: basesh.cxx:2394
void SetReturnValue(const SfxPoolItem &)
weld::Window * GetFrameWeld() const
void InsertTable(SfxRequest &_rRequest)
Definition: basesh.cxx:2882
const OUString & GetName() const
Definition: tblafmt.hxx:202
void UpdateOleObjectPreviews()
Update the previews of all OLE objects.
Definition: viewsh.cxx:728
SdrLayerID GetLayerId() const
1 Heaven, 0 Hell, SDRLAYER_NOTFOUND Ambiguous.
Definition: feshview.cxx:1170
void CallChgLnk()
Definition: crsrsh.cxx:2537
#define FN_TOOL_ANCHOR_AT_CHAR
Definition: cmdid.h:287
bool GotoObj(bool bNext, GotoObjFlags eType=GotoObjFlags::DrawAny)
Definition: feshview.cxx:1751
#define FN_UPDATE_ALL
Definition: cmdid.h:132
IDocumentUndoRedo const & GetIDocumentUndoRedo() const
Provides access to the document undo/redo interface.
Definition: viewsh.cxx:2795
Class for automated call of Start- and EndCursorMove().
Definition: editsh.hxx:1026
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:238
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
#define FN_FRAME_WRAPTHRU
Definition: cmdid.h:342
void GetState(SfxItemSet &)
Definition: basesh.cxx:1541
sal_uInt16 GetSlot() const
virtual ViewShellId GetViewShellId() const
SwBaseShell(SwView &rShell)
Definition: basesh.cxx:2152
void Broadcast(const SfxHint &rHint)
bool HasChildWindow(sal_uInt16)
void SetGraphicPolygon(const tools::PolyPolygon *pPoly)
Definition: editsh.cxx:325
void SetStyleName(const OUString &rStyleName)
const css::uno::Reference< css::frame::XDispatchRecorder > & GetRecorder() const
const OUString & GetURL() const
SwWrtShell * GetWrtShellPtr() const
Definition: view.hxx:414
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:195
#define FN_FORMAT_BACKGROUND_DLG
Definition: cmdid.h:328
void DisableItem(sal_uInt16 nWhich)
constexpr sal_uInt16 RES_CHRATR_BEGIN(HINT_BEGIN)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(105)
weld::Window * GetFrameWeld() const
#define FN_FORMAT_PAGE_COLUMN_DLG
Definition: cmdid.h:327
bool Left(sal_uInt16 nMode, bool bSelect, sal_uInt16 nCount, bool bBasicCall, bool bVisual=false)
Definition: move.cxx:110
SwMoveFnCollection const & fnTableStart
Definition: paminit.cxx:52
HTMLMODE_SOME_STYLES
SwUndoId GetRepeatInfo(OUString *const o_pStr) const
Definition: edws.cxx:251
#define FN_CONVERT_TEXT_TABLE
Definition: cmdid.h:358
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
virtual bool GetLastUndoInfo(OUString *const o_pStr, SwUndoId *const o_pId, const SwView *pView=nullptr) const =0
Get Id and comment of last Undo action.
void UpdateAllLinks(bool bAskUpdate, bool bUpdateGrfLinks, weld::Window *pParentWin)
unsigned char sal_uInt8
void LockView(bool b)
Definition: viewsh.hxx:467
#define GetWhich(nSlot)
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:428
bool MoveTable(SwWhichTable, SwMoveFnCollection const &)
Definition: trvltbl.cxx:682
bool IsCursorPtAtEnd() const
Definition: crsrsh.hxx:903
bool IsTextToTableAvailable() const
Definition: edtab.cxx:198
The UI part presenting the graphic size check results, which is used by GenericCheckDialog.
void SetTableStyleName(const OUString &rName)
Set the new table style name for this table.
Definition: swtable.hxx:194
void Do(DoType eDoType, sal_uInt16 nCnt=1, sal_uInt16 nOffset=0)
Definition: wrtundo.cxx:33
bool TableToText(sal_Unicode cCh)
Definition: edtab.cxx:149
RET_OK
IDocumentSettingAccess const & getIDocumentSettingAccess() const
Definition: doc.cxx:176
static sal_uInt8 nHeaderPos
Definition: basesh.cxx:121
#define FN_BACKSPACE
Definition: cmdid.h:676
void ChgPageDesc(size_t i, const SwPageDesc &)
Definition: fedesc.cxx:111
#define FN_TABLE_PASTE_COL_BEFORE
Definition: cmdid.h:312
size_t IsObjSelected() const
Definition: feshview.cxx:1246
bool IsNoNum(bool bChkStart=true) const
Definition: ednumber.cxx:672
virtual bool DoesRepair() const =0
Is repair mode active?
void UnSelectFrame()
Definition: select.cxx:323
QPRO_FUNC_TYPE nType
void StateUndo(SfxItemSet &)
Definition: basesh.cxx:688
void ClickToField(const SwField &rField, bool bExecHyperlinks)
Definition: wrtsh2.cxx:342
const SfxPoolItem & GetFormatAttr(sal_uInt16 nWhich, bool bInParents=true) const
If bInParents is FALSE, search only in this format for attribute.
Definition: format.cxx:367
PasteTableType
Definition: swdtflvr.hxx:67
void AutoUpdateFrame(SwFrameFormat *pFormat, const SfxItemSet &rStyleSet)
Definition: wrtsh1.cxx:1897
#define FN_FORMAT_PAGE_DLG
Definition: cmdid.h:329
#define FN_CONVERT_TEXT_TO_TABLE
Definition: cmdid.h:386
sal_Int16 GetVertOrient() const
Definition: fmtornt.hxx:54
void InvalidateRulerPos()
Definition: viewport.cxx:107
#define FN_TOOL_ANCHOR_PARAGRAPH
Definition: cmdid.h:237
#define FN_PAGE_STYLE_SET_UL_MARGIN
Definition: cmdid.h:392
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
bool GetFirstRedoInfo(OUString *const o_pStr, SwUndoId *const o_pId, const SwView *pView=nullptr) const
Definition: edws.cxx:244
Header, for PageFormats Client of FrameFormat describing the header.
Definition: fmthdft.hxx:33
void ClearMark()
Definition: crsrsh.cxx:939
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
Definition: edattr.cxx:171
constexpr sal_uInt16 RES_CHRATR_END(46)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(106)
void SetObjAttr(const SfxItemSet &rSet)
Definition: feshview.cxx:2796
virtual void CalcLayout() override
To enable set up of StartActions and EndActions.
Definition: edws.cxx:108
void GetTabBorders(SfxItemSet &rSet) const
Definition: fetab.cxx:849
void Execute(SfxRequest &)
void LeaveSelFrameMode()
Definition: select.cxx:720
void SetVertical(bool bVertical)
virtual VclPtr< VclAbstractDialog > CreateTitlePageDlg(weld::Window *pParent)=0
#define FN_UPDATE_INPUTFIELDS
Definition: cmdid.h:103
SW_DLLPUBLIC void PrepareBoxInfo(SfxItemSet &rSet, const SwWrtShell &rSh)
Definition: uitool.cxx:81
void UpdateDocStat()
Document - Statistics.
Definition: editsh.cxx:426
#define FN_SET_TRACKED_CHANGES_IN_TEXT
Definition: cmdid.h:198
#define FN_SHIFT_BACKSPACE
Definition: cmdid.h:691
const sal_uInt16 CRSR_SKIP_CHARS
Definition: swcrsr.hxx:65
void InvalidateAll(bool bWithMsg)
HTMLMODE_FULL_STYLES
void AppendItem(const SfxPoolItem &)
bool IsTableComplexForChart()
Definition: trvltbl.cxx:726
bool AddGrfUpdateSlot(sal_uInt16 nSlot)
Definition: basesh.hxx:61
#define FN_GOTO_PREV_MARK
Definition: cmdid.h:727
void Update(const Graphic &rGraphic, bool bGraphicLinked, const tools::PolyPolygon *pPolyPoly, void *pEditingObj)
Reference< XModel > xModel
RndStdIds
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLBACKGROUND)
virtual SotClipboardFormatId GetFormatOnly()=0
SwView & m_rView
Definition: basesh.hxx:41
void EnterSelFrameMode(const Point *pStartDrag=nullptr)
Definition: select.cxx:702
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
bool IsEndPara() const
Definition: crsrsh.cxx:1114
void GotoFlyAnchor()
jump from the frame to the anchor
Definition: trvlfnfl.cxx:354
#define FN_CONVERT_TABLE_TO_TEXT
Definition: cmdid.h:387
SectionType GetType() const
Definition: section.hxx:169
static bool PasteUnformatted(SwWrtShell &rSh, TransferableDataHelper &)
Definition: swdtflvr.cxx:3459
const SwInsertTableOptions & GetInsTableFlags(bool bHTML) const
Definition: modcfg.hxx:303
LanguageType GetInputLanguage() const
void Init(sal_uInt16 nNumCols, sal_uInt16 nGutterWidth, sal_uInt16 nAct)
This function allows to (repeatedly) initialize the columns.
Definition: atrfrm.cxx:970
SelectionType GetSelectionType() const
Definition: wrtsh1.cxx:1675
virtual void ApplyViewOptions(const SwViewOption &rOpt) override
Apply ViewOptions with Start-/EndAction.
Definition: wrtsh1.cxx:2071
#define FN_ESCAPE
Definition: cmdid.h:690
void StartAllAction()
For all views of this document.
Definition: edws.cxx:86
bool IsLinkedGrfSwapOut() const
Definition: editsh.cxx:250
#define FN_PREV_BOOKMARK
Definition: cmdid.h:121
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2172
bool GetTableCopied() const
Definition: fesh.hxx:651
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CTL_FONTSIZE(28)
ShellMode GetShellMode() const
Definition: view0.cxx:105
void Ignore()
size_t GetCurPageDesc(const bool bCalcFrame=true) const
Definition: fedesc.cxx:167
void SetGutterWidth(sal_uInt16 nNew, sal_uInt16 nAct)
Adjusts borders for columns in aColumns.
Definition: atrfrm.cxx:950
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CJK_FONTSIZE(23)
void StateStyleSheet(SfxItemSet &, SwWrtShell *pSh=nullptr)
Definition: docst.cxx:86
#define FN_FRAME_NOWRAP
Definition: cmdid.h:340
::std::vector< OUString > TargetList
#define FN_GOTO_PREV_OBJ
Definition: cmdid.h:695
FrameTypeFlags GetFrameType(const Point *pPt, bool bStopAtFly) const
For return values see above FrameType.
Definition: fews.cxx:237
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_POSTURE(11)
bool IsFrameSelected() const
Definition: feshview.cxx:1254
bool GetBoxBackground(std::unique_ptr< SvxBrushItem > &rToFill) const
FALSE ambiguous.
Definition: fetab.cxx:862
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
virtual SfxObjectShell * GetObjectShell()
constexpr TypedWhichId< SvxShadowItem > RES_SHADOW(107)
bool IsViewLocked() const
Definition: viewsh.hxx:466
void HideCursor()
Definition: crsrsh.cxx:2417
#define FN_FRAME_WRAP_CONTOUR
Definition: cmdid.h:432
Definition: view.hxx:144
const SwFrameFormat * GetHeaderFormat() const
Definition: fmthdft.hxx:54
const Color & GetValue() const
sal_uInt16 nPos
constexpr TypedWhichId< SwFormatAnchor > RES_ANCHOR(104)
bool IsSelFrameMode() const
Definition: wrtsh.hxx:176
void UpdateFlyFrame()
Definition: frmmgr.cxx:158
void SetValue(const Color &rNewColor)
ViewShellId GetViewShellId() const override
void EndAction(const bool bIdleEnd=false)
Definition: crsrsh.cxx:244
virtual VclPtr< SfxAbstractDialog > CreateSwBorderDlg(weld::Window *pParent, SfxItemSet &rSet, SwBorderModes nType)=0
void ExecDelete(SfxRequest &)
Definition: basesh.cxx:197
SAL_DLLPRIVATE bool Load(SvStream &rStream)
Definition: tblafmt.cxx:1047
bool CursorInsideInputField() const
Definition: crstrvl.cxx:995