LibreOffice Module sw (master)  1
view2.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 <com/sun/star/util/SearchAlgorithms2.hpp>
24 #include <o3tl/any.hxx>
25 #include <vcl/graphicfilter.hxx>
26 #include <com/sun/star/sdb/DatabaseContext.hpp>
27 #include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
28 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
29 #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
30 #include <com/sun/star/ui/dialogs/ListboxControlActions.hpp>
31 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
32 #include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
33 #include <com/sun/star/linguistic2/XDictionary.hpp>
35 #include <officecfg/Office/Common.hxx>
36 #include <SwCapObjType.hxx>
37 #include <SwStyleNameMapper.hxx>
38 #include <docary.hxx>
39 #include <hintids.hxx>
40 #include <SwRewriter.hxx>
41 #include <numrule.hxx>
42 #include <swundo.hxx>
43 #include <svl/PasswordHelper.hxx>
44 #include <svl/urihelper.hxx>
45 #include <sfx2/passwd.hxx>
46 #include <sfx2/sfxdlg.hxx>
47 #include <sfx2/filedlghelper.hxx>
48 #include <editeng/langitem.hxx>
49 #include <svx/viewlayoutitem.hxx>
50 #include <svx/zoomslideritem.hxx>
51 #include <svx/linkwarn.hxx>
52 #include <sfx2/htmlmode.hxx>
53 #include <vcl/svapp.hxx>
54 #include <sfx2/app.hxx>
55 #include <sfx2/request.hxx>
56 #include <sfx2/bindings.hxx>
57 #include <editeng/lrspitem.hxx>
59 #include <unotools/syslocale.hxx>
60 #include <editeng/unolingu.hxx>
61 #include <vcl/weld.hxx>
62 #include <editeng/tstpitem.hxx>
63 #include <sfx2/event.hxx>
64 #include <sfx2/docfile.hxx>
65 #include <sfx2/docfilt.hxx>
66 #include <sfx2/fcontnr.hxx>
67 #include <editeng/sizeitem.hxx>
68 #include <sfx2/dispatch.hxx>
69 #include <svl/whiter.hxx>
70 #include <svl/ptitem.hxx>
71 #include <sfx2/viewfrm.hxx>
72 #include <vcl/errinf.hxx>
73 #include <tools/urlobj.hxx>
74 #include <svx/svdview.hxx>
75 #include <swtypes.hxx>
76 #include <swwait.hxx>
77 #include <redlndlg.hxx>
78 #include <gotodlg.hxx>
79 #include <view.hxx>
80 #include <uivwimp.hxx>
81 #include <docsh.hxx>
82 #include <doc.hxx>
83 #include <printdata.hxx>
87 #include <IDocumentUndoRedo.hxx>
90 #include <IDocumentStatistics.hxx>
91 #include <wrtsh.hxx>
92 #include <viewopt.hxx>
93 #include <basesh.hxx>
94 #include <swmodule.hxx>
95 #include <uitool.hxx>
96 #include <shellio.hxx>
97 #include <fmtinfmt.hxx>
98 #include <mdiexp.hxx>
99 #include <drawbase.hxx>
100 #include <frmatr.hxx>
101 #include <frmmgr.hxx>
102 #include <pagedesc.hxx>
103 #include <section.hxx>
104 #include <tox.hxx>
105 #include <edtwin.hxx>
106 #include <wview.hxx>
107 #include <cmdid.h>
108 #include <sfx2/strings.hrc>
109 #include <sfx2/sfxresid.hxx>
110 #include <strings.hrc>
111 #include <swerror.h>
112 #include <globals.hrc>
113 #include <fmtclds.hxx>
114 #include <sfx2/templatedlg.hxx>
115 #include <dbconfig.hxx>
116 #include <dbmgr.hxx>
117 #include <reffld.hxx>
118 #include <comphelper/lok.hxx>
119 #include <comphelper/string.hxx>
121 
122 #include <PostItMgr.hxx>
123 
125 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
126 
127 #include <svx/svxdlg.hxx>
128 #include <swabstdlg.hxx>
129 #include <fmthdft.hxx>
130 #include <unotextrange.hxx>
131 #include <docstat.hxx>
132 #include <wordcountdialog.hxx>
133 #include <sfx2/sidebar/Sidebar.hxx>
134 
137 #include <vcl/settings.hxx>
138 #include <i18nutil/searchopt.hxx>
139 #include <osl/diagnose.h>
140 #include <paratr.hxx>
141 #include <rootfrm.hxx>
142 #include <frameformats.hxx>
143 
144 #include <viewimp.hxx>
145 #include <pagefrm.hxx>
146 
147 #include <memory>
148 #include <string_view>
149 #include <svl/slstitm.hxx>
150 
152 
153 #include <ndtxt.hxx>
154 
155 #include <svx/srchdlg.hxx>
156 #include <o3tl/string_view.hxx>
157 
158 const char sStatusDelim[] = " : ";
159 
160 using namespace sfx2;
161 using namespace ::com::sun::star;
162 using namespace ::com::sun::star::i18n;
163 using namespace ::com::sun::star::util;
164 using namespace ::com::sun::star::uno;
165 using namespace ::com::sun::star::lang;
166 using namespace ::com::sun::star::scanner;
167 using namespace ::com::sun::star::beans;
168 using namespace ::com::sun::star::container;
169 using namespace ::com::sun::star::sdb;
170 using namespace ::com::sun::star::ui::dialogs;
171 
172 static void lcl_SetAllTextToDefaultLanguage( SwWrtShell &rWrtSh, sal_uInt16 nWhichId )
173 {
174  if (!(nWhichId == RES_CHRATR_LANGUAGE ||
175  nWhichId == RES_CHRATR_CJK_LANGUAGE ||
176  nWhichId == RES_CHRATR_CTL_LANGUAGE))
177  return;
178 
179  rWrtSh.StartAction();
180  rWrtSh.LockView( true );
181  rWrtSh.Push();
182 
183  // prepare to apply new language to all text in document
184  rWrtSh.SelAll();
185  rWrtSh.ExtendedSelectAll();
186 
187  // set language attribute to default for all text
188  rWrtSh.ResetAttr({ nWhichId });
189 
191  rWrtSh.LockView( false );
192  rWrtSh.EndAction();
193 
194 }
195 
205 OUString SwView::GetPageStr(sal_uInt16 nPhyNum, sal_uInt16 nVirtNum, const OUString& rPgStr)
206 {
207  // Show user-defined page number in brackets if any.
208  OUString extra;
209  if (!rPgStr.isEmpty() && std::u16string_view(OUString::number(nPhyNum)) != rPgStr)
210  extra = rPgStr;
211  else if (nPhyNum != nVirtNum)
212  extra = OUString::number(nVirtNum);
213 
214  sal_uInt16 nPageCount = GetWrtShell().GetPageCnt();
215  sal_uInt16 nPrintedPhyNum = nPhyNum;
216  sal_uInt16 nPrintedPageCount = nPageCount;
217  if (!GetWrtShell().getIDocumentDeviceAccess().getPrintData().IsPrintEmptyPages())
218  SwDoc::CalculateNonBlankPages(*m_pWrtShell->GetLayout(), nPrintedPageCount, nPrintedPhyNum);
219  // Show printed page numbers only, when they are different
220  OUString aStr( nPageCount != nPrintedPageCount
221  ? SwResId(STR_PAGE_COUNT_PRINTED)
222  : (extra.isEmpty() ? SwResId(STR_PAGE_COUNT) : SwResId(STR_PAGE_COUNT_CUSTOM)));
223  aStr = aStr.replaceFirst("%1", OUString::number(nPhyNum));
224  aStr = aStr.replaceFirst("%2", OUString::number(nPageCount));
225  if (nPageCount != nPrintedPageCount)
226  {
227  aStr = aStr.replaceFirst("%3", OUString::number(nPrintedPhyNum));
228  aStr = aStr.replaceFirst("%4", OUString::number(nPrintedPageCount));
229  }
230  else
231  aStr = aStr.replaceFirst("%3", extra);
232 
233  return aStr;
234 }
235 
236 ErrCode SwView::InsertGraphic( const OUString &rPath, const OUString &rFilter,
237  bool bLink, GraphicFilter *pFilter )
238 {
239  SwWait aWait( *GetDocShell(), true );
240 
241  Graphic aGraphic;
242  ErrCode aResult = ERRCODE_NONE;
243  if( !pFilter )
244  {
245  pFilter = &GraphicFilter::GetGraphicFilter();
246  }
247  aResult = GraphicFilter::LoadGraphic( rPath, rFilter, aGraphic, pFilter );
248 
249  if( ERRCODE_NONE == aResult )
250  {
251  GraphicNativeMetadata aMetadata;
252  if ( aMetadata.read(aGraphic) )
253  {
254  const Degree10 aRotation = aMetadata.getRotation();
255  if (aRotation)
256  {
257  GraphicNativeTransform aTransform( aGraphic );
258  aTransform.rotate( aRotation );
259  }
260  }
261 
262  SwFlyFrameAttrMgr aFrameManager( true, GetWrtShellPtr(), Frmmgr_Type::GRF, nullptr );
263  SwWrtShell& rShell = GetWrtShell();
264 
265  // #i123922# determine if we really want to insert or replace the graphic at a selected object
266  const bool bReplaceMode(rShell.HasSelection() && SelectionType::Frame == rShell.GetSelectionType());
267 
268  if(bReplaceMode)
269  {
270  // #i123922# Do same as in D&D, ReRead graphic and all is done
271  rShell.ReRead(
272  bLink ? rPath : OUString(),
273  bLink ? rFilter : OUString(),
274  &aGraphic);
275  }
276  else
277  {
278  rShell.StartAction();
279  if( bLink )
280  {
281  SwDocShell* pDocSh = GetDocShell();
282  INetURLObject aTemp(
283  pDocSh->HasName() ?
285  OUString());
286 
287  OUString sURL = URIHelper::SmartRel2Abs(
288  aTemp, rPath, URIHelper::GetMaybeFileHdl() );
289  aGraphic.setOriginURL(sURL);
290  rShell.Insert( sURL, rFilter, aGraphic, &aFrameManager );
291  }
292  else
293  {
294  rShell.Insert( OUString(), OUString(), aGraphic, &aFrameManager );
295  }
296 
297  // it is too late after "EndAction" because the Shell can already be destroyed.
298  rShell.EndAction();
299  }
300  }
301  return aResult;
302 }
303 
305 {
306  bool bReturn = false;
307  SwDocShell* pDocShell = GetDocShell();
308  SwDoc* pDoc = pDocShell->GetDoc();
309 
310  OUString sGraphicFormat = SwResId(STR_POOLFRM_GRAPHIC);
311 
312 // No file pickers in a non-desktop (mobile app) build.
313 
314 #if HAVE_FEATURE_DESKTOP
315  // when in HTML mode insert only as a link
316  const sal_uInt16 nHtmlMode = ::GetHtmlMode(pDocShell);
317  std::unique_ptr<FileDialogHelper> pFileDlg(new FileDialogHelper(
318  ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE,
319  FileDialogFlags::Graphic, GetFrameWeld()));
320  pFileDlg->SetTitle(SwResId(STR_INSERT_GRAPHIC ));
321  pFileDlg->SetContext( FileDialogHelper::WriterInsertImage );
322 
323  uno::Reference < XFilePicker3 > xFP = pFileDlg->GetFilePicker();
324  uno::Reference < XFilePickerControlAccess > xCtrlAcc(xFP, UNO_QUERY);
325  if(nHtmlMode & HTMLMODE_ON)
326  {
327  xCtrlAcc->setValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, Any(true));
328  xCtrlAcc->enableControl( ExtendedFilePickerElementIds::CHECKBOX_LINK, false);
329  }
330 
331  std::vector<OUString> aFormats;
332  const size_t nArrLen = pDoc->GetFrameFormats()->size();
333  for( size_t i = 0; i < nArrLen; ++i )
334  {
335  const SwFrameFormat* pFormat = (*pDoc->GetFrameFormats())[ i ];
336  if(pFormat->IsDefault() || pFormat->IsAuto())
337  continue;
338  aFormats.push_back(pFormat->GetName());
339  }
340 
341  // pool formats
342 
343  const std::vector<OUString>& rFramePoolArr(
345  for(const auto & i : rFramePoolArr)
346  {
347  aFormats.push_back(i);
348  }
349 
350  std::sort(aFormats.begin(), aFormats.end());
351  aFormats.erase(std::unique(aFormats.begin(), aFormats.end()), aFormats.end());
352 
353  Sequence<OUString> aListBoxEntries(aFormats.size());
354  OUString* pEntries = aListBoxEntries.getArray();
355  sal_Int16 nSelect = 0;
356  for( size_t i = 0; i < aFormats.size(); ++i )
357  {
358  pEntries[i] = aFormats[i];
359  if(pEntries[i] == sGraphicFormat)
360  nSelect = i;
361  }
362  try
363  {
364  Any aTemplates(&aListBoxEntries, cppu::UnoType<decltype(aListBoxEntries)>::get());
365 
366  xCtrlAcc->setValue( ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE,
367  ListboxControlActions::ADD_ITEMS , aTemplates );
368 
369  Any aSelectPos(&nSelect, cppu::UnoType<decltype(nSelect)>::get());
370  xCtrlAcc->setValue( ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE,
371  ListboxControlActions::SET_SELECT_ITEM, aSelectPos );
372  }
373  catch (const Exception&)
374  {
375  OSL_FAIL("control access failed");
376  }
377 #endif
378 
379  const SfxStringItem* pName = rReq.GetArg<SfxStringItem>(SID_INSERT_GRAPHIC);
380  bool bShowError = !pName;
381  if( pName
382 #if HAVE_FEATURE_DESKTOP
383  || ERRCODE_NONE == pFileDlg->Execute()
384 #endif
385  )
386  {
387 
388  OUString aFileName, aFilterName;
389  if ( pName )
390  {
391  aFileName = pName->GetValue();
392  const SfxStringItem* pFilter = rReq.GetArg<SfxStringItem>(FN_PARAM_FILTER);
393  if ( pFilter )
394  aFilterName = pFilter->GetValue();
395  }
396 #if HAVE_FEATURE_DESKTOP
397  else
398  {
399  aFileName = pFileDlg->GetPath();
400  aFilterName = pFileDlg->GetCurrentFilter();
401  rReq.AppendItem( SfxStringItem( SID_INSERT_GRAPHIC, aFileName ) );
402  rReq.AppendItem( SfxStringItem( FN_PARAM_FILTER, aFilterName ) );
403 
404  bool bAsLink = false;
405  if(nHtmlMode & HTMLMODE_ON)
406  bAsLink = true;
407  else
408  {
409  try
410  {
411  Any aVal = xCtrlAcc->getValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0);
412  OSL_ENSURE(aVal.hasValue(), "Value CBX_INSERT_AS_LINK not found");
413  bAsLink = !aVal.hasValue() || *o3tl::doAccess<bool>(aVal);
414  Any aTemplateValue = xCtrlAcc->getValue(
415  ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE,
416  ListboxControlActions::GET_SELECTED_ITEM );
417  OUString sTmpl;
418  aTemplateValue >>= sTmpl;
419  rReq.AppendItem( SfxStringItem( FN_PARAM_2, sTmpl) );
420  }
421  catch (const Exception&)
422  {
423  OSL_FAIL("control access failed");
424  }
425  }
426  rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bAsLink ) );
427  }
428  const SfxBoolItem* pAsLink = rReq.GetArg<SfxBoolItem>(FN_PARAM_1);
429  const SfxStringItem* pStyle = rReq.GetArg<SfxStringItem>(FN_PARAM_2);
430 #endif
431 
432  bool bAsLink = false;
433 
434 #if HAVE_FEATURE_DESKTOP
435  if( nHtmlMode & HTMLMODE_ON )
436  bAsLink = true;
437  else
438  {
439  if ( rReq.GetArgs() )
440  {
441  if ( pAsLink )
442  bAsLink = pAsLink->GetValue();
443  if ( pStyle && !pStyle->GetValue().isEmpty() )
444  sGraphicFormat = pStyle->GetValue();
445  }
446  else
447  {
448  Any aVal = xCtrlAcc->getValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0);
449  OSL_ENSURE(aVal.hasValue(), "Value CBX_INSERT_AS_LINK not found");
450  bAsLink = !aVal.hasValue() || *o3tl::doAccess<bool>(aVal);
451  Any aTemplateValue = xCtrlAcc->getValue(
452  ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE,
453  ListboxControlActions::GET_SELECTED_ITEM );
454  OUString sTmpl;
455  aTemplateValue >>= sTmpl;
456  if( !sTmpl.isEmpty() )
457  sGraphicFormat = sTmpl;
458  rReq.AppendItem( SfxStringItem( FN_PARAM_2, sGraphicFormat ) );
459  rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bAsLink ) );
460  }
461 
462  // really store as link only?
464  {
465  SvxLinkWarningDialog aWarnDlg(GetFrameWeld(), pFileDlg->GetPath());
466  if (aWarnDlg.run() != RET_OK)
467  bAsLink=false; // don't store as link
468  }
469  }
470 #endif
471 
472  SwWrtShell& rSh = GetWrtShell();
473  rSh.LockPaint();
474  rSh.StartAction();
475 
476  SwRewriter aRewriter;
477  aRewriter.AddRule(UndoArg1, SwResId(STR_GRAPHIC_DEFNAME));
478 
479  // #i123922# determine if we really want to insert or replace the graphic at a selected object
480  const bool bReplaceMode(rSh.HasSelection() && SelectionType::Frame == rSh.GetSelectionType());
481 
482  rSh.StartUndo(SwUndoId::INSERT, &aRewriter);
483 
484  ErrCode nError = InsertGraphic( aFileName, aFilterName, bAsLink, &GraphicFilter::GetGraphicFilter() );
485 
486  // format not equal to current filter (with autodetection)
487  if( nError == ERRCODE_GRFILTER_FORMATERROR )
488  nError = InsertGraphic( aFileName, OUString(), bAsLink, &GraphicFilter::GetGraphicFilter() );
489 
490  // #i123922# no new FrameFormat for replace mode, only when new object was created,
491  // else this would reset the current setting for the frame holding the graphic
492  if ( !bReplaceMode && rSh.IsFrameSelected() )
493  {
494  SwFrameFormat* pFormat = pDoc->FindFrameFormatByName( sGraphicFormat );
495  if(!pFormat)
496  pFormat = pDoc->MakeFrameFormat(sGraphicFormat,
497  pDocShell->GetDoc()->GetDfltFrameFormat(),
498  true, false);
499  rSh.SetFrameFormat( pFormat );
500  }
501 
502  TranslateId pResId;
503  if( nError == ERRCODE_GRFILTER_OPENERROR )
504  pResId = STR_GRFILTER_OPENERROR;
505  else if( nError == ERRCODE_GRFILTER_IOERROR )
506  pResId = STR_GRFILTER_IOERROR;
507  else if( nError ==ERRCODE_GRFILTER_FORMATERROR )
508  pResId = STR_GRFILTER_FORMATERROR;
509  else if( nError ==ERRCODE_GRFILTER_VERSIONERROR )
510  pResId = STR_GRFILTER_VERSIONERROR;
511  else if( nError ==ERRCODE_GRFILTER_FILTERERROR )
512  pResId = STR_GRFILTER_FILTERERROR;
513  else if( nError ==ERRCODE_GRFILTER_TOOBIG )
514  pResId = STR_GRFILTER_TOOBIG;
515 
516  rSh.EndAction();
517  rSh.UnlockPaint();
518  if (pResId)
519  {
520  if( bShowError )
521  {
522  std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
523  VclMessageType::Info, VclButtonsType::Ok,
524  SwResId(pResId)));
525  xInfoBox->run();
526  }
527  rReq.Ignore();
528  }
529  else
530  {
531  // set the specific graphic attributes to the graphic
532  bReturn = true;
533  AutoCaption( GRAPHIC_CAP );
534  rReq.Done();
535  }
536 
537  rSh.EndUndo(); // due to possible change of Shell
538  }
539 
540  return bReturn;
541 }
542 
544 {
545  const sal_uInt16 nSlot = rReq.GetSlot();
546  const SfxItemSet* pArgs = rReq.GetArgs();
547  const SfxPoolItem* pItem;
548  bool bIgnore = false;
549  switch( nSlot )
550  {
551  case SID_CREATE_SW_DRAWVIEW:
552  m_pWrtShell->getIDocumentDrawModelAccess().GetOrCreateDrawModel();
553  break;
554 
556  {
560  aContext.maEndDialogFn = [](sal_Int32){};
561  pDlg->StartExecuteAsync(aContext);
562  break;
563  }
564  case FN_EDIT_LINK_DLG:
565  EditLinkDlg();
566  break;
567  case SID_REFRESH_VIEW:
568  GetEditWin().Invalidate();
569  m_pWrtShell->Reformat();
570  break;
571  case FN_PAGEUP:
572  case FN_PAGEUP_SEL:
573  case FN_PAGEDOWN:
574  case FN_PAGEDOWN_SEL:
575  {
576  tools::Rectangle aVis( GetVisArea() );
577  SwEditWin& rTmpWin = GetEditWin();
578  if ( FN_PAGEUP == nSlot || FN_PAGEUP_SEL == nSlot )
579  PageUpCursor(FN_PAGEUP_SEL == nSlot);
580  else
581  PageDownCursor(FN_PAGEDOWN_SEL == nSlot);
582 
583  rReq.SetReturnValue(SfxBoolItem(nSlot,
584  aVis != GetVisArea()));
585  //#i42732# - notify the edit window that from now on we do not use the input language
586  rTmpWin.SetUseInputLanguage( false );
587  }
588  break;
589  case SID_ZOOM_IN:
590  case SID_ZOOM_OUT:
591  {
592  tools::Long nFact = m_pWrtShell->GetViewOptions()->GetZoom();
593  if (SID_ZOOM_IN == nSlot)
594  nFact = basegfx::zoomtools::zoomIn(nFact);
595  else
596  nFact = basegfx::zoomtools::zoomOut(nFact);
597  SetZoom(SvxZoomType::PERCENT, nFact);
598  }
599  break;
600  case FN_TO_PREV_PAGE:
601  case FN_TO_NEXT_PAGE:
602  {
603  sal_uInt16 nPage = 0;
604  if (m_pWrtShell->IsCursorVisible())
605  nPage = m_pWrtShell->GetCursor()->GetPageNum();
606  else
607  {
608  SwFrame* pPageFrame = m_pWrtShell->Imp()->GetFirstVisPage(m_pWrtShell->GetOut());
609  if (pPageFrame)
610  nPage = pPageFrame->GetPhyPageNum();
611  }
612  if (nPage != 0)
613  {
614  sal_uInt16 nOldPage(nPage);
615  if (FN_TO_PREV_PAGE == nSlot && nPage > 1)
616  nPage--;
617  else if (FN_TO_NEXT_PAGE == nSlot && nPage < m_pWrtShell->GetPageCount())
618  nPage++;
619  if (nPage != nOldPage)
620  {
621  m_pWrtShell->LockPaint();
622  if (IsDrawMode())
623  LeaveDrawCreate();
624  m_pWrtShell->EnterStdMode();
625  m_pWrtShell->GotoPage(nPage, true);
626  // set visible area (borrowed from SwView::PhyPageUp/Down)
627  const Point aPt(m_aVisArea.Left(), m_pWrtShell->GetPagePos(nPage).Y());
628  Point aAlPt(AlignToPixel(aPt));
629  if(aPt.Y() != aAlPt.Y())
630  aAlPt.AdjustY(3 * GetEditWin().PixelToLogic(Size(0, 1)).Height());
631  SetVisArea(aAlPt);
632  m_pWrtShell->UnlockPaint();
633  }
634  }
635  }
636  break;
637  case FN_SELECTION_CYCLE:
638  {
639  if (m_pWrtShell->IsSelFrameMode())
640  break;
641  if (!m_pWrtShell->IsStdMode())
642  m_pWrtShell->EnterStdMode();
643  SwShellCursor *pCursor = m_pWrtShell->SwCursorShell::GetCursor_();
644  Point CurrMarkPt = pCursor->GetMkPos();
645  Point CurrPointPt = pCursor->GetPtPos();
646  sal_uInt16 nStep = m_aSelectCycle.nStep;
647  if (nStep && (CurrMarkPt != m_aSelectCycle.m_MarkPt || CurrPointPt != m_aSelectCycle.m_PointPt))
648  nStep = 0;
649  switch(nStep)
650  {
651  case 0:
652  m_aSelectCycle.m_pInitialCursor = CurrPointPt;
653  m_pWrtShell->SwCursorShell::ClearMark();
654  m_pWrtShell->SelWrd(&CurrPointPt);
655  break;
656  case 1:
657  m_pWrtShell->SelSentence(&CurrPointPt);
658  break;
659  case 2:
660  m_pWrtShell->SelPara(&CurrPointPt);
661  break;
662  case 3:
663  m_pWrtShell->SwCursorShell::ClearMark();
664  m_pWrtShell->SwCursorShell::SetCursor(m_aSelectCycle.m_pInitialCursor);
665  break;
666  }
667  nStep++;
668  nStep %= 4;
669  pCursor = m_pWrtShell->SwCursorShell::GetCursor_();
670  m_aSelectCycle.m_MarkPt = pCursor->GetMkPos();
671  m_aSelectCycle.m_PointPt = pCursor->GetPtPos();
672  m_aSelectCycle.nStep = nStep;
673  }
674  break;
675  case FN_REDLINE_ON:
676  {
677  if( pArgs &&
678  SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem ))
679  {
680  IDocumentRedlineAccess& rIDRA = m_pWrtShell->getIDocumentRedlineAccess();
681  Sequence <sal_Int8> aPasswd = rIDRA.GetRedlinePassword();
682  if( aPasswd.hasElements() )
683  {
684  OSL_ENSURE( !static_cast<const SfxBoolItem*>(pItem)->GetValue(), "SwView::Execute(): password set and redlining off doesn't match!" );
685 
686  // xmlsec05: new password dialog
687  SfxPasswordDialog aPasswdDlg(GetFrameWeld());
688  aPasswdDlg.SetMinLen(1);
689  //#i69751# the result of Execute() can be ignored
690  (void)aPasswdDlg.run();
691  OUString sNewPasswd(aPasswdDlg.GetPassword());
692 
693  // password verification
694  bool bPasswordOk = false;
695  if (aPasswd.getLength() == 1 && aPasswd[0] == 1)
696  {
697  // dummy RedlinePassword from OOXML import: get real password info
698  // from the grab-bag to verify the password
699  const css::uno::Sequence< css::beans::PropertyValue > aDocumentProtection =
700  static_cast<SfxObjectShell*>(GetDocShell())->
701  GetDocumentProtectionFromGrabBag();
702 
703  bPasswordOk =
704  // password is ok, if there is no DocumentProtection in the GrabBag,
705  // i.e. the dummy RedlinePassword imported from an OpenDocument file
706  !aDocumentProtection.hasElements() ||
707  // verify password with the password info imported from OOXML
709  ::comphelper::DocPasswordHelper::ConvertPasswordInfo ( aDocumentProtection ) );
710  }
711  else
712  {
713  // the simplified RedlinePassword
714  Sequence <sal_Int8> aNewPasswd = rIDRA.GetRedlinePassword();
715  SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd );
716  bPasswordOk = SvPasswordHelper::CompareHashPassword(aPasswd, sNewPasswd);
717  }
718 
719  if (bPasswordOk)
720  rIDRA.SetRedlinePassword(Sequence <sal_Int8> ());
721  else
722  { // xmlsec05: message box for wrong password
723  std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(nullptr,
724  VclMessageType::Info, VclButtonsType::Ok,
725  SfxResId(RID_SVXSTR_INCORRECT_PASSWORD)));
726  xInfoBox->run();
727  break;
728  }
729  }
730 
731  SwDocShell* pDocShell = GetDocShell();
732  pDocShell->SetChangeRecording( static_cast<const SfxBoolItem*>(pItem)->GetValue(), /*bLockAllViews=*/true );
733 
734  // Notify all view shells of this document, as the track changes mode is document-global.
735  for (SfxViewFrame* pViewFrame = SfxViewFrame::GetFirst(pDocShell); pViewFrame; pViewFrame = SfxViewFrame::GetNext(*pViewFrame, pDocShell))
736  {
737  pViewFrame->GetBindings().Invalidate(FN_REDLINE_ON);
738  pViewFrame->GetBindings().Update(FN_REDLINE_ON);
739  }
740  }
741  }
742  break;
743  case FN_REDLINE_PROTECT :
744  {
745  IDocumentRedlineAccess& rIDRA = m_pWrtShell->getIDocumentRedlineAccess();
746  Sequence <sal_Int8> aPasswd = rIDRA.GetRedlinePassword();
747  if( pArgs && SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem )
748  && static_cast<const SfxBoolItem*>(pItem)->GetValue() == aPasswd.hasElements() )
749  break;
750 
751  // xmlsec05: new password dialog
752  // message box for wrong password
753  SfxPasswordDialog aPasswdDlg(GetFrameWeld());
754  aPasswdDlg.SetMinLen(1);
755  if (!aPasswd.hasElements())
756  aPasswdDlg.ShowExtras(SfxShowExtras::CONFIRM);
757  if (aPasswdDlg.run())
758  {
760  OUString sNewPasswd(aPasswdDlg.GetPassword());
761  Sequence <sal_Int8> aNewPasswd =
762  rIDRA.GetRedlinePassword();
763  SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd );
764  if(!aPasswd.hasElements())
765  {
766  rIDRA.SetRedlinePassword(aNewPasswd);
767  }
768  else if(SvPasswordHelper::CompareHashPassword(aPasswd, sNewPasswd))
769  {
770  rIDRA.SetRedlinePassword(Sequence <sal_Int8> ());
771  nOn = RedlineFlags::NONE;
772  }
773  const RedlineFlags nMode = rIDRA.GetRedlineFlags();
774  m_pWrtShell->SetRedlineFlagsAndCheckInsMode( (nMode & ~RedlineFlags::On) | nOn);
775  rReq.AppendItem( SfxBoolItem( FN_REDLINE_PROTECT, !(nMode&RedlineFlags::On) ) );
776  }
777  else
778  bIgnore = true;
779  }
780  break;
781  case FN_REDLINE_SHOW:
782 
783  if( pArgs &&
784  SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem))
785  {
786  // tdf#125754 avoid recursive layout
787  // because all views share the layout, have to use AllAction
788  const bool bShow = static_cast<const SfxBoolItem*>(pItem)->GetValue();
789  m_pWrtShell->StartAllAction();
790  // always show redline insertions in Hide Changes mode
791  if ( m_pWrtShell->GetViewOptions()->IsShowChangesInMargin() &&
792  m_pWrtShell->GetViewOptions()->IsShowChangesInMargin2() )
793  {
794  GetDocShell()->GetDoc()->GetDocumentRedlineManager().HideAll(/*bDeletion=*/!bShow);
795  }
796  m_pWrtShell->GetLayout()->SetHideRedlines( !bShow );
797  m_pWrtShell->EndAllAction();
798  if (m_pWrtShell->IsRedlineOn())
799  m_pWrtShell->SetInsMode();
800  }
801  break;
803  case FN_REDLINE_ACCEPT:
804  GetViewFrame()->ToggleChildWindow(nSlot);
805  break;
810  {
811  SwDoc *pDoc = m_pWrtShell->GetDoc();
812  SwPaM *pCursor = m_pWrtShell->GetCursor();
813  const SwRedlineTable& rRedlineTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
815  if (pArgs && pArgs->GetItemState(nSlot, false, &pItem) == SfxItemState::SET)
816  {
817  const sal_Int64 nChangeId = static_cast<const SfxUInt32Item*>(pItem)->GetValue();
818  for (SwRedlineTable::size_type i = 0; i < rRedlineTable.size(); ++i)
819  {
820  if (nChangeId == rRedlineTable[i]->GetId())
821  nRedline = i;
822  }
823  }
824 
825  if( pCursor->HasMark() && nRedline == SwRedlineTable::npos)
826  {
827  bool bAccept = FN_REDLINE_ACCEPT_DIRECT == nSlot || FN_REDLINE_ACCEPT_TONEXT == nSlot;
829  SwWrtShell& rSh = GetWrtShell();
830  SwRewriter aRewriter;
831  bool bTableSelection = rSh.IsTableMode();
832  if ( bTableSelection )
833  {
834  aRewriter.AddRule(UndoArg1, SwResId( STR_REDLINE_TABLECHG ));
835  rSh.StartUndo( eUndoId, &aRewriter);
836  }
837  if ( bAccept )
838  m_pWrtShell->AcceptRedlinesInSelection();
839  else
840  m_pWrtShell->RejectRedlinesInSelection();
841  if ( bTableSelection )
842  rSh.EndUndo( eUndoId, &aRewriter);
843  }
844  else
845  {
846  // We check for a redline at the start of the selection/cursor, not the point.
847  // This ensures we work properly with FN_REDLINE_NEXT_CHANGE, which leaves the
848  // point at the *end* of the redline and the mark at the start (so GetRedline
849  // would return NULL if called on the point)
850  const SwRangeRedline* pRedline = nullptr;
851  if (nRedline != SwRedlineTable::npos)
852  {
853  // A redline was explicitly requested by specifying an
854  // index, don't guess based on the cursor position.
855 
856  if (nRedline < rRedlineTable.size())
857  pRedline = rRedlineTable[nRedline];
858  }
859  else
860  pRedline = pDoc->getIDocumentRedlineAccess().GetRedline(*pCursor->Start(), &nRedline);
861 
862  // accept or reject table row deletion or insertion
863  bool bTableChange = false;
864  if ( !pRedline && m_pWrtShell->IsCursorInTable() )
865  {
866  nRedline = 0;
867  auto pTabLine = pCursor->Start()->nNode.GetNode().GetTableBox()->GetUpper();
868 
869  if ( RedlineType::None != pTabLine->GetRedlineType() )
870  {
871  nRedline = pTabLine->UpdateTextChangesOnly(nRedline);
872 
873  if ( nRedline != SwRedlineTable::npos )
874  {
875  bTableChange = true;
876 
877  SwWrtShell& rSh = GetWrtShell();
878  SwRewriter aRewriter;
879 
880  aRewriter.AddRule(UndoArg1, SwResId(
881  rRedlineTable[nRedline]->GetType() == RedlineType::Delete
882  ? STR_REDLINE_TABLE_ROW_DELETE
883  : STR_REDLINE_TABLE_ROW_INSERT ));
884 
885  SwUndoId eUndoId =
889 
890  rSh.StartUndo( eUndoId, &aRewriter);
891  while ( nRedline != SwRedlineTable::npos && nRedline < rRedlineTable.size() )
892  {
893  pRedline = rRedlineTable[nRedline];
894 
895  // until next redline is not in the same row
896  SwTableBox* pTableBox = pRedline->Start()->nNode.GetNode().GetTableBox();
897  if ( !pTableBox || pTableBox->GetUpper() != pTabLine )
898  break;
899 
900  if (FN_REDLINE_ACCEPT_DIRECT == nSlot || FN_REDLINE_ACCEPT_TONEXT == nSlot)
901  m_pWrtShell->AcceptRedline(nRedline);
902  else
903  m_pWrtShell->RejectRedline(nRedline);
904  }
905  rSh.EndUndo( eUndoId, &aRewriter);
906  }
907  }
908  }
909  else
910  {
911  assert(pRedline != nullptr);
912  }
913 
914  if (pRedline && !bTableChange)
915  {
916  if (FN_REDLINE_ACCEPT_DIRECT == nSlot || FN_REDLINE_ACCEPT_TONEXT == nSlot)
917  m_pWrtShell->AcceptRedline(nRedline);
918  else
919  m_pWrtShell->RejectRedline(nRedline);
920  }
921  }
922  if (FN_REDLINE_ACCEPT_TONEXT == nSlot || FN_REDLINE_REJECT_TONEXT == nSlot)
923  {
924  // Go to next change after accepting or rejecting one (tdf#101977)
925  GetViewFrame()->GetDispatcher()->Execute(FN_REDLINE_NEXT_CHANGE, SfxCallMode::ASYNCHRON);
926  }
927  }
928  break;
929 
931  {
932  // If a parameter is provided, try going to the nth change, not to
933  // the next one.
934  SwDoc* pDoc = m_pWrtShell->GetDoc();
935  const SwRedlineTable& rRedlineTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
937  if (pArgs && pArgs->GetItemState(nSlot, false, &pItem) == SfxItemState::SET)
938  {
939  const sal_uInt32 nChangeId = static_cast<const SfxUInt32Item*>(pItem)->GetValue();
940  for (SwRedlineTable::size_type i = 0; i < rRedlineTable.size(); ++i)
941  {
942  if (nChangeId == rRedlineTable[i]->GetId())
943  nRedline = i;
944  }
945  }
946 
947  const SwRangeRedline *pNext = nullptr;
948  if (nRedline < rRedlineTable.size())
949  pNext = m_pWrtShell->GotoRedline(nRedline, true);
950  else
951  pNext = m_pWrtShell->SelNextRedline();
952 
953  if (pNext)
954  {
956  {
957  OString aPayload(".uno:CurrentTrackedChangeId=");
958  sal_uInt32 nRedlineId = pNext->GetId();
959  aPayload += OString::number(nRedlineId);
960  libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aPayload.getStr());
961  }
962 
963  m_pWrtShell->SetInSelect();
964  }
965 
966  }
967  break;
968 
970  {
971  const SwRangeRedline *pPrev = m_pWrtShell->SelPrevRedline();
972 
973  if (pPrev)
974  {
976  {
977  OString aPayload(".uno:CurrentTrackedChangeId=");
978  sal_uInt32 nRedlineId = pPrev->GetId();
979  aPayload += OString::number(nRedlineId);
980  libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aPayload.getStr());
981  }
982 
983  m_pWrtShell->SetInSelect();
984  }
985  }
986  break;
987 
988  case SID_DOCUMENT_COMPARE:
989  case SID_DOCUMENT_MERGE:
990  {
991  OUString sFileName, sFilterName;
992  sal_Int16 nVersion = 0;
993  bool bHasFileName = false;
994  m_pViewImpl->SetParam( 0 );
995  bool bNoAcceptDialog = false;
996 
997  if( pArgs )
998  {
999  if( const SfxStringItem* pFileItem = pArgs->GetItemIfSet( SID_FILE_NAME, false ))
1000  sFileName = pFileItem->GetValue();
1001  bHasFileName = !sFileName.isEmpty();
1002 
1003  if( const SfxStringItem* pFilterNameItem = pArgs->GetItemIfSet( SID_FILTER_NAME, false ))
1004  sFilterName = pFilterNameItem->GetValue();
1005 
1006  if( const SfxInt16Item* pVersionItem = pArgs->GetItemIfSet( SID_VERSION, false ))
1007  {
1008  nVersion = pVersionItem->GetValue();
1009  m_pViewImpl->SetParam( nVersion );
1010  }
1011  if( const SfxBoolItem* pDialogItem = pArgs->GetItemIfSet( SID_NO_ACCEPT_DIALOG, false ))
1012  {
1013  bNoAcceptDialog = pDialogItem->GetValue();
1014  }
1015  }
1016 
1017  m_pViewImpl->InitRequest( rReq );
1018  tools::Long nFound = InsertDoc( nSlot, sFileName, sFilterName, nVersion );
1019 
1020  if ( bHasFileName )
1021  {
1022  rReq.SetReturnValue( SfxInt32Item( nSlot, nFound ));
1023 
1024  if (nFound > 0 && !bNoAcceptDialog) // show Redline browser
1025  {
1026  SfxViewFrame* pVFrame = GetViewFrame();
1028 
1029  // re-initialize the Redline dialog
1030  const sal_uInt16 nId = SwRedlineAcceptChild::GetChildWindowId();
1031  SwRedlineAcceptChild *pRed = static_cast<SwRedlineAcceptChild*>(
1032  pVFrame->GetChildWindow(nId));
1033  if (pRed)
1034  pRed->ReInitDlg(GetDocShell());
1035  }
1036  }
1037  else
1038  bIgnore = true;
1039  }
1040  break;
1041  case FN_SYNC_LABELS:
1042  GetViewFrame()->ShowChildWindow(nSlot);
1043  break;
1044  case FN_ESCAPE:
1045  {
1046  if ( m_pWrtShell->HasDrawViewDrag() )
1047  {
1048  m_pWrtShell->BreakDrag();
1049  m_pWrtShell->EnterSelFrameMode();
1050  }
1051  else if ( m_pWrtShell->IsDrawCreate() )
1052  {
1053  GetDrawFuncPtr()->BreakCreate();
1054  AttrChangedNotify(nullptr); // shell change if needed
1055  }
1056  else if ( m_pWrtShell->HasSelection() || IsDrawMode() )
1057  {
1058  SdrView *pSdrView = m_pWrtShell->HasDrawView() ? m_pWrtShell->GetDrawView() : nullptr;
1059  if(pSdrView && pSdrView->AreObjectsMarked() &&
1060  pSdrView->GetHdlList().GetFocusHdl())
1061  {
1062  const_cast<SdrHdlList&>(pSdrView->GetHdlList()).ResetFocusHdl();
1063  }
1064  else
1065  {
1066  if(pSdrView)
1067  {
1068  LeaveDrawCreate();
1069  Point aPt(LONG_MIN, LONG_MIN);
1070  //go out of the frame
1071  m_pWrtShell->SelectObj(aPt, SW_LEAVE_FRAME);
1072  SfxBindings& rBind = GetViewFrame()->GetBindings();
1073  rBind.Invalidate( SID_ATTR_SIZE );
1074  }
1075  m_pWrtShell->EnterStdMode();
1076  AttrChangedNotify(nullptr); // shell change if necessary
1077  }
1078  }
1079  else if ( GetEditWin().GetApplyTemplate() )
1080  {
1081  GetEditWin().SetApplyTemplate(SwApplyTemplate());
1082  }
1083  else if( static_cast<SfxObjectShell*>(GetDocShell())->IsInPlaceActive() )
1084  {
1085  Escape();
1086  }
1087  else if ( GetEditWin().IsChainMode() )
1088  {
1089  GetEditWin().SetChainMode( false );
1090  }
1091  else if( m_pWrtShell->GetFlyFrameFormat() )
1092  {
1093  const SwFrameFormat* pFormat = m_pWrtShell->GetFlyFrameFormat();
1094  if(m_pWrtShell->GotoFly( pFormat->GetName(), FLYCNTTYPE_FRM ))
1095  {
1096  m_pWrtShell->HideCursor();
1097  m_pWrtShell->EnterSelFrameMode();
1098  }
1099  }
1100  else
1101  {
1102  SfxBoolItem aItem( SID_WIN_FULLSCREEN, false );
1103  GetViewFrame()->GetDispatcher()->ExecuteList(SID_WIN_FULLSCREEN,
1104  SfxCallMode::RECORD, { &aItem });
1105  bIgnore = true;
1106  }
1107  }
1108  break;
1109  case SID_ATTR_BORDER_INNER:
1110  case SID_ATTR_BORDER_OUTER:
1111  case SID_ATTR_BORDER_SHADOW:
1112  if(pArgs)
1113  m_pWrtShell->SetAttrSet(*pArgs);
1114  break;
1115 
1116  case SID_ATTR_PAGE:
1117  case SID_ATTR_PAGE_SIZE:
1118  case SID_ATTR_PAGE_MAXSIZE:
1119  case SID_ATTR_PAGE_PAPERBIN:
1120  case SID_ATTR_PAGE_EXT1:
1121  case FN_PARAM_FTN_INFO:
1122  {
1123  if(pArgs)
1124  {
1125  const size_t nCurIdx = m_pWrtShell->GetCurPageDesc();
1126  SwPageDesc aPageDesc( m_pWrtShell->GetPageDesc( nCurIdx ) );
1127  ::ItemSetToPageDesc( *pArgs, aPageDesc );
1128  // change the descriptor of the core
1129  m_pWrtShell->ChgPageDesc( nCurIdx, aPageDesc );
1130  }
1131  }
1132  break;
1133  case FN_GOTO_PAGE:
1134  {
1135  SwGotoPageDlg aDlg(GetViewFrame()->GetFrameWeld(), &GetViewFrame()->GetBindings());
1136  if (aDlg.run() == RET_OK)
1137  GetWrtShell().GotoPage(aDlg.GetPageSelection(), true);
1138  }
1139  break;
1140  case FN_EDIT_CURRENT_TOX:
1141  {
1142  GetViewFrame()->GetDispatcher()->Execute(
1143  FN_INSERT_MULTI_TOX, SfxCallMode::ASYNCHRON);
1144  }
1145  break;
1146  case FN_UPDATE_CUR_TOX:
1147  {
1148  const SwTOXBase* pBase = m_pWrtShell->GetCurTOX();
1149  if(pBase)
1150  {
1151  // tdf#106374: don't jump view on the update
1152  const bool bWasLocked = m_pWrtShell->IsViewLocked();
1153  m_pWrtShell->LockView(true);
1154  m_pWrtShell->StartAction();
1155  if(TOX_INDEX == pBase->GetType())
1156  m_pWrtShell->ApplyAutoMark();
1157  m_pWrtShell->UpdateTableOf( *pBase );
1158  m_pWrtShell->EndAction();
1159  if (!bWasLocked)
1160  m_pWrtShell->LockView(false);
1161  }
1162  }
1163  break;
1164  case FN_UPDATE_TOX:
1165  {
1166  m_pWrtShell->StartAction();
1167  m_pWrtShell->EnterStdMode();
1168  bool bOldCursorInReadOnly = m_pWrtShell->IsReadOnlyAvailable();
1169  m_pWrtShell->SetReadOnlyAvailable( true );
1170 
1171  for( int i = 0; i < 2; ++i )
1172  {
1173  if( m_pWrtShell->GetTOXCount() == 1 )
1174  ++i;
1175 
1176  while( m_pWrtShell->GotoPrevTOXBase() )
1177  ; // jump to the first "table of ..."
1178 
1179  // if we are not in one, jump to next
1180  const SwTOXBase* pBase = m_pWrtShell->GetCurTOX();
1181  if( !pBase )
1182  {
1183  m_pWrtShell->GotoNextTOXBase();
1184  pBase = m_pWrtShell->GetCurTOX();
1185  }
1186 
1187  bool bAutoMarkApplied = false;
1188  while( pBase )
1189  {
1190  if(TOX_INDEX == pBase->GetType() && !bAutoMarkApplied)
1191  {
1192  m_pWrtShell->ApplyAutoMark();
1193  bAutoMarkApplied = true;
1194  }
1195  // pBase is needed only for the interface. Should be changed in future! (JP 1996)
1196  m_pWrtShell->UpdateTableOf( *pBase );
1197 
1198  if( m_pWrtShell->GotoNextTOXBase() )
1199  pBase = m_pWrtShell->GetCurTOX();
1200  else
1201  pBase = nullptr;
1202  }
1203  }
1204  m_pWrtShell->SetReadOnlyAvailable( bOldCursorInReadOnly );
1205  m_pWrtShell->EndAction();
1206  }
1207  break;
1208  case SID_ATTR_BRUSH:
1209  {
1210  if(pArgs && SfxItemState::SET == pArgs->GetItemState(RES_BACKGROUND, false, &pItem))
1211  {
1212  const size_t nCurIdx = m_pWrtShell->GetCurPageDesc();
1213  SwPageDesc aDesc( m_pWrtShell->GetPageDesc( nCurIdx ));
1214  SwFrameFormat& rMaster = aDesc.GetMaster();
1215  rMaster.SetFormatAttr(*pItem);
1216  m_pWrtShell->ChgPageDesc( nCurIdx, aDesc);
1217  }
1218  }
1219  break;
1220  case SID_CLEARHISTORY:
1221  {
1222  m_pWrtShell->DelAllUndoObj();
1223  }
1224  break;
1225  case SID_UNDO:
1226  {
1227  m_pShell->ExecuteSlot(rReq);
1228  }
1229  break;
1230 #if defined(_WIN32) || defined UNX
1231  case SID_TWAIN_SELECT:
1232  case SID_TWAIN_TRANSFER:
1233  GetViewImpl()->ExecuteScan( rReq );
1234  break;
1235 #endif
1236 
1237  case SID_ATTR_DEFTABSTOP:
1238  {
1239  const SfxUInt16Item* pTabStopItem = nullptr;
1240  if(pArgs && (pTabStopItem = pArgs->GetItemIfSet(SID_ATTR_DEFTABSTOP, false)))
1241  {
1242  SvxTabStopItem aDefTabs( 0, 0, SvxTabAdjust::Default, RES_PARATR_TABSTOP );
1243  const sal_uInt16 nTab = pTabStopItem->GetValue();
1244  MakeDefTabs( nTab, aDefTabs );
1245  m_pWrtShell->SetDefault( aDefTabs );
1246  }
1247  }
1248  break;
1249  case SID_ATTR_LANGUAGE :
1250  {
1251  const SvxLanguageItem* pLangItem;
1252  if(pArgs && (pLangItem = pArgs->GetItemIfSet(SID_ATTR_LANGUAGE, false)))
1253  {
1254  SvxLanguageItem aLang(pLangItem->GetLanguage(), RES_CHRATR_LANGUAGE);
1255  m_pWrtShell->SetDefault( aLang );
1257  }
1258  }
1259  break;
1260  case SID_ATTR_CHAR_CTL_LANGUAGE:
1261  if(pArgs && SfxItemState::SET == pArgs->GetItemState(RES_CHRATR_CTL_LANGUAGE, false, &pItem))
1262  {
1263  m_pWrtShell->SetDefault( *pItem );
1265  }
1266  break;
1267  case SID_ATTR_CHAR_CJK_LANGUAGE:
1268  if(pArgs && SfxItemState::SET == pArgs->GetItemState(RES_CHRATR_CJK_LANGUAGE, false, &pItem))
1269  {
1270  m_pWrtShell->SetDefault( *pItem );
1272  }
1273  break;
1275  {
1276  m_pWrtShell->EnterStdMode();
1277  size_t nPos(m_pWrtShell->GetOutlinePos());
1278  if (nPos != SwOutlineNodes::npos)
1279  {
1280  SwNode* pNode = m_pWrtShell->GetNodes().GetOutLineNds()[nPos];
1282  !m_pWrtShell->GetAttrOutlineContentVisible(nPos));
1283  m_pWrtShell->InvalidateOutlineContentVisibility();
1284  m_pWrtShell->GotoOutline(nPos);
1285  }
1286  }
1287  break;
1288  case FN_NAV_ELEMENT:
1289  {
1290  pArgs->GetItemState(GetPool().GetWhich(FN_NAV_ELEMENT), false, &pItem);
1291  if(pItem)
1292  {
1293  SvxSearchDialogWrapper::SetSearchLabel(SearchLabel::Empty);
1294  sal_uInt32 nMoveType(static_cast<const SfxUInt32Item*>(pItem)->GetValue());
1295  SwView::SetMoveType(nMoveType);
1296  }
1297  }
1298  break;
1299  case FN_SCROLL_PREV:
1300  case FN_SCROLL_NEXT:
1301  {
1302  bool *pbNext = new bool(true);
1303  if (nSlot == FN_SCROLL_PREV)
1304  *pbNext = false;
1305  MoveNavigationHdl(pbNext);
1306  }
1307  break;
1308  case SID_JUMPTOMARK:
1309  if( pArgs && SfxItemState::SET == pArgs->GetItemState(SID_JUMPTOMARK, false, &pItem))
1310  JumpToSwMark( static_cast<const SfxStringItem*>(pItem)->GetValue() );
1311  break;
1312  case SID_GALLERY :
1313  // First make sure that the sidebar is visible
1314  GetViewFrame()->ShowChildWindow(SID_SIDEBAR);
1315 
1317  u"GalleryPanel",
1318  GetViewFrame()->GetFrame().GetFrameInterface());
1319  break;
1320  case SID_AVMEDIA_PLAYER :
1321  GetViewFrame()->ChildWindowExecute(rReq);
1322  break;
1323  case SID_VIEW_DATA_SOURCE_BROWSER:
1324  {
1325  SfxViewFrame* pVFrame = GetViewFrame();
1326  pVFrame->ChildWindowExecute(rReq);
1327  if(pVFrame->HasChildWindow(SID_BROWSER))
1328  {
1329  const SwDBData& rData = GetWrtShell().GetDBData();
1330  SwModule::ShowDBObj(*this, rData);
1331  }
1332  }
1333  break;
1335  {
1336  bool bShow = false;
1337  if( pArgs &&
1338  SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem ))
1339  bShow = static_cast<const SfxBoolItem*>(pItem)->GetValue();
1340  if((bShow && m_bInMailMerge) != GetViewFrame()->HasChildWindow(nSlot))
1341  GetViewFrame()->ToggleChildWindow(nSlot);
1342  //if fields have been successfully inserted call the "real"
1343  //mail merge dialog
1344 #if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
1345  SwWrtShell &rSh = GetWrtShell();
1346  if(m_bInMailMerge && rSh.IsAnyDatabaseFieldInDoc())
1347  {
1348  SwDBManager* pDBManager = rSh.GetDBManager();
1349  if (pDBManager)
1350  {
1351  SwDBData aData = rSh.GetDBData();
1352  rSh.EnterStdMode(); // force change in text shell; necessary for mixing DB fields
1353  AttrChangedNotify(nullptr);
1354 
1355  Sequence<PropertyValue> aProperties
1356  {
1357  comphelper::makePropertyValue("DataSourceName", aData.sDataSource),
1358  comphelper::makePropertyValue("Command", aData.sCommand),
1359  comphelper::makePropertyValue("CommandType", aData.nCommandType)
1360  };
1361  pDBManager->ExecuteFormLetter(rSh, aProperties);
1362  }
1363  }
1364 #endif
1365  m_bInMailMerge &= bShow;
1366  GetViewFrame()->GetBindings().Invalidate(FN_INSERT_FIELD);
1367  }
1368  break;
1369  case FN_QRY_MERGE:
1370  {
1371  bool bUseCurrentDocument = true;
1372  bool bQuery = !pArgs || SfxItemState::SET != pArgs->GetItemState(nSlot);
1373  if(bQuery)
1374  {
1375  SfxViewFrame* pTmpFrame = GetViewFrame();
1378  if (RET_OK == pDlg->Execute())
1379  bUseCurrentDocument = pDlg->IsThisDocument();
1380  else
1381  break;
1382  }
1383  GenerateFormLetter(bUseCurrentDocument);
1384  }
1385  break;
1386  case SID_RECHECK_DOCUMENT:
1387  {
1388  SwDocShell* pDocShell = GetDocShell();
1389  SwDoc* pDoc = pDocShell->GetDoc();
1390  uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( pDoc->GetGCIterator() );
1391  if( xGCIterator.is() )
1392  {
1393  xGCIterator->resetIgnoreRules();
1394  }
1395  // reset ignore lists
1396  pDoc->SpellItAgainSam( true, false, false );
1397  // clear ignore dictionary
1398  uno::Reference< linguistic2::XDictionary > xDictionary = LinguMgr::GetIgnoreAllList();
1399  if( xDictionary.is() )
1400  xDictionary->clear();
1401  // put cursor to the start of the document
1402  m_pWrtShell->StartOfSection();
1403  [[fallthrough]]; // call spell/grammar dialog
1404  }
1406  {
1407  SfxViewFrame* pViewFrame = GetViewFrame();
1408  if (rReq.GetArgs() != nullptr)
1410  static_cast<const SfxBoolItem&>( (rReq.GetArgs()->
1411  Get(FN_SPELL_GRAMMAR_DIALOG))).GetValue());
1412  else
1414 
1416  rReq.Ignore ();
1417  }
1418  break;
1419  case SID_ALIGN_ANY_LEFT :
1420  case SID_ALIGN_ANY_HCENTER :
1421  case SID_ALIGN_ANY_RIGHT :
1422  case SID_ALIGN_ANY_JUSTIFIED:
1423  case SID_ALIGN_ANY_TOP :
1424  case SID_ALIGN_ANY_VCENTER :
1425  case SID_ALIGN_ANY_BOTTOM :
1426  case SID_ALIGN_ANY_HDEFAULT :
1427  case SID_ALIGN_ANY_VDEFAULT :
1428  {
1429  sal_uInt16 nAlias = 0;
1430  if( m_nSelectionType & (SelectionType::DrawObjectEditMode|SelectionType::Text) )
1431  {
1432  switch( nSlot )
1433  {
1434  case SID_ALIGN_ANY_LEFT : nAlias = SID_ATTR_PARA_ADJUST_LEFT; break;
1435  case SID_ALIGN_ANY_HCENTER : nAlias = SID_ATTR_PARA_ADJUST_CENTER; break;
1436  case SID_ALIGN_ANY_RIGHT : nAlias = SID_ATTR_PARA_ADJUST_RIGHT; break;
1437  case SID_ALIGN_ANY_JUSTIFIED: nAlias = SID_ATTR_PARA_ADJUST_BLOCK; break;
1438  case SID_ALIGN_ANY_TOP : nAlias = SID_TABLE_VERT_NONE; break;
1439  case SID_ALIGN_ANY_VCENTER : nAlias = SID_TABLE_VERT_CENTER; break;
1440  case SID_ALIGN_ANY_BOTTOM : nAlias = SID_TABLE_VERT_BOTTOM; break;
1441  }
1442  }
1443  else
1444  {
1445  switch( nSlot )
1446  {
1447  case SID_ALIGN_ANY_LEFT : nAlias = SID_OBJECT_ALIGN_LEFT ; break;
1448  case SID_ALIGN_ANY_HCENTER : nAlias = SID_OBJECT_ALIGN_CENTER ; break;
1449  case SID_ALIGN_ANY_RIGHT : nAlias = SID_OBJECT_ALIGN_RIGHT ; break;
1450  case SID_ALIGN_ANY_TOP : nAlias = SID_OBJECT_ALIGN_UP ; break;
1451  case SID_ALIGN_ANY_VCENTER : nAlias = SID_OBJECT_ALIGN_MIDDLE ; break;
1452  case SID_ALIGN_ANY_BOTTOM : nAlias = SID_OBJECT_ALIGN_DOWN ; break;
1453  }
1454  }
1455  //these slots are either re-mapped to text or object alignment
1456  if (nAlias)
1457  GetViewFrame()->GetDispatcher()->Execute(
1458  nAlias, SfxCallMode::ASYNCHRON);
1459  }
1460  break;
1461  case SID_RESTORE_EDITING_VIEW:
1462  {
1463  //#i33307# restore editing position
1464  Point aCursorPos;
1465  bool bSelectObj;
1466  if(m_pViewImpl->GetRestorePosition(aCursorPos, bSelectObj))
1467  {
1468  m_pWrtShell->SwCursorShell::SetCursor( aCursorPos, !bSelectObj );
1469  if( bSelectObj )
1470  {
1471  m_pWrtShell->SelectObj( aCursorPos );
1472  m_pWrtShell->EnterSelFrameMode( &aCursorPos );
1473  }
1474  }
1475  }
1476  break;
1477  case SID_INSERT_GRAPHIC:
1478  {
1479  rReq.SetReturnValue(SfxBoolItem(nSlot, InsertGraphicDlg( rReq )));
1480  }
1481  break;
1482  case SID_MOVE_SHAPE_HANDLE:
1483  {
1484  if (pArgs && pArgs->Count() >= 3)
1485  {
1486  SdrView *pSdrView = m_pWrtShell->HasDrawView() ? m_pWrtShell->GetDrawView() : nullptr;
1487  if (pSdrView == nullptr)
1488  break;
1489  const SfxUInt32Item* handleNumItem = rReq.GetArg<SfxUInt32Item>(FN_PARAM_1);
1490  const SfxUInt32Item* newPosXTwips = rReq.GetArg<SfxUInt32Item>(FN_PARAM_2);
1491  const SfxUInt32Item* newPosYTwips = rReq.GetArg<SfxUInt32Item>(FN_PARAM_3);
1492  const SfxInt32Item* OrdNum = rReq.GetArg<SfxInt32Item>(FN_PARAM_4);
1493 
1494  const sal_uLong handleNum = handleNumItem->GetValue();
1495  const sal_uLong newPosX = newPosXTwips->GetValue();
1496  const sal_uLong newPosY = newPosYTwips->GetValue();
1497  const Point mPoint(newPosX, newPosY);
1498  const SdrHdl* handle = pSdrView->GetHdlList().GetHdl(handleNum);
1499  if (!handle)
1500  {
1501  break;
1502  }
1503 
1504  if (handle->GetKind() == SdrHdlKind::Anchor || handle->GetKind() == SdrHdlKind::Anchor_TR)
1505  m_pWrtShell->FindAnchorPos(mPoint, /*bMoveIt=*/true);
1506  else
1507  pSdrView->MoveShapeHandle(handleNum, mPoint, OrdNum ? OrdNum->GetValue() : -1);
1508  }
1509  break;
1510  }
1511 
1512  default:
1513  OSL_ENSURE(false, "wrong dispatcher");
1514  return;
1515  }
1516  if(!bIgnore)
1517  rReq.Done();
1518 }
1519 
1521 {
1522  sal_uInt16 nId = rReq.GetSlot();
1523  bool bRet = false;
1524 
1526  {
1528  bRet = true;
1529  }
1530  return bRet || SfxShell::IsConditionalFastCall(rReq);
1531 
1532 }
1533 
1536 {
1537  SfxBindings &rBnd = GetViewFrame()->GetBindings();
1538  rBnd.Invalidate(FN_STAT_PAGE);
1539 }
1540 
1542 {
1543  SfxBindings &rBnd = GetViewFrame()->GetBindings();
1544  rBnd.Invalidate( FN_STAT_WORDCOUNT );
1545  rBnd.Update( FN_STAT_WORDCOUNT );
1546 }
1547 
1550 {
1551  SwWrtShell& rShell = GetWrtShell();
1552 
1553  SfxWhichIter aIter( rSet );
1554  sal_uInt16 nWhich = aIter.FirstWhich();
1555  OSL_ENSURE( nWhich, "empty set");
1556 
1557  //get section change event
1558  const SwSection* CurrSect = rShell.GetCurrSection();
1559  if( CurrSect )
1560  {
1561  const OUString& sCurrentSectionName = CurrSect->GetSectionName();
1562  if(sCurrentSectionName != m_sOldSectionName)
1563  {
1565  }
1566  m_sOldSectionName = sCurrentSectionName;
1567  }
1568  else if (!m_sOldSectionName.isEmpty())
1569  {
1571  m_sOldSectionName= OUString();
1572  }
1573  //get column change event
1574  if(rShell.bColumnChange())
1575  {
1577  }
1578 
1579  while( nWhich )
1580  {
1581  switch( nWhich )
1582  {
1583  case FN_STAT_PAGE: {
1584  // number of pages, log. page number
1585  sal_uInt16 nPage, nLogPage;
1586  OUString sDisplay;
1587  rShell.GetPageNumber( -1, rShell.IsCursorVisible(), nPage, nLogPage, sDisplay );
1588  bool bExtendedTooltip(!sDisplay.isEmpty() &&
1589  std::u16string_view(OUString::number(nPage)) != sDisplay &&
1590  nPage != nLogPage);
1591  OUString aTooltip = bExtendedTooltip ? SwResId(STR_BOOKCTRL_HINT_EXTENDED)
1592  : SwResId(STR_BOOKCTRL_HINT);
1593  std::vector<OUString> aStringList
1594  {
1595  GetPageStr(nPage, nLogPage, sDisplay),
1596  aTooltip
1597  };
1599  //if existing page number is not equal to old page number, send out this event.
1600  if (m_nOldPageNum != nLogPage )
1601  {
1602  if (m_nOldPageNum != 0)
1603  SwCursorShell::FirePageChangeEvent(m_nOldPageNum, nLogPage);
1604  m_nOldPageNum = nLogPage;
1605  }
1606  const sal_uInt16 nCnt = GetWrtShell().GetPageCnt();
1607  if (m_nPageCnt != nCnt) // notify Basic
1608  {
1609  m_nPageCnt = nCnt;
1610  SfxGetpApp()->NotifyEvent(SfxEventHint(SfxEventHintId::SwEventPageCount, SwDocShell::GetEventName(STR_SW_EVENT_PAGE_COUNT), GetViewFrame()->GetObjectShell()), false);
1611  }
1612  }
1613  break;
1614 
1615  case FN_STAT_WORDCOUNT:
1616  {
1617  SwDocStat selectionStats;
1618  SwDocStat documentStats;
1619  rShell.CountWords(selectionStats);
1620  documentStats = rShell.GetDoc()->getIDocumentStatistics().GetUpdatedDocStat( true /* complete-async */, false /* don't update fields */ );
1621 
1622  sal_uLong nWord = selectionStats.nWord ? selectionStats.nWord : documentStats.nWord;
1623  sal_uLong nChar = selectionStats.nChar ? selectionStats.nChar : documentStats.nChar;
1624  TranslateId pResId = selectionStats.nWord ? STR_WORDCOUNT : STR_WORDCOUNT_NO_SELECTION;
1625  TranslateNId pWordResId = selectionStats.nWord ? STR_WORDCOUNT_WORDARG : STR_WORDCOUNT_WORDARG_NO_SELECTION;
1626  TranslateNId pCharResId = selectionStats.nWord ? STR_WORDCOUNT_CHARARG : STR_WORDCOUNT_CHARARG_NO_SELECTION;
1627 
1629  OUString aWordArg = SwResId(pWordResId, nWord).replaceAll("$1", rLocaleData.getNum(nWord, 0));
1630  OUString aCharArg = SwResId(pCharResId, nChar).replaceAll("$1", rLocaleData.getNum(nChar, 0));
1631  OUString aWordCount(SwResId(pResId));
1632  aWordCount = aWordCount.replaceAll("$1", aWordArg);
1633  aWordCount = aWordCount.replaceAll("$2", aCharArg);
1634 
1635  rSet.Put( SfxStringItem( FN_STAT_WORDCOUNT, aWordCount ) );
1636 
1637  SwWordCountWrapper *pWrdCnt = static_cast<SwWordCountWrapper*>(GetViewFrame()->GetChildWindow(SwWordCountWrapper::GetChildWindowId()));
1638  if (pWrdCnt)
1639  pWrdCnt->SetCounts(selectionStats, documentStats);
1640  }
1641  break;
1642 
1643  case FN_STAT_TEMPLATE:
1644  {
1646  rShell.GetCurPageStyle()));
1647 
1648  }
1649  break;
1650  case SID_ATTR_ZOOM:
1651  {
1652  if ( ( GetDocShell()->GetCreateMode() != SfxObjectCreateMode::EMBEDDED ) || !GetDocShell()->IsInPlaceActive() )
1653  {
1654  const SwViewOption* pVOpt = rShell.GetViewOptions();
1655  SvxZoomType eZoom = pVOpt->GetZoomType();
1656  SvxZoomItem aZoom(eZoom,
1657  pVOpt->GetZoom());
1658  if( pVOpt->getBrowseMode() )
1659  {
1660  aZoom.SetValueSet(
1661  SvxZoomEnableFlags::N50|
1662  SvxZoomEnableFlags::N75|
1663  SvxZoomEnableFlags::N100|
1664  SvxZoomEnableFlags::N150|
1665  SvxZoomEnableFlags::N200);
1666  }
1667  rSet.Put( aZoom );
1668  }
1669  else
1670  rSet.DisableItem( SID_ATTR_ZOOM );
1671  }
1672  break;
1673  case SID_ATTR_VIEWLAYOUT:
1674  {
1675  if ( ( GetDocShell()->GetCreateMode() != SfxObjectCreateMode::EMBEDDED ) || !GetDocShell()->IsInPlaceActive() )
1676  {
1677  const SwViewOption* pVOpt = rShell.GetViewOptions();
1678  const sal_uInt16 nColumns = pVOpt->GetViewLayoutColumns();
1679  const bool bBookMode = pVOpt->IsViewLayoutBookMode();
1680  SvxViewLayoutItem aViewLayout(nColumns, bBookMode);
1681  rSet.Put( aViewLayout );
1682  }
1683  else
1684  rSet.DisableItem( SID_ATTR_VIEWLAYOUT );
1685  }
1686  break;
1687  case SID_ATTR_ZOOMSLIDER:
1688  {
1689  if ( ( GetDocShell()->GetCreateMode() != SfxObjectCreateMode::EMBEDDED ) || !GetDocShell()->IsInPlaceActive() )
1690  {
1691  const SwViewOption* pVOpt = rShell.GetViewOptions();
1692  const sal_uInt16 nCurrentZoom = pVOpt->GetZoom();
1693  SvxZoomSliderItem aZoomSliderItem( nCurrentZoom, MINZOOM, MAXZOOM );
1694  aZoomSliderItem.AddSnappingPoint( 100 );
1695 
1696  if ( !m_pWrtShell->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE) )
1697  {
1698  const sal_uInt16 nColumns = pVOpt->GetViewLayoutColumns();
1699  const bool bAutomaticViewLayout = 0 == nColumns;
1700  const SwPostItMgr* pMgr = GetPostItMgr();
1701 
1702  // snapping points:
1703  // automatic mode: 1 Page, 2 Pages, 100%
1704  // n Columns mode: n Pages, 100%
1705  // n Columns book mode: nPages without gaps, 100%
1706  const SwRect aPageRect( m_pWrtShell->GetAnyCurRect( CurRectType::PageCalc ) );
1707  const SwRect aRootRect( m_pWrtShell->GetAnyCurRect( CurRectType::PagesArea ) ); // width of columns
1708  Size aPageSize( aPageRect.SSize() );
1709  aPageSize.AdjustWidth(pMgr->HasNotes() && pMgr->ShowNotes() ?
1710  pMgr->GetSidebarWidth() + pMgr->GetSidebarBorderWidth() :
1711  0 );
1712 
1713  Size aRootSize( aRootRect.SSize() );
1714 
1715  const MapMode aTmpMap( MapUnit::MapTwip );
1716  const Size& rEditSize = GetEditWin().GetOutputSizePixel();
1717  const Size aWindowSize( GetEditWin().PixelToLogic( rEditSize, aTmpMap ) );
1718 
1719  const tools::Long nOf = pVOpt->GetDocumentBorder() * 2;
1720  tools::Long nTmpWidth = bAutomaticViewLayout ? aPageSize.Width() : aRootSize.Width();
1721  nTmpWidth += nOf;
1722  aPageSize.AdjustHeight(nOf );
1723  tools::Long nFac = aWindowSize.Width() * 100 / nTmpWidth;
1724 
1725  tools::Long nVisPercent = aWindowSize.Height() * 100 / aPageSize.Height();
1726  nFac = std::min( nFac, nVisPercent );
1727 
1728  if (nFac >= MINZOOM)
1729  {
1730  aZoomSliderItem.AddSnappingPoint( nFac );
1731  }
1732 
1733  if ( bAutomaticViewLayout )
1734  {
1735  nTmpWidth += aPageSize.Width() + pVOpt->GetGapBetweenPages();
1736  nFac = aWindowSize.Width() * 100 / nTmpWidth;
1737  nFac = std::min( nFac, nVisPercent );
1738  if (nFac >= MINZOOM)
1739  {
1740  aZoomSliderItem.AddSnappingPoint( nFac );
1741  }
1742  }
1743  }
1744 
1745  rSet.Put( aZoomSliderItem );
1746  }
1747  else
1748  rSet.DisableItem( SID_ATTR_ZOOMSLIDER );
1749  }
1750  break;
1751  case SID_ATTR_POSITION:
1752  case SID_ATTR_SIZE:
1753  {
1754  if( !rShell.IsFrameSelected() && !rShell.IsObjSelected() )
1756  else
1757  {
1758  FlyMode eFrameMode = SwBaseShell::GetFrameMode();
1759  if ( eFrameMode == FLY_DRAG_START || eFrameMode == FLY_DRAG )
1760  {
1761  if ( nWhich == SID_ATTR_POSITION )
1762  rSet.Put( SfxPointItem( SID_ATTR_POSITION,
1763  rShell.GetAnchorObjDiff()));
1764  else
1765  rSet.Put( SvxSizeItem( SID_ATTR_SIZE,
1766  rShell.GetObjSize()));
1767  }
1768  }
1769  }
1770  break;
1771  case SID_TABLE_CELL:
1772 
1773  if( rShell.IsFrameSelected() || rShell.IsObjSelected() )
1774  {
1775  // #i39171# Don't put a SvxSizeItem into a slot which is defined as SfxStringItem.
1776  // SvxPosSizeStatusBarControl no longer resets to empty display if only one slot
1777  // has no item, so SID_TABLE_CELL can remain empty (the SvxSizeItem is supplied
1778  // in SID_ATTR_SIZE).
1779  }
1780  else
1781  {
1782  OUString sStr;
1783  if( rShell.IsCursorInTable() )
1784  {
1785  // table name + cell coordinate
1786  sStr = rShell.GetTableFormat()->GetName() + ":";
1787  sStr += rShell.GetBoxNms();
1788  }
1789  else
1790  {
1791  const SwSection* pCurrSect = rShell.GetCurrSection();
1792  if( pCurrSect )
1793  {
1794  switch( pCurrSect->GetType() )
1795  {
1798  {
1799  const SwTOXBase* pTOX = m_pWrtShell->GetCurTOX();
1800  if( pTOX )
1801  sStr = pTOX->GetTOXName();
1802  else
1803  {
1804  OSL_ENSURE( false,
1805  "Unknown kind of section" );
1806  sStr = pCurrSect->GetSectionName();
1807  }
1808  }
1809  break;
1810  default:
1811  sStr = pCurrSect->GetSectionName();
1812  break;
1813  }
1814  }
1815  }
1816 
1817  const SwNumRule* pNumRule = rShell.GetNumRuleAtCurrCursorPos();
1818  const bool bOutlineNum = pNumRule && pNumRule->IsOutlineRule();
1819 
1820  if (pNumRule && !bOutlineNum ) // cursor in numbering
1821  {
1822  sal_uInt8 nNumLevel = rShell.GetNumLevel();
1823  if ( nNumLevel < MAXLEVEL )
1824  {
1825  if(!pNumRule->IsAutoRule())
1826  {
1828  rShell.GetCurAttr(aSet);
1829  if(SfxItemState::DEFAULT <=
1831  {
1832  const OUString& rNumStyle =
1833  aSet.Get(RES_PARATR_NUMRULE).GetValue();
1834  if(!rNumStyle.isEmpty())
1835  {
1836  if(!sStr.isEmpty())
1837  sStr += sStatusDelim;
1838  sStr += rNumStyle;
1839  }
1840  }
1841  }
1842  if (!sStr.isEmpty())
1843  sStr += sStatusDelim;
1844  sStr += SwResId(STR_NUM_LEVEL) + OUString::number( nNumLevel + 1 );
1845 
1846  }
1847  }
1848  const int nOutlineLevel = rShell.GetCurrentParaOutlineLevel();
1849  if( nOutlineLevel != 0 )
1850  {
1851  if (!sStr.isEmpty())
1852  sStr += " , ";
1853  if( bOutlineNum )
1854  {
1855  sStr += SwResId(STR_OUTLINE_NUMBERING) +
1856  sStatusDelim + SwResId(STR_NUM_LEVEL);
1857  }
1858  else
1859  sStr += SwResId(STR_NUM_OUTLINE);
1860  sStr += OUString::number( nOutlineLevel);
1861  }
1862 
1863  if( rShell.HasReadonlySel() )
1864  {
1865  if (!sStr.isEmpty())
1866  sStr = sStatusDelim + sStr;
1867  sStr = SwResId(SW_STR_READONLY) + sStr;
1868  }
1869  if (!sStr.isEmpty())
1870  rSet.Put( SfxStringItem( SID_TABLE_CELL, sStr ));
1871  }
1872  break;
1873  case FN_STAT_SELMODE:
1874  {
1875  if(rShell.IsStdMode())
1876  rSet.Put(SfxUInt16Item(FN_STAT_SELMODE, 0));
1877  else if(rShell.IsAddMode())
1878  rSet.Put(SfxUInt16Item(FN_STAT_SELMODE, 2));
1879  else if(rShell.IsBlockMode())
1880  rSet.Put(SfxUInt16Item(FN_STAT_SELMODE, 3));
1881  else
1882  rSet.Put(SfxUInt16Item(FN_STAT_SELMODE, 1));
1883  break;
1884  }
1885  case SID_ATTR_INSERT:
1886  if( rShell.IsRedlineOn() )
1887  rSet.DisableItem( nWhich );
1888  else
1889  {
1890  rSet.Put(SfxBoolItem(SID_ATTR_INSERT,rShell.IsInsMode()));
1891  }
1892  break;
1893  }
1894  nWhich = aIter.NextWhich();
1895  }
1896 }
1897 
1903 {
1904  SwWrtShell &rSh = GetWrtShell();
1905  const SfxItemSet* pArgs = rReq.GetArgs();
1906  const SfxPoolItem* pItem=nullptr;
1907  bool bUp = false;
1908  sal_uInt16 nWhich = rReq.GetSlot();
1909  switch( nWhich )
1910  {
1911  case FN_STAT_PAGE:
1912  {
1913  GetViewFrame()->GetDispatcher()->Execute( FN_GOTO_PAGE,
1914  SfxCallMode::SYNCHRON|SfxCallMode::RECORD );
1915  }
1916  break;
1917 
1918  case FN_STAT_WORDCOUNT:
1919  {
1920  GetViewFrame()->GetDispatcher()->Execute(FN_WORDCOUNT_DIALOG,
1921  SfxCallMode::SYNCHRON|SfxCallMode::RECORD );
1922  }
1923  break;
1924 
1925  case FN_STAT_BOOKMARK:
1926  if ( pArgs )
1927  {
1928  if (SfxItemState::SET == pArgs->GetItemState( nWhich, true, &pItem))
1929  {
1930  const IDocumentMarkAccess* pMarkAccess = rSh.getIDocumentMarkAccess();
1931  const sal_Int32 nIdx = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
1932  if(nIdx < pMarkAccess->getBookmarksCount())
1933  {
1935  rSh.EnterStdMode();
1936  rSh.GotoMark( *ppBookmark );
1937  }
1938  else
1939  OSL_FAIL("SwView::ExecuteStatusLine(..)"
1940  " - Ignoring out of range bookmark index");
1941  }
1942  }
1943  break;
1944 
1945  case FN_STAT_TEMPLATE:
1946  {
1947  GetViewFrame()->GetDispatcher()->Execute(FN_FORMAT_PAGE_DLG,
1948  SfxCallMode::SYNCHRON|SfxCallMode::RECORD );
1949  }
1950  break;
1951  case SID_ATTR_ZOOM:
1952  {
1953  if ( ( GetDocShell()->GetCreateMode() != SfxObjectCreateMode::EMBEDDED ) || !GetDocShell()->IsInPlaceActive() )
1954  {
1955  const SfxItemSet *pSet = nullptr;
1957  if ( pArgs )
1958  pSet = pArgs;
1959  else
1960  {
1961  const SwViewOption& rViewOptions = *rSh.GetViewOptions();
1963  SvxZoomItem aZoom( rViewOptions.GetZoomType(), rViewOptions.GetZoom() );
1964 
1965  const bool bBrowseMode = rSh.GetViewOptions()->getBrowseMode();
1966  if( bBrowseMode )
1967  {
1968  aZoom.SetValueSet(
1969  SvxZoomEnableFlags::N50|
1970  SvxZoomEnableFlags::N75|
1971  SvxZoomEnableFlags::N100|
1972  SvxZoomEnableFlags::N150|
1973  SvxZoomEnableFlags::N200);
1974  }
1975  aCoreSet.Put( aZoom );
1976 
1977  if ( !bBrowseMode )
1978  {
1979  const SvxViewLayoutItem aViewLayout( rViewOptions.GetViewLayoutColumns(), rViewOptions.IsViewLayoutBookMode() );
1980  aCoreSet.Put( aViewLayout );
1981  }
1982 
1984  pDlg.disposeAndReset(pFact->CreateSvxZoomDialog(GetViewFrame()->GetFrameWeld(), aCoreSet));
1985  pDlg->SetLimits( MINZOOM, MAXZOOM );
1986  if( pDlg->Execute() != RET_CANCEL )
1987  pSet = pDlg->GetOutputItemSet();
1988  }
1989 
1990  const SvxViewLayoutItem* pViewLayoutItem = nullptr;
1991  if ( pSet && (pViewLayoutItem = pSet->GetItemIfSet(SID_ATTR_VIEWLAYOUT)))
1992  {
1993  const sal_uInt16 nColumns = pViewLayoutItem->GetValue();
1994  const bool bBookMode = pViewLayoutItem->IsBookMode();
1995  SetViewLayout( nColumns, bBookMode );
1996  }
1997 
1998  const SvxZoomItem* pZoomItem = nullptr;
1999  if ( pSet && (pZoomItem = pSet->GetItemIfSet(SID_ATTR_ZOOM)))
2000  {
2001  SvxZoomType eType = pZoomItem->GetType();
2002  SetZoom( eType, pZoomItem->GetValue() );
2003  }
2004  bUp = true;
2005  if ( pZoomItem )
2006  rReq.AppendItem( *pZoomItem );
2007  rReq.Done();
2008  }
2009  }
2010  break;
2011 
2012  case SID_ATTR_VIEWLAYOUT:
2013  {
2015  ( ( GetDocShell()->GetCreateMode() != SfxObjectCreateMode::EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) )
2016  {
2017  if ( const SvxViewLayoutItem* pLayoutItem = pArgs->GetItemIfSet(SID_ATTR_VIEWLAYOUT ))
2018  {
2019  const sal_uInt16 nColumns = pLayoutItem->GetValue();
2020  const bool bBookMode = (0 != nColumns && 0 == (nColumns % 2)) && pLayoutItem->IsBookMode();
2021 
2022  SetViewLayout( nColumns, bBookMode );
2023  }
2024 
2025  bUp = true;
2026  rReq.Done();
2027 
2028  InvalidateRulerPos();
2029  }
2030  }
2031  break;
2032 
2033  case SID_ATTR_ZOOMSLIDER:
2034  {
2035  if ( pArgs && ( ( GetDocShell()->GetCreateMode() != SfxObjectCreateMode::EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) )
2036  {
2037  if ( const SvxZoomSliderItem* pZoomItem = pArgs->GetItemIfSet(SID_ATTR_ZOOMSLIDER) )
2038  {
2039  const sal_uInt16 nCurrentZoom = pZoomItem->GetValue();
2040  SetZoom( SvxZoomType::PERCENT, nCurrentZoom );
2041  }
2042 
2043  bUp = true;
2044  rReq.Done();
2045  }
2046  }
2047  break;
2048 
2049  case SID_ATTR_SIZE:
2050  {
2051  sal_uInt16 nId = 0;
2052  if( rSh.IsCursorInTable() )
2053  nId = FN_FORMAT_TABLE_DLG;
2054  else if( rSh.GetCurTOX() )
2055  nId = FN_INSERT_MULTI_TOX;
2056  else if( rSh.GetCurrSection() )
2057  nId = FN_EDIT_REGION;
2058  else
2059  {
2060  const SwNumRule* pNumRule = rSh.GetNumRuleAtCurrCursorPos();
2061  if( pNumRule ) // cursor in numbering
2062  {
2063  if( pNumRule->IsAutoRule() )
2064  nId = FN_NUMBER_BULLETS;
2065  else
2066  {
2067  // start dialog of the painter
2068  nId = 0;
2069  }
2070  }
2071  else if( rSh.IsFrameSelected() )
2072  nId = FN_FORMAT_FRAME_DLG;
2073  else if( rSh.IsObjSelected() )
2074  nId = SID_ATTR_TRANSFORM;
2075  }
2076  if( nId )
2077  GetViewFrame()->GetDispatcher()->Execute(nId,
2078  SfxCallMode::SYNCHRON | SfxCallMode::RECORD );
2079  }
2080  break;
2081 
2082  case FN_STAT_SELMODE:
2083  {
2084  if ( pArgs )
2085  {
2086  if (SfxItemState::SET == pArgs->GetItemState( nWhich, true, &pItem))
2087  {
2088  switch ( static_cast<const SfxUInt16Item *>(pItem)->GetValue() )
2089  {
2090  case 0: rSh.EnterStdMode(); break;
2091  case 1: rSh.EnterExtMode(); break;
2092  case 2: rSh.EnterAddMode(); break;
2093  case 3: rSh.EnterBlockMode(); break;
2094  }
2095  }
2096  }
2097  bUp = true;
2098  break;
2099  }
2100  case FN_SET_ADD_MODE:
2101  rSh.ToggleAddMode();
2102  nWhich = FN_STAT_SELMODE;
2103  bUp = true;
2104  break;
2105  case FN_SET_BLOCK_MODE:
2106  rSh.ToggleBlockMode();
2107  nWhich = FN_STAT_SELMODE;
2108  bUp = true;
2109  break;
2110  case FN_SET_EXT_MODE:
2111  rSh.ToggleExtMode();
2112  nWhich = FN_STAT_SELMODE;
2113  bUp = true;
2114  break;
2115  case SID_ATTR_INSERT:
2116  SwPostItMgr* pMgr = GetPostItMgr();
2117  if ( pMgr && pMgr->HasActiveSidebarWin() )
2118  {
2120  }
2121  else
2122  rSh.ToggleInsMode();
2123  bUp = true;
2124  break;
2125 
2126  }
2127  if ( bUp )
2128  {
2129  SfxBindings &rBnd = GetViewFrame()->GetBindings();
2130  rBnd.Invalidate(nWhich);
2131  rBnd.Update(nWhich);
2132  }
2133 }
2134 
2135 void SwView::InsFrameMode(sal_uInt16 nCols)
2136 {
2137  if ( m_pWrtShell->HasWholeTabSelection() )
2138  {
2139  SwFlyFrameAttrMgr aMgr( true, m_pWrtShell.get(), Frmmgr_Type::TEXT, nullptr );
2140 
2141  const SwFrameFormat &rPageFormat =
2142  m_pWrtShell->GetPageDesc(m_pWrtShell->GetCurPageDesc()).GetMaster();
2143  SwTwips lWidth = rPageFormat.GetFrameSize().GetWidth();
2144  const SvxLRSpaceItem &rLR = rPageFormat.GetLRSpace();
2145  lWidth -= rLR.GetLeft() + rLR.GetRight();
2146  aMgr.SetSize(Size(lWidth, aMgr.GetSize().Height()));
2147  if(nCols > 1)
2148  {
2149  SwFormatCol aCol;
2150  aCol.Init( nCols, aCol.GetGutterWidth(), aCol.GetWishWidth() );
2151  aMgr.SetCol( aCol );
2152  }
2153  aMgr.InsertFlyFrame();
2154  }
2155  else
2156  GetEditWin().InsFrame(nCols);
2157 }
2158 
2161 {
2162  bool bWeb = dynamic_cast<SwWebView*>( this ) != nullptr;
2164  ScopedVclPtr<SfxAbstractLinksDialog> pDlg(pFact->CreateLinksDialog(GetViewFrame()->GetFrameWeld(), &GetWrtShell().GetLinkManager(), bWeb));
2165  pDlg->Execute();
2166 }
2167 
2168 namespace sw {
2169 
2170 auto PrepareJumpToTOXMark(SwDoc const& rDoc, OUString const& rName)
2171  -> std::optional<std::pair<SwTOXMark, sal_Int32>>
2172 {
2173  sal_Int32 const first(rName.indexOf(toxMarkSeparator));
2174  if (first == -1)
2175  {
2176  SAL_WARN("sw.ui", "JumpToTOXMark: missing separator");
2177  return std::optional<std::pair<SwTOXMark, sal_Int32>>();
2178  }
2179  sal_Int32 const counter(o3tl::toInt32(rName.subView(0, first)));
2180  if (counter <= 0)
2181  {
2182  SAL_WARN("sw.ui", "JumpToTOXMark: invalid counter");
2183  return std::optional<std::pair<SwTOXMark, sal_Int32>>();
2184  }
2185  sal_Int32 const second(rName.indexOf(toxMarkSeparator, first + 1));
2186  if (second == -1)
2187  {
2188  SAL_WARN("sw.ui", "JumpToTOXMark: missing separator");
2189  return std::optional<std::pair<SwTOXMark, sal_Int32>>();
2190  }
2191  OUString const entry(rName.copy(first + 1, second - (first + 1)));
2192  if (rName.getLength() < second + 2)
2193  {
2194  SAL_WARN("sw.ui", "JumpToTOXMark: invalid tox");
2195  return std::optional<std::pair<SwTOXMark, sal_Int32>>();
2196  }
2197  sal_uInt16 const indexType(rName[second + 1]);
2198  std::u16string_view const indexName(rName.subView(second + 2));
2199  SwTOXType const* pType(nullptr);
2200  switch (indexType)
2201  {
2202  case 'A':
2203  pType = rDoc.GetTOXType(TOX_INDEX, 0);
2204  assert(pType);
2205  break;
2206  case 'C':
2207  pType = rDoc.GetTOXType(TOX_CONTENT, 0);
2208  assert(pType);
2209  break;
2210  case 'U':
2211  for (auto i = rDoc.GetTOXTypeCount(TOX_USER); 0 < i; )
2212  {
2213  --i;
2214  auto const pTmp(rDoc.GetTOXType(TOX_USER, i));
2215  if (pTmp->GetTypeName() == indexName)
2216  {
2217  pType = pTmp;
2218  break;
2219  }
2220  }
2221  break;
2222  }
2223  if (!pType)
2224  {
2225  SAL_WARN("sw.ui", "JumpToTOXMark: tox doesn't exist");
2226  return std::optional<std::pair<SwTOXMark, sal_Int32>>();
2227  }
2228  // type and alt text are the search keys
2229  SwTOXMark tmp(pType);
2230  tmp.SetAlternativeText(entry);
2231  return std::optional<std::pair<SwTOXMark, sal_Int32>>(std::pair<SwTOXMark, sal_Int32>(tmp, counter));
2232 }
2233 
2234 } // namespace sw
2235 
2236 static auto JumpToTOXMark(SwWrtShell & rSh, OUString const& rName) -> bool
2237 {
2238  std::optional<std::pair<SwTOXMark, sal_Int32>> const tmp(
2239  sw::PrepareJumpToTOXMark(*rSh.GetDoc(), rName));
2240  if (!tmp)
2241  {
2242  return false;
2243  }
2244  SwTOXMark const* pMark(&tmp->first);
2245  // hack: check first if one exists
2246  if (&tmp->first != &rSh.GetDoc()->GotoTOXMark(tmp->first, TOX_SAME_NXT, rSh.IsReadOnlyAvailable()))
2247  {
2248  for (sal_Int32 i = 0; i < tmp->second; ++i)
2249  {
2250  pMark = &rSh.GotoTOXMark(*pMark, TOX_SAME_NXT);
2251  }
2252  return true;
2253  }
2254  else
2255  {
2256  SAL_WARN("sw.ui", "JumpToTOXMark: tox mark doesn't exist");
2257  return false;
2258  }
2259 }
2260 
2261 bool SwView::JumpToSwMark( std::u16string_view rMark )
2262 {
2263  bool bRet = false;
2264  if( !rMark.empty() )
2265  {
2266  // place bookmark at top-center
2267  bool bSaveCC = m_bCenterCursor;
2268  bool bSaveCT = m_bTopCursor;
2269  SetCursorAtTop( true );
2270 
2271  // For scrolling the FrameSet, the corresponding shell needs to have the focus.
2272  bool bHasShFocus = m_pWrtShell->HasShellFocus();
2273  if( !bHasShFocus )
2274  m_pWrtShell->ShellGetFocus();
2275 
2276  const SwFormatINetFormat* pINet;
2277  OUString sCmp;
2278  OUString sMark( INetURLObject::decode( rMark,
2280 
2281  sal_Int32 nLastPos, nPos = sMark.indexOf( cMarkSeparator );
2282  if( -1 != nPos )
2283  while( -1 != ( nLastPos = sMark.indexOf( cMarkSeparator, nPos + 1 )) )
2284  nPos = nLastPos;
2285 
2287  IDocumentMarkAccess* const pMarkAccess = m_pWrtShell->getIDocumentMarkAccess();
2288  if( -1 != nPos )
2289  sCmp = sMark.copy(nPos + 1).replaceAll(" ", "");
2290 
2291  if( !sCmp.isEmpty() )
2292  {
2293  OUString sName( sMark.copy( 0, nPos ) );
2294  sCmp = sCmp.toAsciiLowerCase();
2295  FlyCntType eFlyType = FLYCNTTYPE_ALL;
2296 
2297  if (sCmp == "drawingobject")
2298  bRet = m_pWrtShell->GotoDrawingObject(sName);
2299  else if( sCmp == "region" )
2300  {
2301  m_pWrtShell->EnterStdMode();
2302  bRet = m_pWrtShell->GotoRegion( sName );
2303  }
2304  else if( sCmp == "outline" )
2305  {
2306  m_pWrtShell->EnterStdMode();
2307  bRet = m_pWrtShell->GotoOutline( sName );
2308  }
2309  else if( sCmp == "frame" )
2310  eFlyType = FLYCNTTYPE_FRM;
2311  else if( sCmp == "graphic" )
2312  eFlyType = FLYCNTTYPE_GRF;
2313  else if( sCmp == "ole" )
2314  eFlyType = FLYCNTTYPE_OLE;
2315  else if( sCmp == "table" )
2316  {
2317  m_pWrtShell->EnterStdMode();
2318  bRet = m_pWrtShell->GotoTable( sName );
2319  }
2320  else if( sCmp == "sequence" )
2321  {
2322  m_pWrtShell->EnterStdMode();
2323  sal_Int32 nNoPos = sName.indexOf( cSequenceMarkSeparator );
2324  if ( nNoPos != -1 )
2325  {
2326  sal_uInt16 nSeqNo = o3tl::toInt32(sName.subView( nNoPos + 1 ));
2327  sName = sName.copy( 0, nNoPos );
2328  bRet = m_pWrtShell->GotoRefMark(sName, REF_SEQUENCEFLD, nSeqNo);
2329  }
2330  }
2331  else if (sCmp == "toxmark")
2332  {
2333  bRet = JumpToTOXMark(*m_pWrtShell, sName);
2334  }
2335  else if( sCmp == "text" )
2336  {
2337  // normal text search
2338  m_pWrtShell->EnterStdMode();
2339 
2340  i18nutil::SearchOptions2 aSearchOpt(
2341  SearchAlgorithms_ABSOLUTE, 0,
2342  sName, OUString(),
2343  SvtSysLocale().GetLanguageTag().getLocale(),
2344  0,0,0,
2345  TransliterationFlags::IGNORE_CASE,
2346  SearchAlgorithms2::ABSOLUTE,
2347  '\\' );
2348 
2349  //todo/mba: assuming that notes shouldn't be searched
2350  if( m_pWrtShell->SearchPattern( aSearchOpt, false/*bSearchInNotes*/, SwDocPositions::Start, SwDocPositions::End ))
2351  {
2352  m_pWrtShell->EnterStdMode(); // remove the selection
2353  bRet = true;
2354  }
2355  }
2356  else if( pMarkAccess->getAllMarksEnd() != (ppMark = pMarkAccess->findMark(sMark)) )
2357  {
2358  bRet = m_pWrtShell->GotoMark( *ppMark, false );
2359  }
2360  else if( nullptr != ( pINet = m_pWrtShell->FindINetAttr( sMark ) )) {
2361  m_pWrtShell->addCurrentPosition();
2362  bRet = m_pWrtShell->GotoINetAttr( *pINet->GetTextINetFormat() );
2363  }
2364 
2365  // for all types of Flys
2366  if( FLYCNTTYPE_ALL != eFlyType && m_pWrtShell->GotoFly( sName, eFlyType ))
2367  {
2368  bRet = true;
2369  if( FLYCNTTYPE_FRM == eFlyType )
2370  {
2371  // TextFrames: set Cursor in the frame
2372  m_pWrtShell->UnSelectFrame();
2373  m_pWrtShell->LeaveSelFrameMode();
2374  }
2375  else
2376  {
2377  m_pWrtShell->HideCursor();
2378  m_pWrtShell->EnterSelFrameMode();
2379  }
2380  }
2381  }
2382  else if( pMarkAccess->getAllMarksEnd() != (ppMark = pMarkAccess->findMark(sMark)))
2383  {
2384  bRet = m_pWrtShell->GotoMark( *ppMark, false );
2385  }
2386  else if( nullptr != ( pINet = m_pWrtShell->FindINetAttr( sMark ) ))
2387  bRet = m_pWrtShell->GotoINetAttr( *pINet->GetTextINetFormat() );
2388 
2389  // make selection visible later
2390  if ( m_aVisArea.IsEmpty() )
2391  m_bMakeSelectionVisible = true;
2392 
2393  // reset ViewStatus
2394  SetCursorAtTop( bSaveCT, bSaveCC );
2395 
2396  if(!m_pWrtShell->IsFrameSelected() && !m_pWrtShell->IsObjSelected())
2397  m_pWrtShell->ShowCursor();
2398 
2399  if( !bHasShFocus )
2400  m_pWrtShell->ShellLoseFocus();
2401  }
2402  return bRet;
2403 }
2404 
2405 // #i67305# Undo after insert from file:
2406 // Undo "Insert form file" crashes with documents imported from binary filter (.sdw) => disabled
2407 // Undo "Insert form file" crashes with (.odt) documents crashes if these documents contains
2408 // page styles with active header/footer => disabled for those documents
2409 static size_t lcl_PageDescWithHeader( const SwDoc& rDoc )
2410 {
2411  size_t nRet = 0;
2412  size_t nCnt = rDoc.GetPageDescCnt();
2413  for( size_t i = 0; i < nCnt; ++i )
2414  {
2415  const SwPageDesc& rPageDesc = rDoc.GetPageDesc( i );
2416  const SwFrameFormat& rMaster = rPageDesc.GetMaster();
2417  const SwFormatHeader* pHeaderItem = rMaster.GetAttrSet().GetItemIfSet( RES_HEADER, false );
2418  const SwFormatFooter* pFooterItem = rMaster.GetAttrSet().GetItemIfSet( RES_FOOTER, false );
2419  if( (pHeaderItem && pHeaderItem->IsActive()) ||
2420  (pFooterItem && pFooterItem->IsActive()) )
2421  ++nRet;
2422  }
2423  return nRet; // number of page styles with active header/footer
2424 }
2425 
2426 void SwView::ExecuteInsertDoc( SfxRequest& rRequest, const SfxPoolItem* pItem )
2427 {
2428  m_pViewImpl->InitRequest( rRequest );
2429  m_pViewImpl->SetParam( pItem ? 1 : 0 );
2430  const sal_uInt16 nSlot = rRequest.GetSlot();
2431 
2432  if ( !pItem )
2433  {
2434  InsertDoc( nSlot, "", "" );
2435  }
2436  else
2437  {
2438  OUString sFile, sFilter;
2439  sFile = static_cast<const SfxStringItem *>( pItem )->GetValue();
2440  if ( SfxItemState::SET == rRequest.GetArgs()->GetItemState( FN_PARAM_1, true, &pItem ) )
2441  sFilter = static_cast<const SfxStringItem *>(pItem )->GetValue();
2442 
2443  bool bHasFileName = !sFile.isEmpty();
2444  tools::Long nFound = InsertDoc( nSlot, sFile, sFilter );
2445 
2446  if ( bHasFileName )
2447  {
2448  rRequest.SetReturnValue( SfxBoolItem( nSlot, nFound != -1 ) );
2449  rRequest.Done();
2450  }
2451  }
2452 }
2453 
2454 tools::Long SwView::InsertDoc( sal_uInt16 nSlotId, const OUString& rFileName, const OUString& rFilterName, sal_Int16 nVersion )
2455 {
2456  std::unique_ptr<SfxMedium> pMed;
2457  SwDocShell* pDocSh = GetDocShell();
2458 
2459  if( !rFileName.isEmpty() )
2460  {
2461  SfxObjectFactory& rFact = pDocSh->GetFactory();
2462  std::shared_ptr<const SfxFilter> pFilter = rFact.GetFilterContainer()->GetFilter4FilterName( rFilterName );
2463  if ( !pFilter )
2464  {
2465  pMed.reset(new SfxMedium(rFileName, StreamMode::READ, nullptr, nullptr ));
2466  SfxFilterMatcher aMatcher( rFact.GetFilterContainer()->GetName() );
2467  pMed->UseInteractionHandler( true );
2468  ErrCode nErr = aMatcher.GuessFilter(*pMed, pFilter, SfxFilterFlags::NONE);
2469  if ( nErr )
2470  pMed.reset();
2471  else
2472  pMed->SetFilter( pFilter );
2473  }
2474  else
2475  pMed.reset(new SfxMedium(rFileName, StreamMode::READ, pFilter, nullptr));
2476  }
2477  else
2478  {
2479  m_pViewImpl->StartDocumentInserter(
2480  // tdf#118578 allow inserting any Writer document except GlobalDoc
2481  SwDocShell::Factory().GetFactoryName(),
2482  LINK( this, SwView, DialogClosedHdl ),
2483  nSlotId
2484  );
2485  return -1;
2486  }
2487 
2488  if( !pMed )
2489  return -1;
2490 
2491  return InsertMedium( nSlotId, std::move(pMed), nVersion );
2492 }
2493 
2494 tools::Long SwView::InsertMedium( sal_uInt16 nSlotId, std::unique_ptr<SfxMedium> pMedium, sal_Int16 nVersion )
2495 {
2496  bool bInsert = false, bCompare = false;
2497  tools::Long nFound = 0;
2498  SwDocShell* pDocSh = GetDocShell();
2499 
2500  switch( nSlotId )
2501  {
2502  case SID_DOCUMENT_MERGE: break;
2503  case SID_DOCUMENT_COMPARE: bCompare = true; break;
2504  case SID_INSERTDOC: bInsert = true; break;
2505 
2506  default:
2507  OSL_ENSURE( false, "unknown SlotId!" );
2508  bInsert = true;
2509  break;
2510  }
2511 
2512  if( bInsert )
2513  {
2514  uno::Reference< frame::XDispatchRecorder > xRecorder =
2515  GetViewFrame()->GetBindings().GetRecorder();
2516  if ( xRecorder.is() )
2517  {
2518  SfxRequest aRequest(GetViewFrame(), SID_INSERTDOC);
2519  aRequest.AppendItem(SfxStringItem(SID_INSERTDOC, pMedium->GetOrigURL()));
2520  if(pMedium->GetFilter())
2521  aRequest.AppendItem(SfxStringItem(FN_PARAM_1, pMedium->GetFilter()->GetName()));
2522  aRequest.Done();
2523  }
2524 
2525  SfxObjectShellRef aRef( pDocSh );
2526 
2527  ErrCode nError = SfxObjectShell::HandleFilter( pMedium.get(), pDocSh );
2528  // #i16722# aborted?
2529  if(nError != ERRCODE_NONE)
2530  {
2531  return -1;
2532  }
2533 
2534  pMedium->Download(); // start download if needed
2535  if( aRef.is() && 1 < aRef->GetRefCount() ) // still a valid ref?
2536  {
2537  SwReaderPtr pRdr;
2538  Reader *pRead = pDocSh->StartConvertFrom(*pMedium, pRdr, m_pWrtShell.get());
2539  if( pRead ||
2540  (pMedium->GetFilter()->GetFilterFlags() & SfxFilterFlags::STARONEFILTER) )
2541  {
2542  size_t nUndoCheck = 0;
2543  SwDoc *pDoc = pDocSh->GetDoc();
2544  if( pRead && pDocSh->GetDoc() )
2545  nUndoCheck = lcl_PageDescWithHeader( *pDoc );
2546  ErrCode nErrno;
2547  { //Scope for SwWait-Object, to be able to execute slots
2548  //outside this scope.
2549  SwWait aWait( *GetDocShell(), true );
2550  m_pWrtShell->StartAllAction();
2551  if ( m_pWrtShell->HasSelection() )
2552  m_pWrtShell->DelRight(); // delete selections
2553  if( pRead )
2554  {
2555  nErrno = pRdr->Read( *pRead ); // and insert document
2556  pRdr.reset();
2557  }
2558  else
2559  {
2560  ::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo());
2561  uno::Reference<text::XTextRange> const xInsertPosition(
2563  *m_pWrtShell->GetCursor()->GetPoint(), nullptr));
2564  nErrno = pDocSh->ImportFrom(*pMedium, xInsertPosition)
2566  }
2567 
2568  }
2569 
2570  // update all "table of ..." sections if needed
2571  if( m_pWrtShell->IsUpdateTOX() )
2572  {
2573  SfxRequest aReq( FN_UPDATE_TOX, SfxCallMode::SLOT, GetPool() );
2574  Execute( aReq );
2575  m_pWrtShell->SetUpdateTOX( false ); // reset
2576  }
2577 
2578  if( pDoc )
2579  { // Disable Undo for .sdw or
2580  // if the number of page styles with header/footer has changed
2581  if( !pRead || nUndoCheck != lcl_PageDescWithHeader( *pDoc ) )
2582  {
2584  }
2585  }
2586 
2587  m_pWrtShell->EndAllAction();
2588  if( nErrno )
2589  {
2590  ErrorHandler::HandleError( nErrno );
2591  nFound = nErrno.IsError() ? -1 : 0;
2592  }
2593  else
2594  nFound = 0;
2595  }
2596  }
2597  }
2598  else
2599  {
2600  SfxObjectShellRef xDocSh;
2601  SfxObjectShellLock xLockRef;
2602 
2603  const int nRet = SwFindDocShell( xDocSh, xLockRef, pMedium->GetName(), OUString(),
2604  OUString(), nVersion, pDocSh );
2605  if( nRet )
2606  {
2607  SwWait aWait( *GetDocShell(), true );
2608  m_pWrtShell->StartAllAction();
2609 
2610  m_pWrtShell->EnterStdMode(); // delete selections
2611 
2612  if( bCompare )
2613  nFound = m_pWrtShell->CompareDoc( *static_cast<SwDocShell*>( xDocSh.get() )->GetDoc() );
2614  else
2615  nFound = m_pWrtShell->MergeDoc( *static_cast<SwDocShell*>( xDocSh.get() )->GetDoc() );
2616 
2617  m_pWrtShell->EndAllAction();
2618 
2619  if (!bCompare && !nFound)
2620  {
2621  std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetEditWin().GetFrameWeld(),
2622  VclMessageType::Info, VclButtonsType::Ok,
2623  SwResId(STR_NO_MERGE_ENTRY)));
2624  xInfoBox->run();
2625  }
2626  if( nRet==2 && xDocSh.is() )
2627  xDocSh->DoClose();
2628  }
2629  }
2630 
2631  return nFound;
2632 }
2633 
2635 {
2636  m_bInMailMerge = true;
2637  SfxBindings& rBind = GetViewFrame()->GetBindings();
2640 }
2641 
2642 #if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
2643 
2644 namespace
2645 {
2646  bool lcl_NeedAdditionalDataSource( const uno::Reference< XDatabaseContext >& _rDatasourceContext )
2647  {
2648  Sequence < OUString > aNames = _rDatasourceContext->getElementNames();
2649 
2650  return ( !aNames.hasElements()
2651  || ( ( 1 == aNames.getLength() )
2652  && aNames.getConstArray()[0] == SW_MOD()->GetDBConfig()->GetBibliographySource().sDataSource
2653  )
2654  );
2655  }
2656 }
2657 
2658 #endif
2659 
2660 void SwView::GenerateFormLetter(bool bUseCurrentDocument)
2661 {
2662 #if !HAVE_FEATURE_DBCONNECTIVITY || ENABLE_FUZZERS
2663  (void) bUseCurrentDocument;
2664 #else
2665  if(bUseCurrentDocument)
2666  {
2667  if(!GetWrtShell().IsAnyDatabaseFieldInDoc())
2668  {
2669  //check availability of data sources (except biblio source)
2670  uno::Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
2671  uno::Reference<XDatabaseContext> xDBContext = DatabaseContext::create(xContext);
2672  bool bCallAddressPilot = false;
2673  if ( lcl_NeedAdditionalDataSource( xDBContext ) )
2674  {
2675  // no data sources are available - create a new one
2676  std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "modules/swriter/ui/datasourcesunavailabledialog.ui"));
2677  std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("DataSourcesUnavailableDialog"));
2678  // no cancel allowed
2679  if (RET_OK != xQuery->run())
2680  return;
2681  bCallAddressPilot = true;
2682  }
2683  else
2684  {
2685  //take an existing data source or create a new one?
2688  if(RET_OK == pConnectionsDlg->Execute())
2689  bCallAddressPilot = !pConnectionsDlg->IsUseExistingConnections();
2690  else
2691  return;
2692 
2693  }
2694  if(bCallAddressPilot)
2695  {
2696  GetViewFrame()->GetDispatcher()->Execute(
2697  SID_ADDRESS_DATA_SOURCE, SfxCallMode::SYNCHRON);
2698  if ( lcl_NeedAdditionalDataSource( xDBContext ) )
2699  // no additional data source has been created
2700  // -> assume that the user has cancelled the pilot
2701  return;
2702  }
2703 
2704  //call insert fields with database field page available, only
2705  SfxViewFrame* pVFrame = GetViewFrame();
2706  //at first hide the default field dialog if currently visible
2707  pVFrame->SetChildWindow(FN_INSERT_FIELD, false);
2708  //enable the status of the db field dialog - it is disabled in the status method
2709  //to prevent creation of the dialog without mail merge active
2710  EnableMailMerge();
2711  //then show the "Data base only" field dialog
2714  SfxCallMode::SYNCHRON, { &aOn });
2715  return;
2716  }
2717  else
2718  {
2719  OUString sSource;
2720  if(!GetWrtShell().IsFieldDataSourceAvailable(sSource))
2721  {
2722  std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "modules/swriter/ui/warndatasourcedialog.ui"));
2723  std::unique_ptr<weld::MessageDialog> xWarning(xBuilder->weld_message_dialog("WarnDataSourceDialog"));
2724  OUString sTmp(xWarning->get_primary_text());
2725  xWarning->set_primary_text(sTmp.replaceFirst("%1", sSource));
2726  if (RET_OK == xWarning->run())
2727  {
2729  ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateVclDialog( nullptr, SID_OPTIONS_DATABASES ));
2730  pDlg->Execute();
2731  }
2732  return ;
2733  }
2734  }
2735  SwDBManager* pDBManager = GetWrtShell().GetDBManager();
2736 
2737  SwDBData aData;
2738  SwWrtShell &rSh = GetWrtShell();
2739 
2740  std::vector<OUString> aDBNameList;
2741  std::vector<OUString> aAllDBNames;
2742  rSh.GetAllUsedDB( aDBNameList, &aAllDBNames );
2743  if(!aDBNameList.empty())
2744  {
2745  OUString sDBName(aDBNameList[0]);
2746  sal_Int32 nIdx {0};
2747  aData.sDataSource = sDBName.getToken(0, DB_DELIM, nIdx);
2748  aData.sCommand = sDBName.getToken(0, DB_DELIM, nIdx);
2749  aData.nCommandType = o3tl::toInt32(o3tl::getToken(sDBName, 0, DB_DELIM, nIdx));
2750  }
2751  rSh.EnterStdMode(); // force change in text shell; necessary for mixing DB fields
2752  AttrChangedNotify(nullptr);
2753 
2754  if (pDBManager)
2755  {
2756  Sequence<PropertyValue> aProperties
2757  {
2758  comphelper::makePropertyValue("DataSourceName", aData.sDataSource),
2759  comphelper::makePropertyValue("Command", aData.sCommand),
2760  comphelper::makePropertyValue("CommandType", aData.nCommandType),
2761  };
2762  pDBManager->ExecuteFormLetter(GetWrtShell(), aProperties);
2763  }
2764  }
2765  else
2766  {
2767  // call documents and template dialog
2768  SfxApplication* pSfxApp = SfxGetpApp();
2769  weld::Window* pTopWin = pSfxApp->GetTopWindow();
2770 
2771  SfxTemplateManagerDlg aDocTemplDlg(GetFrameWeld());
2772  int nRet = aDocTemplDlg.run();
2773  bool bNewWin = false;
2774  if ( nRet == RET_OK )
2775  {
2776  if ( pTopWin != pSfxApp->GetTopWindow() )
2777  {
2778  // the dialogue opens a document -> a new TopWindow appears
2779  pTopWin = pSfxApp->GetTopWindow();
2780  bNewWin = true;
2781  }
2782  }
2783 
2784  if (bNewWin)
2785  {
2786  // after the destruction of the dialogue its parent comes to top,
2787  // but we want that the new document is on top
2788  pTopWin->present();
2789  }
2790  }
2791 #endif
2792 }
2793 
2794 IMPL_LINK( SwView, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, void )
2795 {
2796  if ( ERRCODE_NONE != _pFileDlg->GetError() )
2797  return;
2798 
2799  std::unique_ptr<SfxMedium> pMed = m_pViewImpl->CreateMedium();
2800  if ( !pMed )
2801  {
2802  std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetEditWin().GetFrameWeld(),
2803  VclMessageType::Info, VclButtonsType::Ok,
2804  SwResId(RID_SVXSTR_TXTFILTER_FILTERERROR)));
2805  xInfoBox->run();
2806  return;
2807  }
2808 
2809  const sal_uInt16 nSlot = m_pViewImpl->GetRequest()->GetSlot();
2810  tools::Long nFound = InsertMedium( nSlot, std::move(pMed), m_pViewImpl->GetParam() );
2811 
2812  if ( SID_INSERTDOC == nSlot )
2813  {
2814  if ( m_pViewImpl->GetParam() == 0 )
2815  {
2816  m_pViewImpl->GetRequest()->SetReturnValue( SfxBoolItem( nSlot, nFound != -1 ) );
2817  m_pViewImpl->GetRequest()->Ignore();
2818  }
2819  else
2820  {
2821  m_pViewImpl->GetRequest()->SetReturnValue( SfxBoolItem( nSlot, nFound != -1 ) );
2822  m_pViewImpl->GetRequest()->Done();
2823  }
2824  }
2825  else if ( SID_DOCUMENT_COMPARE == nSlot || SID_DOCUMENT_MERGE == nSlot )
2826  {
2827  m_pViewImpl->GetRequest()->SetReturnValue( SfxInt32Item( nSlot, nFound ) );
2828 
2829  if ( nFound > 0 ) // show Redline browser
2830  {
2831  SfxViewFrame* pVFrame = GetViewFrame();
2833 
2834  // re-initialize Redline dialog
2835  sal_uInt16 nId = SwRedlineAcceptChild::GetChildWindowId();
2836  SwRedlineAcceptChild* pRed = static_cast<SwRedlineAcceptChild*>(pVFrame->GetChildWindow( nId ));
2837  if ( pRed )
2838  pRed->ReInitDlg( GetDocShell() );
2839  }
2840  }
2841 }
2842 
2844 {
2845  if (m_pViewImpl)
2846  m_pViewImpl->ExecuteScan(rReq) ;
2847 }
2848 
2849 const OUString& SwView::GetOldGrfCat()
2850 {
2851  return GetCachedString(OldGrfCat);
2852 }
2853 
2854 void SwView::SetOldGrfCat(const OUString& sStr)
2855 {
2856  SetCachedString(OldGrfCat, sStr);
2857 }
2858 
2859 const OUString& SwView::GetOldTabCat()
2860 {
2861  return GetCachedString(OldTabCat);
2862 }
2863 
2864 void SwView::SetOldTabCat(const OUString& sStr)
2865 {
2866  SetCachedString(OldTabCat, sStr);
2867 }
2868 
2869 const OUString& SwView::GetOldFrameCat()
2870 {
2871  return GetCachedString(OldFrameCat);
2872 }
2873 
2874 void SwView::SetOldFrameCat(const OUString& sStr)
2875 {
2876  SetCachedString(OldFrameCat, sStr);
2877 }
2878 
2879 const OUString& SwView::GetOldDrwCat()
2880 {
2881  return GetCachedString(OldDrwCat);
2882 }
2883 
2884 void SwView::SetOldDrwCat(const OUString& sStr)
2885 {
2886  SwView::SetCachedString(OldDrwCat, sStr);
2887 }
2888 
2889 
2890 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
static void ShowPanel(std::u16string_view rsPanelId, const css::uno::Reference< css::frame::XFrame > &rxFrame, bool bFocus=false)
bool GetValue() const
bool is() const
#define MAXZOOM
Definition: view.hxx:81
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
Definition: nodeoffset.hxx:35
static void ShowDBObj(SwView const &rView, const SwDBData &rData)
Definition: swmodul1.cxx:368
Base class of the Writer layout elements.
Definition: frame.hxx:314
void StateStatusLine(SfxItemSet &)
get status of the status line
Definition: view2.cxx:1549
void EnterBlockMode()
Definition: select.cxx:651
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:515
#define MINZOOM
Definition: view.hxx:80
IDocumentStatistics const & getIDocumentStatistics() const
Definition: doc.cxx:373
virtual SfxObjectFactory & GetFactory() const =0
void ToggleBlockMode()
Definition: select.cxx:764
const OUString & GetOldGrfCat()
Definition: view2.cxx:2849
sal_Int32 nCommandType
Definition: swdbdata.hxx:32
FlyMode
Definition: mdiexp.hxx:41
OUString const & GetCurPageStyle() const
Definition: wrtsh1.cxx:1796
#define FN_EDIT_REGION
Definition: cmdid.h:115
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
void ItemSetToPageDesc(const SfxItemSet &rSet, SwPageDesc &rPageDesc)
Definition: uitool.cxx:277
constexpr TypedWhichId< SvxTabStopItem > RES_PARATR_TABSTOP(68)
SfxChildWindow * GetChildWindow(sal_uInt16)
bool IsInsMode() const
Definition: wrtsh.hxx:171
void ToggleInsMode()
Definition: wrtsh.hxx:170
bool IsDefault() const
Definition: format.hxx:129
SwTableBox * GetTableBox() const
If node is in a table return the respective table box.
Definition: node.cxx:754
#define FN_SET_ADD_MODE
Definition: cmdid.h:687
void SetCounts(const SwDocStat &rCurrCnt, const SwDocStat &rDocStat)
static SfxAbstractDialogFactory * Create()
virtual const css::uno::Sequence< sal_Int8 > & GetRedlinePassword() const =0
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
virtual void SetChangeRecording(bool bActivate, bool bLockAllViews=false) override
Definition: docsh.cxx:1357
SwUndoId
Definition: swundo.hxx:29
constexpr TypedWhichId< SwFormatHeader > RES_HEADER(96)
std::string GetValue
static const std::vector< OUString > & GetFrameFormatUINameArray()
const SwNumRule * GetNumRuleAtCurrCursorPos() const
Definition: ednumber.cxx:716
SwNodeIndex nNode
Definition: pam.hxx:38
bool IsTableMode() const
Definition: crsrsh.hxx:648
#define FN_STAT_BOOKMARK
Definition: cmdid.h:845
SfxDispatcher * GetDispatcher()
wrapper iterator: wraps iterator of implementation while hiding MarkBase class; only IMark instances ...
bool AreObjectsMarked() const
tools::Long InsertDoc(sal_uInt16 nSlotId, const OUString &rFileName, const OUString &rFilterName, sal_Int16 nVersion=0)
Definition: view2.cxx:2454
static SvxAbstractDialogFactory * Create()
sal_uIntPtr sal_uLong
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
long Long
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
tools::Long GetRight() const
Size GetObjSize() const
Definition: feshview.cxx:2392
OUString sDataSource
Definition: swdbdata.hxx:30
constexpr TypedWhichId< SwNumRuleItem > RES_PARATR_NUMRULE(72)
static const AllSettings & GetSettings()
void CountWords(SwDocStat &rStat) const
Count words in current selection.
Definition: editsh.cxx:1083
SwFrameFormat * MakeFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom, bool bBroadcast=false, bool bAuto=true)
Definition: docfmt.cxx:820
bool Pop(SwCursorShell::PopMode=SwCursorShell::PopMode::DeleteStack)
Definition: wrtsh1.cxx:1949
bool IsAutoRule() const
Definition: numrule.hxx:229
sal_uInt16 GetPageSelection() const
Definition: gotodlg.hxx:33
Provides access to the marks of a document.
Definition: doc.hxx:187
#define FN_FORMAT_TABLE_DLG
Definition: cmdid.h:333
const ::avmedia::MediaItem * Execute(const SdrMarkView *pSdrView, SfxRequest const &rReq)
sal_uInt16 GetValue() const
constexpr sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:92
static SVL_DLLPUBLIC void GetHashPassword(css::uno::Sequence< sal_Int8 > &rPassHash, const char *pPass, sal_uInt32 nLen)
sal_uLong nChar
Definition: docstat.hxx:37
sal_Int16 nId
void setOriginURL(OUString const &rOriginURL)
sal_uInt16 FirstWhich()
const ContentProperties & rData
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
Definition: edws.cxx:234
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
const IDocumentSettingAccess & getIDocumentSettingAccess() const
Provides access to the document setting interface.
Definition: viewsh.cxx:2777
SwNode & GetNode() const
Definition: ndindex.hxx:119
void EnterStdMode()
Definition: select.cxx:551
void Done(bool bRemove=false)
int SwFindDocShell(SfxObjectShellRef &xDocSh, SfxObjectShellLock &xLockRef, std::u16string_view rFileName, const OUString &rPasswd, const OUString &rFilter, sal_Int16 nVersion, SwDocShell *pDestSh)
Find the right DocShell and create a new one: The return value specifies what should happen to the Sh...
Definition: docsh2.cxx:1687
void ExtendedSelectAll(bool bFootnotes=true)
Definition: crsrsh.cxx:595
virtual short run() override
weld::Window * GetTopWindow() const
IMPL_LINK(SvDDEObject, ImplGetDDEData, const DdeData *, pData, void)
virtual SfxBindings & GetBindings() override
Dialog to specify the properties of date form field.
virtual const SwDocStat & GetUpdatedDocStat(bool bCompleteAsync, bool bFields)=0
Updates the document statistics if the document has been modified and returns a reference to the resu...
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:144
void ExecuteScan(SfxRequest &rReq)
Definition: view2.cxx:2843
const OUString & GetOldFrameCat()
Definition: view2.cxx:2869
#define FN_STAT_PAGE
Definition: cmdid.h:841
void SetCachedString(CachedStringID id, const OUString &sStr)
Definition: view.hxx:680
static OUString decode(std::u16string_view rText, DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
bool JumpToSwMark(std::u16string_view rMark)
Definition: view2.cxx:2261
const SfxItemSet * GetArgs() const
void Invalidate(sal_uInt16 nId)
#define ERRCODE_GRFILTER_IOERROR
virtual short Execute()=0
#define FN_TO_PREV_PAGE
Definition: cmdid.h:744
RET_CANCEL
static bool IsModifyPasswordCorrect(std::u16string_view aPassword, const css::uno::Sequence< css::beans::PropertyValue > &aInfo)
bool IsStdMode() const
Definition: wrtsh.hxx:152
virtual const SfxItemSet * GetOutputItemSet() const =0
sal_uInt8 GetNumLevel() const
Definition: ednumber.cxx:691
void SetUseInputLanguage(bool bNew)
#i42732# display status of font size/name depending on either the input language or the selection pos...
Definition: edtwin.cxx:6456
bool JumpToSwMark(SwViewShell const *pVwSh, std::u16string_view rMark)
Definition: edtwin3.cxx:117
SwFrameFormat * FindFrameFormatByName(const OUString &rName) const
Definition: docfmt.cxx:745
sal_uInt16 NextWhich()
void SetAttrOutlineContentVisible(bool bVisible)
Definition: ndtxt.cxx:4082
Degree10 getRotation() const
SfxApplication * SfxGetpApp()
bool IsActive() const
Definition: fmthdft.hxx:89
const SwSection * GetCurrSection() const
Definition: edsect.cxx:71
SvxZoomType GetZoomType() const
Definition: viewopt.hxx:546
size_type size() const
Definition: docary.hxx:267
const SwTextINetFormat * GetTextINetFormat() const
Definition: fmtinfmt.hxx:70
bool IsRedlineOn() const
Definition: edredln.cxx:43
virtual sal_uInt32 GetId() const override
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
constexpr tools::Long Width() const
#define FN_NUMBER_BULLETS
Definition: cmdid.h:80
void disposeAndReset(reference_type *pBody)
void AddSnappingPoint(sal_Int32 nNew)
bool MoveShapeHandle(const sal_uInt32 handleNum, const Point &aEndPoint, const sal_Int32 aObjectOrdNum=-1)
virtual VclPtr< AbstractMailMergeFieldConnectionsDlg > CreateMailMergeFieldConnectionsDlg(weld::Window *pParent)=0
virtual VclPtr< AbstractMailMergeCreateFromDlg > CreateMailMergeCreateFromDlg(weld::Window *pParent)=0
#define FN_SYNC_LABELS
Definition: cmdid.h:474
virtual const_iterator_t findMark(const OUString &rMark) const =0
Finds a mark by name.
sal_uInt16 GetDocumentBorder() const
Definition: viewopt.hxx:456
static void SetFrameMode_(FlyMode eMode)
Definition: basesh.hxx:113
PropertiesInfo aProperties
bool getBrowseMode() const
Definition: viewopt.hxx:472
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CTL_LANGUAGE(29)
#define FN_EDIT_LINK_DLG
Definition: cmdid.h:78
const OUString & GetName() const
Definition: format.hxx:131
Footer, for pageformats Client of FrameFormat describing the footer.
Definition: fmthdft.hxx:64
#define FN_EDIT_CURRENT_TOX
Definition: cmdid.h:139
virtual void DelAllUndoObj()=0
Delete all Undo actions.
weld::Window * GetFrameWeld() const
#define FN_PARAM_FTN_INFO
Definition: cmdid.h:785
SwRedlineTable::size_type UpdateTextChangesOnly(SwRedlineTable::size_type &rRedlinePos, bool bUpdateProperty=true) const
Definition: swtable.cxx:1610
Point GetAnchorObjDiff() const
Methods for status line.
Definition: feshview.cxx:2405
const LocaleDataWrapper & GetUILocaleDataWrapper() const
#define ERRCODE_GRFILTER_OPENERROR
#define FN_STAT_SELMODE
Definition: cmdid.h:844
void Insert(const OUString &)
Definition: wrtsh1.cxx:220
#define FN_TO_NEXT_PAGE
Definition: cmdid.h:743
bool IsBlockMode() const
Definition: wrtsh.hxx:167
#define ERRCODE_GRFILTER_FORMATERROR
SwDoc * GetDoc() const
Definition: viewsh.hxx:282
const IDocumentMarkAccess * getIDocumentMarkAccess() const
Provides access to the document bookmark interface.
Definition: viewsh.cxx:2781
const SwTOXBase * GetCurTOX() const
Get current listing before or at the Cursor.
Definition: edtox.cxx:192
const OUString & GetName() const
RedlineFlags on.
void SetAlternativeText(const OUString &rAlt)
Definition: tox.hxx:580
static css::uno::Reference< css::linguistic2::XDictionary > GetIgnoreAllList()
auto PrepareJumpToTOXMark(SwDoc const &rDoc, OUString const &rName) -> std::optional< std::pair< SwTOXMark, sal_Int32 >>
Definition: view2.cxx:2170
const char * sName
const OUString & GetOldTabCat()
Definition: view2.cxx:2859
virtual bool IsConditionalFastCall(const SfxRequest &rReq) override
Definition: view2.cxx:1520
#define FN_INSERT_FIELD_DATA_ONLY
Definition: cmdid.h:219
#define FN_MAILMERGE_SENDMAIL_CHILDWINDOW
Definition: cmdid.h:280
#define FN_LINE_NUMBERING_DLG
Definition: cmdid.h:497
std::unique_ptr< SwReader, o3tl::default_delete< SwReader > > SwReaderPtr
Definition: docsh.hxx:44
void GenerateFormLetter(bool bUseCurrentDocument)
Definition: view2.cxx:2660
constexpr OUStringLiteral aData
Definition: ww8scan.hxx:48
const OUString & GetOldDrwCat()
Definition: view2.cxx:2879
DocumentType eType
static ErrCode LoadGraphic(const OUString &rPath, const OUString &rFilter, Graphic &rGraphic, GraphicFilter *pFilter=nullptr, sal_uInt16 *pDeterminedFormat=nullptr)
tools::Long zoomOut(tools::Long nCurrent)
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Definition: dialoghelp.cxx:19
SwDBManager * GetDBManager() const
For evaluation of DB fields (new DB-manager).
Definition: edfld.cxx:328
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:204
static ErrCode HandleFilter(SfxMedium *pMedium, SfxObjectShell const *pDoc)
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:137
#define FN_STAT_TEMPLATE
Definition: cmdid.h:842
#define FN_REDLINE_ACCEPT_DIRECT
Definition: cmdid.h:144
T * get() const
#define FN_PAGEUP
Definition: cmdid.h:685
sal_uInt16 char * pName
static void FireColumnChangeEvent(sal_uInt16 nOldColumn, sal_uInt16 nNewColumn)
Definition: crsrsh.cxx:447
const SwTableNode * IsCursorInTable() const
Definition: crsrsh.hxx:898
Style of a layout element.
Definition: frmfmt.hxx:59
void UpdateDocStats()
Definition: view2.cxx:1541
virtual bool IsThisDocument() const =0
bool HasSelection() const
Definition: wrtsh.hxx:147
bool IsBookMode() const
#define SW_MOD()
Definition: swmodule.hxx:255
void GetAllUsedDB(std::vector< OUString > &rDBNameList, std::vector< OUString > const *pAllDBNames)
Definition: edfld.cxx:301
static constexpr auto npos
Definition: ndarr.hxx:80
virtual const_iterator_t getAllMarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of marks.
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
int i
void EditLinkDlg()
show "edit link" dialog
Definition: view2.cxx:2160
const OUString & GetSectionName() const
Definition: section.hxx:167
void ChildWindowExecute(SfxRequest &)
bool IsViewLayoutBookMode() const
Definition: viewopt.hxx:479
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:59
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:880
SVL_DLLPUBLIC Link< OUString *, bool > const & GetMaybeFileHdl()
FlyCntType
Definition: flyenum.hxx:23
virtual bool IsConditionalFastCall(const SfxRequest &rReq)
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2248
sal_Unicode const toxMarkSeparator
separator for toxmarks: #%19%19|toxmark
Definition: swtypes.hxx:128
tools::Long zoomIn(tools::Long nCurrent)
static DialogMask HandleError(ErrCode nId, weld::Window *pParent=nullptr, DialogMask nMask=DialogMask::MAX)
#define FN_REDLINE_ACCEPT_TONEXT
Definition: cmdid.h:152
sal_uInt16 GetGutterWidth(bool bMin=false) const
Definition: atrfrm.cxx:919
SfxBindings & GetBindings()
ErrCode InsertGraphic(const OUString &rPath, const OUString &rFilter, bool bLink, GraphicFilter *pFlt)
Definition: view2.cxx:236
void SetOldFrameCat(const OUString &sStr)
Definition: view2.cxx:2874
static void FireSectionChangeEvent(sal_uInt16 nOldSection, sal_uInt16 nNewSection)
Definition: crsrsh.cxx:458
vector_type::size_type size_type
Definition: docary.hxx:222
const OUString & GetValue() const
sal_uInt16 Count() const
HTMLMODE_ON
#define FN_REDLINE_PREV_CHANGE
Definition: cmdid.h:149
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:206
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)
Definition: viewopt.cxx:354
const T * GetArg(sal_uInt16 nSlotId) const
tools::Long GetLeft() const
void ShowExtras(SfxShowExtras nExtras)
static SfxViewFrame * GetNext(const SfxViewFrame &rPrev, const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
Definition: edws.cxx:223
static size_t lcl_PageDescWithHeader(const SwDoc &rDoc)
Definition: view2.cxx:2409
size_t GetPageDescCnt() const
Definition: doc.hxx:879
void NotifyEvent(const SfxEventHint &rEvent, bool bSynchron=true)
float u
void AddRule(SwUndoArg eWhat, const OUString &rWith)
Definition: SwRewriter.cxx:25
#define FN_SCROLL_NEXT
Definition: cmdid.h:188
SwDBData const & GetDBData() const
Database information.
Definition: edfld.cxx:291
const Point & GetMkPos() const
Definition: viscrs.hxx:155
virtual void present()=0
static SwAbstractDialogFactory * Create()
Definition: swabstdlg.cxx:36
tools::ULong GetSidebarBorderWidth(bool bPx=false) const
Definition: PostItMgr.cxx:2141
#define FN_WORDCOUNT_DIALOG
Definition: cmdid.h:604
#define FN_SCROLL_PREV
Definition: cmdid.h:187
bool HasName() const
void LockPaint()
Definition: viewsh.hxx:607
const SwOutlineNodes & GetOutLineNds() const
Array of all OutlineNodes.
Definition: ndarr.hxx:230
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:703
#define FN_UPDATE_CUR_TOX
Definition: cmdid.h:516
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
OUString GetPageStr(sal_uInt16 nPhyNum, sal_uInt16 nVirtNum, const OUString &rPgStr)
Create string for showing the page number in the statusbar.
Definition: view2.cxx:205
Shell * m_pShell
static void SetMoveType(sal_uInt16 nSet)
Definition: viewmdi.cxx:708
Reader * StartConvertFrom(SfxMedium &rMedium, SwReaderPtr &rpRdr, SwCursorShell const *pCursorSh=nullptr, SwPaM *pPaM=nullptr)
For inserting document.
Definition: docsh.cxx:137
bool HasReadonlySel() const
Definition: crsrsh.cxx:3355
void SelAll()
Definition: select.cxx:123
#define FN_SELECTION_CYCLE
Definition: cmdid.h:745
const char sStatusDelim[]
Definition: view2.cxx:158
sal_Int16 nVersion
#define FN_REDLINE_REJECT_TONEXT
Definition: cmdid.h:153
void ExecuteStatusLine(SfxRequest &)
execute method for the status line
Definition: view2.cxx:1902
tools::ULong GetSidebarWidth(bool bPx=false) const
Definition: PostItMgr.cxx:2115
SW_DLLPUBLIC void MakeDefTabs(SwTwips nDefDist, SvxTabStopItem &rTabs)
Definition: uitool.cxx:637
bool StartExecuteAsync(const std::function< void(sal_Int32)> &rEndDialogFn)
const sal_Unicode cMarkSeparator
Definition: swtypes.hxx:124
static auto JumpToTOXMark(SwWrtShell &rSh, OUString const &rName) -> bool
Definition: view2.cxx:2236
sal_uInt32 GetId() const
Definition: redline.hxx:186
#define DB_DELIM
Definition: swtypes.hxx:130
#define FN_STAT_WORDCOUNT
Definition: cmdid.h:846
#define FN_TOGGLE_OUTLINE_CONTENT_VISIBILITY
Definition: cmdid.h:195
static void SetSearchLabel(const SearchLabel &rSL)
#define FN_QRY_MERGE
Definition: cmdid.h:241
tools::Long SwTwips
Definition: swtypes.hxx:51
void SpellItAgainSam(bool bInvalid, bool bOnlyWrong, bool bSmartTags)
Re-trigger spelling in the idle handler.
Definition: doc.cxx:1160
const SwPosition * Start() const
Definition: pam.hxx:213
OUString GetBoxNms() const
Definition: trvltbl.cxx:746
SwFrameFormat * GetTableFormat()
Definition: edws.cxx:183
void SetMinLen(sal_uInt16 Len)
css::uno::Reference< css::linguistic2::XProofreadingIterator > const & GetGCIterator() const
Definition: docnew.cxx:120
const SwFrameFormat * GetDfltFrameFormat() const
Definition: doc.hxx:746
SW_DLLPUBLIC bool HasActiveSidebarWin() const
Definition: PostItMgr.cxx:2366
virtual void SetLimits(sal_uInt16 nMin, sal_uInt16 nMax)=0
virtual const SwRangeRedline * GetRedline(const SwPosition &rPos, SwRedlineTable::size_type *pFndPos) const =0
void StartAction()
Definition: crsrsh.cxx:227
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:448
void SetReturnValue(const SfxPoolItem &)
const LanguageTag & getLocale()
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
SdrHdl * GetFocusHdl() const
void Update(sal_uInt16 nId)
bool IsError() const
tools::Long InsertMedium(sal_uInt16 nSlotId, std::unique_ptr< SfxMedium > pMedium, sal_Int16 nVersion)
Definition: view2.cxx:2494
void ResetAttr(const o3tl::sorted_vector< sal_uInt16 > &attrs=o3tl::sorted_vector< sal_uInt16 >(), SwPaM *pCursor=nullptr)
Definition: edatmisc.cxx:32
#define ERRCODE_GRFILTER_TOOBIG
sal_uInt16 GetWishWidth() const
Definition: fmtclds.hxx:122
#define ERRCODE_GRFILTER_FILTERERROR
#define FN_FORMAT_FRAME_DLG
Definition: cmdid.h:331
void UpdatePageNums()
invalidate page numbering field
Definition: view2.cxx:1535
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:238
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
#define ERRCODE_GRFILTER_VERSIONERROR
SdrHdl * GetHdl(size_t nNum) const
void GotoMark(const ::sw::mark::IMark *const pMark)
Definition: wrtsh3.cxx:215
#define FN_NAV_ELEMENT
Definition: cmdid.h:186
LanguageType GetLanguage() const
sal_uInt16 GetSlot() const
void ExecuteInsertDoc(SfxRequest &rRequest, const SfxPoolItem *pItem)
Definition: view2.cxx:2426
bool IsAnyDatabaseFieldInDoc() const
Definition: edfld.cxx:383
bool HasChildWindow(sal_uInt16)
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:335
#define FN_INSERT_FIELD
Definition: cmdid.h:207
void ToggleInsModeOnActiveSidebarWin()
Definition: PostItMgr.cxx:2409
static void FirePageChangeEvent(sal_uInt16 nOldPage, sal_uInt16 nNewPage)
Definition: crsrsh.cxx:436
bool IsCursorVisible() const
Definition: crsrsh.hxx:525
void DisableItem(sal_uInt16 nWhich)
static SVL_DLLPUBLIC bool CompareHashPassword(const css::uno::Sequence< sal_Int8 > &rOldPassHash, std::u16string_view sNewPass)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(105)
void EnterExtMode()
Definition: select.cxx:584
#define FN_SPELL_GRAMMAR_DIALOG
Definition: cmdid.h:614
Rect covering the pages area.
static void CalculateNonBlankPages(const SwRootFrame &rLayout, sal_uInt16 &nDocPageCount, sal_uInt16 &nActualPage)
Definition: doc.cxx:642
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void ToggleAddMode()
Definition: select.cxx:758
#define ERRCODE_NONE
#define FN_SET_BLOCK_MODE
Definition: cmdid.h:720
constexpr tools::Long Height() const
void SetValueSet(SvxZoomEnableFlags nValues)
unsigned char sal_uInt8
sal_uInt16 GetPhyPageNum() const
Definition: trvlfrm.cxx:1695
#define STR_SW_EVENT_PAGE_COUNT
Definition: swevent.hxx:27
void LockView(bool b)
Definition: viewsh.hxx:467
#define GetWhich(nSlot)
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:428
TOXTypes GetType() const
Definition: tox.hxx:720
#define FN_REDLINE_NEXT_CHANGE
Definition: cmdid.h:148
std::shared_ptr< const SfxFilter > GetFilter4FilterName(const OUString &rName, SfxFilterFlags nMust=SfxFilterFlags::NONE, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
SvxZoomType GetType() const
virtual const_iterator_t getBookmarksBegin() const =0
returns a STL-like random access iterator to the begin of the sequence the IBookmarks.
virtual bool ReInitDlg(SwDocShell *pDocSh) override
Definition: redlndlg.cxx:71
RET_OK
... page will be formatted if required.
tools::Long AdjustWidth(tools::Long n)
void SetChildWindow(sal_uInt16 nId, bool bVisible, bool bSetFocus=true)
const char sDisplay[]
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:418
const INetURLObject & GetURLObject() const
OUString GetPassword() const
sal_uInt16 GetZoom() const
Definition: viewopt.hxx:505
void Execute(SfxRequest &)
Definition: view2.cxx:543
size_t IsObjSelected() const
Definition: feshview.cxx:1246
virtual short run()
virtual short run() override
Reference< XComponentContext > getProcessComponentContext()
const Point & GetPtPos() const
Definition: viscrs.hxx:153
#define FN_PAGEDOWN
Definition: cmdid.h:686
void SetOldGrfCat(const OUString &sStr)
Definition: view2.cxx:2854
bool HasNotes() const
Definition: PostItMgr.cxx:2110
#define FN_FORMAT_PAGE_DLG
Definition: cmdid.h:328
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
#define FN_SET_EXT_MODE
Definition: cmdid.h:688
Header, for PageFormats Client of FrameFormat describing the header.
Definition: fmthdft.hxx:33
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
Definition: edattr.cxx:171
static OUString GetEventName(sal_Int32 nId)
Definition: docsh.cxx:1329
bool bColumnChange()
Definition: crsrsh.cxx:469
void ShowChildWindow(sal_uInt16, bool bVisible=true)
const char cSequenceMarkSeparator
Definition: swtypes.hxx:126
void SetFrameFormat(SwFrameFormat *pFormat, bool bKeepOrient=false, Point const *pDocPos=nullptr)
If frame then set frame style.
Definition: fefly1.cxx:1223
static css::uno::Sequence< css::beans::PropertyValue > ConvertPasswordInfo(const css::uno::Sequence< css::beans::PropertyValue > &aInfo)
bool read(Graphic const &rGraphic)
const std::u16string_view aStringList[]
#define ERR_SWG_READ_ERROR
Definition: swerror.h:25
void InsFrameMode(sal_uInt16 nCols)
Definition: view2.cxx:2135
sal_uInt32 GetValue() const
static GraphicFilter & GetGraphicFilter()
SAL_DLLPRIVATE bool InsertGraphicDlg(SfxRequest &)
Definition: view2.cxx:304
static SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
constexpr TypedWhichId< SwFormatFooter > RES_FOOTER(97)
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
void AppendItem(const SfxPoolItem &)
#define SAL_WARN(area, stream)
void rotate(Degree10 aRotation)
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
OUString getNum(sal_Int64 nNumber, sal_uInt16 nDecimals, bool bUseThousandSep=true, bool bTrailingZeros=true) const
size_t size() const
const SdrHdlList & GetHdlList() const
bool IsAddMode() const
Definition: wrtsh.hxx:162
void EnableMailMerge()
Definition: view2.cxx:2634
SvxZoomType
#define SW_LEAVE_FRAME
Definition: fesh.hxx:168
virtual bool ImportFrom(SfxMedium &rMedium, css::uno::Reference< css::text::XTextRange > const &xInsertPosition)
void SetOldTabCat(const OUString &sStr)
Definition: view2.cxx:2864
sal_uInt16 GetPageNumber(const Point &rPoint) const
Page number of the page containing Point, O if no page.
Definition: fews.cxx:185
virtual VclPtr< VclAbstractDialog > CreateVclSwViewDialog(SwView &rView)=0
SectionType GetType() const
Definition: section.hxx:169
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:136
sal_uLong nWord
Definition: docstat.hxx:35
static css::uno::Reference< css::text::XTextRange > CreateXTextRange(SwDoc &rDoc, const SwPosition &rPos, const SwPosition *const pMark)
Definition: unoobj2.cxx:1214
int GetCurrentParaOutlineLevel() const
Get Outline level of current paragraph.
Definition: ednumber.cxx:399
const SwFormatPageDesc & GetPageDesc(bool=true) const
Definition: fmtpdsc.hxx:78
virtual const SwRedlineTable & GetRedlineTable() const =0
bool IsActive() const
Definition: fmthdft.hxx:58
Point m_MarkPt
Definition: viscrs.hxx:131
bool ShowNotes() const
Definition: PostItMgr.cxx:2104
const SwFrameFormats * GetFrameFormats() const
Definition: doc.hxx:737
SfxFilterContainer * GetFilterContainer() const
virtual void SetRedlinePassword(const css::uno::Sequence< sal_Int8 > &rNewPassword)=0
static FlyMode GetFrameMode()
Definition: basesh.hxx:114
void Init(sal_uInt16 nNumCols, sal_uInt16 nGutterWidth, sal_uInt16 nAct)
This function allows to (repeatedly) initialize the columns.
Definition: atrfrm.cxx:970
void EnterAddMode()
Definition: select.cxx:626
SelectionType GetSelectionType() const
Definition: wrtsh1.cxx:1631
#define FN_ESCAPE
Definition: cmdid.h:689
constexpr OUStringLiteral first
#define FN_REDLINE_SHOW
Definition: cmdid.h:129
#define FN_INSERT_MULTI_TOX
Definition: cmdid.h:294
SwTableLine * GetUpper()
Definition: swtable.hxx:453
void Ignore()
#define FN_REDLINE_REJECT_DIRECT
Definition: cmdid.h:145
void ExecuteFormLetter(SwWrtShell &rSh, const css::uno::Sequence< css::beans::PropertyValue > &rProperties)
Definition: dbmgr.cxx:2914
static constexpr size_type npos
Definition: docary.hxx:223
OUString const & GetName() const
bool IsAuto() const
Query / set AutoFormat-flag.
Definition: format.hxx:178
OUString sCommand
Definition: swdbdata.hxx:31
#define FN_REDLINE_ACCEPT
Definition: cmdid.h:137
aStr
bool IsFrameSelected() const
Definition: feshview.cxx:1254
sal_uInt16 GetViewLayoutColumns() const
Definition: viewopt.hxx:481
void SetOldDrwCat(const OUString &sStr)
Definition: view2.cxx:2884
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, bool bMobile=false)
no RedlineFlags
bool IsOutlineRule() const
Definition: numrule.hxx:241
static void lcl_SetAllTextToDefaultLanguage(SwWrtShell &rWrtSh, sal_uInt16 nWhichId)
Definition: view2.cxx:172
Definition: view.hxx:144
virtual VclPtr< AbstractSvxZoomDialog > CreateSvxZoomDialog(weld::Window *pParent, const SfxItemSet &rCoreSet)=0
sal_uInt16 nPos
OUString SfxResId(TranslateId aId)
static std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
sal_uInt16 GetGapBetweenPages() const
Definition: viewopt.hxx:457
void ToggleExtMode()
Definition: select.cxx:770
void UnlockPaint(bool bVirDev=false)
Definition: viewsh.hxx:612
#define FN_GOTO_PAGE
Definition: cmdid.h:519
const OUString & GetTOXName() const
Definition: tox.hxx:479
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:864
SdrHdlKind GetKind() const
void EndAction(const bool bIdleEnd=false)
Definition: crsrsh.cxx:244
SVL_DLLPUBLIC OUString SmartRel2Abs(INetURLObject const &rTheBaseURIRef, OUString const &rTheRelURIRef, Link< OUString *, bool > const &rMaybeFileHdl=Link< OUString *, bool >(), bool bCheckFileExists=true, bool bIgnoreFragment=false, INetURLObject::EncodeMechanism eEncodeMechanism=INetURLObject::EncodeMechanism::WasEncoded, INetURLObject::DecodeMechanism eDecodeMechanism=INetURLObject::DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8, FSysStyle eStyle=FSysStyle::Detect)
Base class of the Writer document model elements.
Definition: node.hxx:81
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo
SfxMedium * GetMedium() const