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