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/XFilePicker3.hpp>
27 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
28 #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
29 #include <com/sun/star/ui/dialogs/ListboxControlActions.hpp>
30 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
31 #include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
32 #include <com/sun/star/linguistic2/XDictionary.hpp>
33 #include <SwCapObjType.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 <svl/PasswordHelper.hxx>
41 #include <svl/urihelper.hxx>
42 #include <svtools/miscopt.hxx>
43 #include <sfx2/passwd.hxx>
44 #include <sfx2/sfxdlg.hxx>
45 #include <sfx2/filedlghelper.hxx>
46 #include <editeng/langitem.hxx>
47 #include <svx/viewlayoutitem.hxx>
48 #include <svx/zoomslideritem.hxx>
49 #include <svx/linkwarn.hxx>
50 #include <sfx2/htmlmode.hxx>
51 #include <vcl/svapp.hxx>
52 #include <sfx2/app.hxx>
53 #include <sfx2/request.hxx>
54 #include <sfx2/bindings.hxx>
55 #include <editeng/lrspitem.hxx>
57 #include <unotools/syslocale.hxx>
58 #include <editeng/unolingu.hxx>
59 #include <vcl/weld.hxx>
60 #include <editeng/tstpitem.hxx>
61 #include <sfx2/event.hxx>
62 #include <sfx2/docfile.hxx>
63 #include <sfx2/docfilt.hxx>
64 #include <sfx2/fcontnr.hxx>
65 #include <editeng/sizeitem.hxx>
66 #include <sfx2/dispatch.hxx>
67 #include <svl/whiter.hxx>
68 #include <svl/ptitem.hxx>
69 #include <sfx2/viewfrm.hxx>
70 #include <vcl/errinf.hxx>
71 #include <tools/urlobj.hxx>
72 #include <svx/svdview.hxx>
73 #include <swtypes.hxx>
74 #include <swwait.hxx>
75 #include <redlndlg.hxx>
76 #include <gotodlg.hxx>
77 #include <view.hxx>
78 #include <uivwimp.hxx>
79 #include <docsh.hxx>
80 #include <doc.hxx>
81 #include <printdata.hxx>
83 #include <IDocumentUndoRedo.hxx>
86 #include <IDocumentStatistics.hxx>
87 #include <wrtsh.hxx>
88 #include <viewopt.hxx>
89 #include <basesh.hxx>
90 #include <swmodule.hxx>
91 #include <uitool.hxx>
92 #include <shellio.hxx>
93 #include <fmtinfmt.hxx>
94 #include <mdiexp.hxx>
95 #include <drawbase.hxx>
96 #include <frmatr.hxx>
97 #include <frmmgr.hxx>
98 #include <pagedesc.hxx>
99 #include <section.hxx>
100 #include <tox.hxx>
101 #include <edtwin.hxx>
102 #include <wview.hxx>
103 #include <cmdid.h>
104 #include <sfx2/strings.hrc>
105 #include <sfx2/sfxresid.hxx>
106 #include <strings.hrc>
107 #include <swerror.h>
108 #include <globals.hrc>
109 #include <fmtclds.hxx>
110 #include <sfx2/templatedlg.hxx>
111 #include <dbconfig.hxx>
112 #include <dbmgr.hxx>
113 #include <reffld.hxx>
114 #include <comphelper/lok.hxx>
115 
116 #include <PostItMgr.hxx>
117 
119 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
120 
121 #include <svx/svxdlg.hxx>
122 #include <swabstdlg.hxx>
123 #include <fmthdft.hxx>
124 #include <unotextrange.hxx>
125 #include <docstat.hxx>
126 #include <wordcountdialog.hxx>
127 #include <sfx2/sidebar/Sidebar.hxx>
128 
131 #include <vcl/settings.hxx>
132 #include <i18nutil/searchopt.hxx>
133 #include <paratr.hxx>
134 #include <rootfrm.hxx>
135 #include <frameformats.hxx>
136 
137 #include <memory>
138 
139 const char sStatusDelim[] = " : ";
140 
141 using namespace sfx2;
142 using namespace ::com::sun::star;
143 using namespace ::com::sun::star::i18n;
144 using namespace ::com::sun::star::util;
145 using namespace ::com::sun::star::uno;
146 using namespace ::com::sun::star::lang;
147 using namespace ::com::sun::star::scanner;
148 using namespace ::com::sun::star::beans;
149 using namespace ::com::sun::star::container;
150 using namespace ::com::sun::star::sdb;
151 using namespace ::com::sun::star::ui::dialogs;
152 
153 static void lcl_SetAllTextToDefaultLanguage( SwWrtShell &rWrtSh, sal_uInt16 nWhichId )
154 {
155  if (!(nWhichId == RES_CHRATR_LANGUAGE ||
156  nWhichId == RES_CHRATR_CJK_LANGUAGE ||
157  nWhichId == RES_CHRATR_CTL_LANGUAGE))
158  return;
159 
160  rWrtSh.StartAction();
161  rWrtSh.LockView( true );
162  rWrtSh.Push();
163 
164  // prepare to apply new language to all text in document
165  rWrtSh.SelAll();
166  rWrtSh.ExtendedSelectAll();
167 
168  // set language attribute to default for all text
169  std::set<sal_uInt16> aAttribs;
170  aAttribs.insert( nWhichId );
171  rWrtSh.ResetAttr( aAttribs );
172 
174  rWrtSh.LockView( false );
175  rWrtSh.EndAction();
176 
177 }
178 
188 OUString SwView::GetPageStr(sal_uInt16 nPhyNum, sal_uInt16 nVirtNum, const OUString& rPgStr)
189 {
190  // Show user-defined page number in brackets if any.
191  OUString extra;
192  if (!rPgStr.isEmpty() && OUString::number(nPhyNum) != rPgStr)
193  extra = rPgStr;
194  else if (nPhyNum != nVirtNum)
195  extra = OUString::number(nVirtNum);
196 
197  sal_uInt16 nPageCount = GetWrtShell().GetPageCnt();
198  sal_uInt16 nPrintedPhyNum = nPhyNum;
199  sal_uInt16 nPrintedPageCount = nPageCount;
200  if (!GetWrtShell().getIDocumentDeviceAccess().getPrintData().IsPrintEmptyPages())
201  SwDoc::CalculateNonBlankPages(*m_pWrtShell->GetLayout(), nPrintedPageCount, nPrintedPhyNum);
202  // Show printed page numbers only, when they are different
203  OUString aStr( nPageCount != nPrintedPageCount
204  ? SwResId(STR_PAGE_COUNT_PRINTED)
205  : (extra.isEmpty() ? SwResId(STR_PAGE_COUNT) : SwResId(STR_PAGE_COUNT_CUSTOM)));
206  aStr = aStr.replaceFirst("%1", OUString::number(nPhyNum));
207  aStr = aStr.replaceFirst("%2", OUString::number(nPageCount));
208  if (nPageCount != nPrintedPageCount)
209  {
210  aStr = aStr.replaceFirst("%3", OUString::number(nPrintedPhyNum));
211  aStr = aStr.replaceFirst("%4", OUString::number(nPrintedPageCount));
212  }
213  else
214  aStr = aStr.replaceFirst("%3", extra);
215 
216  return aStr;
217 }
218 
219 ErrCode SwView::InsertGraphic( const OUString &rPath, const OUString &rFilter,
220  bool bLink, GraphicFilter *pFilter )
221 {
222  SwWait aWait( *GetDocShell(), true );
223 
224  Graphic aGraphic;
225  ErrCode aResult = ERRCODE_NONE;
226  if( !pFilter )
227  {
228  pFilter = &GraphicFilter::GetGraphicFilter();
229  }
230  aResult = GraphicFilter::LoadGraphic( rPath, rFilter, aGraphic, pFilter );
231 
232  if( ERRCODE_NONE == aResult )
233  {
234  GraphicNativeMetadata aMetadata;
235  if ( aMetadata.read(aGraphic) )
236  {
237  const sal_uInt16 aRotation = aMetadata.getRotation();
238  if (aRotation != 0)
239  {
240  GraphicNativeTransform aTransform( aGraphic );
241  aTransform.rotate( aRotation );
242  }
243  }
244 
245  SwFlyFrameAttrMgr aFrameManager( true, GetWrtShellPtr(), Frmmgr_Type::GRF );
246  SwWrtShell& rShell = GetWrtShell();
247 
248  // #i123922# determine if we really want to insert or replace the graphic at a selected object
249  const bool bReplaceMode(rShell.HasSelection() && SelectionType::Frame == rShell.GetSelectionType());
250 
251  if(bReplaceMode)
252  {
253  // #i123922# Do same as in D&D, ReRead graphic and all is done
254  rShell.ReRead(
255  bLink ? rPath : OUString(),
256  bLink ? rFilter : OUString(),
257  &aGraphic);
258  }
259  else
260  {
261  rShell.StartAction();
262  if( bLink )
263  {
264  SwDocShell* pDocSh = GetDocShell();
265  INetURLObject aTemp(
266  pDocSh->HasName() ?
268  OUString());
269 
270  OUString sURL = URIHelper::SmartRel2Abs(
271  aTemp, rPath, URIHelper::GetMaybeFileHdl() );
272  aGraphic.setOriginURL(sURL);
273  rShell.Insert( sURL, rFilter, aGraphic, &aFrameManager );
274  }
275  else
276  {
277  rShell.Insert( OUString(), OUString(), aGraphic, &aFrameManager );
278  }
279 
280  // it is too late after "EndAction" because the Shell can already be destroyed.
281  rShell.EndAction();
282  }
283  }
284  return aResult;
285 }
286 
288 {
289  bool bReturn = false;
290  SwDocShell* pDocShell = GetDocShell();
291  SwDoc* pDoc = pDocShell->GetDoc();
292 
293  OUString sGraphicFormat = SwResId(STR_POOLFRM_GRAPHIC);
294 
295 // No file pickers in a non-desktop (mobile app) build.
296 
297 #if HAVE_FEATURE_DESKTOP
298  // when in HTML mode insert only as a link
299  const sal_uInt16 nHtmlMode = ::GetHtmlMode(pDocShell);
300  std::unique_ptr<FileDialogHelper> pFileDlg(new FileDialogHelper(
301  ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE,
302  FileDialogFlags::Graphic, GetFrameWeld()));
303  pFileDlg->SetTitle(SwResId(STR_INSERT_GRAPHIC ));
304  pFileDlg->SetContext( FileDialogHelper::SW_INSERT_GRAPHIC );
305 
306  uno::Reference < XFilePicker3 > xFP = pFileDlg->GetFilePicker();
307  uno::Reference < XFilePickerControlAccess > xCtrlAcc(xFP, UNO_QUERY);
308  if(nHtmlMode & HTMLMODE_ON)
309  {
310  xCtrlAcc->setValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, makeAny(true));
311  xCtrlAcc->enableControl( ExtendedFilePickerElementIds::CHECKBOX_LINK, false);
312  }
313 
314  std::vector<OUString> aFormats;
315  const size_t nArrLen = pDoc->GetFrameFormats()->size();
316  for( size_t i = 0; i < nArrLen; ++i )
317  {
318  const SwFrameFormat* pFormat = (*pDoc->GetFrameFormats())[ i ];
319  if(pFormat->IsDefault() || pFormat->IsAuto())
320  continue;
321  aFormats.push_back(pFormat->GetName());
322  }
323 
324  // pool formats
325 
326  const std::vector<OUString>& rFramePoolArr(
328  for(const auto & i : rFramePoolArr)
329  {
330  aFormats.push_back(i);
331  }
332 
333  std::sort(aFormats.begin(), aFormats.end());
334  aFormats.erase(std::unique(aFormats.begin(), aFormats.end()), aFormats.end());
335 
336  Sequence<OUString> aListBoxEntries(aFormats.size());
337  OUString* pEntries = aListBoxEntries.getArray();
338  sal_Int16 nSelect = 0;
339  for( size_t i = 0; i < aFormats.size(); ++i )
340  {
341  pEntries[i] = aFormats[i];
342  if(pEntries[i] == sGraphicFormat)
343  nSelect = i;
344  }
345  try
346  {
347  Any aTemplates(&aListBoxEntries, cppu::UnoType<decltype(aListBoxEntries)>::get());
348 
349  xCtrlAcc->setValue( ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE,
350  ListboxControlActions::ADD_ITEMS , aTemplates );
351 
352  Any aSelectPos(&nSelect, cppu::UnoType<decltype(nSelect)>::get());
353  xCtrlAcc->setValue( ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE,
354  ListboxControlActions::SET_SELECT_ITEM, aSelectPos );
355  }
356  catch (const Exception&)
357  {
358  OSL_FAIL("control access failed");
359  }
360 #endif
361 
362  const SfxStringItem* pName = rReq.GetArg<SfxStringItem>(SID_INSERT_GRAPHIC);
363  bool bShowError = !pName;
364  if( pName
365 #if HAVE_FEATURE_DESKTOP
366  || ERRCODE_NONE == pFileDlg->Execute()
367 #endif
368  )
369  {
370 
371  OUString aFileName, aFilterName;
372  if ( pName )
373  {
374  aFileName = pName->GetValue();
375  const SfxStringItem* pFilter = rReq.GetArg<SfxStringItem>(FN_PARAM_FILTER);
376  if ( pFilter )
377  aFilterName = pFilter->GetValue();
378  }
379 #if HAVE_FEATURE_DESKTOP
380  else
381  {
382  aFileName = pFileDlg->GetPath();
383  aFilterName = pFileDlg->GetCurrentFilter();
384  rReq.AppendItem( SfxStringItem( SID_INSERT_GRAPHIC, aFileName ) );
385  rReq.AppendItem( SfxStringItem( FN_PARAM_FILTER, aFilterName ) );
386 
387  bool bAsLink = false;
388  if(nHtmlMode & HTMLMODE_ON)
389  bAsLink = true;
390  else
391  {
392  try
393  {
394  Any aVal = xCtrlAcc->getValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0);
395  OSL_ENSURE(aVal.hasValue(), "Value CBX_INSERT_AS_LINK not found");
396  bAsLink = !aVal.hasValue() || *o3tl::doAccess<bool>(aVal);
397  Any aTemplateValue = xCtrlAcc->getValue(
398  ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE,
399  ListboxControlActions::GET_SELECTED_ITEM );
400  OUString sTmpl;
401  aTemplateValue >>= sTmpl;
402  rReq.AppendItem( SfxStringItem( FN_PARAM_2, sTmpl) );
403  }
404  catch (const Exception&)
405  {
406  OSL_FAIL("control access failed");
407  }
408  }
409  rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bAsLink ) );
410  }
411  const SfxBoolItem* pAsLink = rReq.GetArg<SfxBoolItem>(FN_PARAM_1);
412  const SfxStringItem* pStyle = rReq.GetArg<SfxStringItem>(FN_PARAM_2);
413 #endif
414 
415  bool bAsLink = false;
416 
417 #if HAVE_FEATURE_DESKTOP
418  if( nHtmlMode & HTMLMODE_ON )
419  bAsLink = true;
420  else
421  {
422  if ( rReq.GetArgs() )
423  {
424  if ( pAsLink )
425  bAsLink = pAsLink->GetValue();
426  if ( pStyle && !pStyle->GetValue().isEmpty() )
427  sGraphicFormat = pStyle->GetValue();
428  }
429  else
430  {
431  Any aVal = xCtrlAcc->getValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0);
432  OSL_ENSURE(aVal.hasValue(), "Value CBX_INSERT_AS_LINK not found");
433  bAsLink = !aVal.hasValue() || *o3tl::doAccess<bool>(aVal);
434  Any aTemplateValue = xCtrlAcc->getValue(
435  ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE,
436  ListboxControlActions::GET_SELECTED_ITEM );
437  OUString sTmpl;
438  aTemplateValue >>= sTmpl;
439  if( !sTmpl.isEmpty() )
440  sGraphicFormat = sTmpl;
441  rReq.AppendItem( SfxStringItem( FN_PARAM_2, sGraphicFormat ) );
442  rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bAsLink ) );
443  }
444 
445  // really store as link only?
446  if( bAsLink && SvtMiscOptions().ShowLinkWarningDialog() )
447  {
448  SvxLinkWarningDialog aWarnDlg(GetFrameWeld(), pFileDlg->GetPath());
449  if (aWarnDlg.run() != RET_OK)
450  bAsLink=false; // don't store as link
451  }
452  }
453 #endif
454 
455  SwWrtShell& rSh = GetWrtShell();
456  rSh.LockPaint();
457  rSh.StartAction();
458 
459  SwRewriter aRewriter;
460  aRewriter.AddRule(UndoArg1, SwResId(STR_GRAPHIC_DEFNAME));
461 
462  // #i123922# determine if we really want to insert or replace the graphic at a selected object
463  const bool bReplaceMode(rSh.HasSelection() && SelectionType::Frame == rSh.GetSelectionType());
464 
465  rSh.StartUndo(SwUndoId::INSERT, &aRewriter);
466 
467  ErrCode nError = InsertGraphic( aFileName, aFilterName, bAsLink, &GraphicFilter::GetGraphicFilter() );
468 
469  // format not equal to current filter (with autodetection)
470  if( nError == ERRCODE_GRFILTER_FORMATERROR )
471  nError = InsertGraphic( aFileName, OUString(), bAsLink, &GraphicFilter::GetGraphicFilter() );
472 
473  // #i123922# no new FrameFormat for replace mode, only when new object was created,
474  // else this would reset the current setting for the frame holding the graphic
475  if ( !bReplaceMode && rSh.IsFrameSelected() )
476  {
477  SwFrameFormat* pFormat = pDoc->FindFrameFormatByName( sGraphicFormat );
478  if(!pFormat)
479  pFormat = pDoc->MakeFrameFormat(sGraphicFormat,
480  pDocShell->GetDoc()->GetDfltFrameFormat(),
481  true, false);
482  rSh.SetFrameFormat( pFormat );
483  }
484 
485  const char* pResId(nullptr);
486  if( nError == ERRCODE_GRFILTER_OPENERROR )
487  pResId = STR_GRFILTER_OPENERROR;
488  else if( nError == ERRCODE_GRFILTER_IOERROR )
489  pResId = STR_GRFILTER_IOERROR;
490  else if( nError ==ERRCODE_GRFILTER_FORMATERROR )
491  pResId = STR_GRFILTER_FORMATERROR;
492  else if( nError ==ERRCODE_GRFILTER_VERSIONERROR )
493  pResId = STR_GRFILTER_VERSIONERROR;
494  else if( nError ==ERRCODE_GRFILTER_FILTERERROR )
495  pResId = STR_GRFILTER_FILTERERROR;
496  else if( nError ==ERRCODE_GRFILTER_TOOBIG )
497  pResId = STR_GRFILTER_TOOBIG;
498 
499  rSh.EndAction();
500  rSh.UnlockPaint();
501  if (pResId)
502  {
503  if( bShowError )
504  {
505  std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
506  VclMessageType::Info, VclButtonsType::Ok,
507  SwResId(pResId)));
508  xInfoBox->run();
509  }
510  rReq.Ignore();
511  }
512  else
513  {
514  // set the specific graphic attributes to the graphic
515  bReturn = true;
516  AutoCaption( GRAPHIC_CAP );
517  rReq.Done();
518  }
519 
520  rSh.EndUndo(); // due to possible change of Shell
521  }
522 
523  return bReturn;
524 }
525 
527 {
528  const sal_uInt16 nSlot = rReq.GetSlot();
529  const SfxItemSet* pArgs = rReq.GetArgs();
530  const SfxPoolItem* pItem;
531  bool bIgnore = false;
532  switch( nSlot )
533  {
534  case SID_CREATE_SW_DRAWVIEW:
535  m_pWrtShell->getIDocumentDrawModelAccess().GetOrCreateDrawModel();
536  break;
537 
539  {
542  pDlg->Execute();
543  break;
544  }
545  case FN_EDIT_LINK_DLG:
546  EditLinkDlg();
547  break;
548  case FN_REFRESH_VIEW:
549  GetEditWin().Invalidate();
550  break;
551  case FN_PAGEUP:
552  case FN_PAGEUP_SEL:
553  case FN_PAGEDOWN:
554  case FN_PAGEDOWN_SEL:
555  {
556  tools::Rectangle aVis( GetVisArea() );
557  SwEditWin& rTmpWin = GetEditWin();
558  if ( FN_PAGEUP == nSlot || FN_PAGEUP_SEL == nSlot )
559  PageUpCursor(FN_PAGEUP_SEL == nSlot);
560  else
561  PageDownCursor(FN_PAGEDOWN_SEL == nSlot);
562 
563  rReq.SetReturnValue(SfxBoolItem(nSlot,
564  aVis != GetVisArea()));
565  //#i42732# - notify the edit window that from now on we do not use the input language
566  rTmpWin.SetUseInputLanguage( false );
567  }
568  break;
569  case FN_REDLINE_ON:
570  {
571  if( pArgs &&
572  SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem ))
573  {
574  IDocumentRedlineAccess& rIDRA = m_pWrtShell->getIDocumentRedlineAccess();
575  Sequence <sal_Int8> aPasswd = rIDRA.GetRedlinePassword();
576  if( aPasswd.hasElements() )
577  {
578  OSL_ENSURE( !static_cast<const SfxBoolItem*>(pItem)->GetValue(), "SwView::Execute(): password set and redlining off doesn't match!" );
579 
580  // dummy password from OOXML import: only confirmation dialog
581  if (aPasswd.getLength() == 1 && aPasswd[0] == 1)
582  {
583  std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(m_pWrtShell->GetView().GetFrameWeld(),
584  VclMessageType::Warning, VclButtonsType::YesNo,
585  SfxResId(RID_SVXSTR_END_REDLINING_WARNING)));
586  xWarn->set_default_response(RET_NO);
587  if (xWarn->run() == RET_YES)
588  rIDRA.SetRedlinePassword(Sequence <sal_Int8> ());
589  else
590  break;
591  }
592  else
593  {
594  // xmlsec05: new password dialog
595  SfxPasswordDialog aPasswdDlg(GetFrameWeld());
596  aPasswdDlg.SetMinLen(1);
597  //#i69751# the result of Execute() can be ignored
598  (void)aPasswdDlg.run();
599  OUString sNewPasswd(aPasswdDlg.GetPassword());
600  Sequence <sal_Int8> aNewPasswd = rIDRA.GetRedlinePassword();
601  SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd );
602  if(SvPasswordHelper::CompareHashPassword(aPasswd, sNewPasswd))
603  rIDRA.SetRedlinePassword(Sequence <sal_Int8> ());
604  else
605  { // xmlsec05: message box for wrong password
606  break;
607  }
608  }
609  }
610 
611  const RedlineFlags nOn = static_cast<const SfxBoolItem*>(pItem)->GetValue()
613  const RedlineFlags nMode = m_pWrtShell->GetRedlineFlags();
614  m_pWrtShell->SetRedlineFlagsAndCheckInsMode( (nMode & ~RedlineFlags::On) | nOn);
615 
616  // Notify all view shells of this document, as the track changes mode is document-global.
617  SwDocShell* pDocShell = GetDocShell();
618  for (SfxViewFrame* pViewFrame = SfxViewFrame::GetFirst(pDocShell); pViewFrame; pViewFrame = SfxViewFrame::GetNext(*pViewFrame, pDocShell))
619  {
620  pViewFrame->GetBindings().Invalidate(FN_REDLINE_ON);
621  pViewFrame->GetBindings().Update(FN_REDLINE_ON);
622  }
623  }
624  }
625  break;
626  case FN_REDLINE_PROTECT :
627  {
628  IDocumentRedlineAccess& rIDRA = m_pWrtShell->getIDocumentRedlineAccess();
629  Sequence <sal_Int8> aPasswd = rIDRA.GetRedlinePassword();
630  if( pArgs && SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem )
631  && static_cast<const SfxBoolItem*>(pItem)->GetValue() == aPasswd.hasElements() )
632  break;
633 
634  // xmlsec05: new password dialog
635  // message box for wrong password
636  SfxPasswordDialog aPasswdDlg(GetFrameWeld());
637  aPasswdDlg.SetMinLen(1);
638  if (!aPasswd.hasElements())
639  aPasswdDlg.ShowExtras(SfxShowExtras::CONFIRM);
640  if (aPasswdDlg.run())
641  {
643  OUString sNewPasswd(aPasswdDlg.GetPassword());
644  Sequence <sal_Int8> aNewPasswd =
645  rIDRA.GetRedlinePassword();
646  SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd );
647  if(!aPasswd.hasElements())
648  {
649  rIDRA.SetRedlinePassword(aNewPasswd);
650  }
651  else if(SvPasswordHelper::CompareHashPassword(aPasswd, sNewPasswd))
652  {
653  rIDRA.SetRedlinePassword(Sequence <sal_Int8> ());
654  nOn = RedlineFlags::NONE;
655  }
656  const RedlineFlags nMode = rIDRA.GetRedlineFlags();
657  m_pWrtShell->SetRedlineFlagsAndCheckInsMode( (nMode & ~RedlineFlags::On) | nOn);
658  rReq.AppendItem( SfxBoolItem( FN_REDLINE_PROTECT, !(nMode&RedlineFlags::On) ) );
659  }
660  else
661  bIgnore = true;
662  }
663  break;
664  case FN_REDLINE_SHOW:
665 
666  if( pArgs &&
667  SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem))
668  {
669  // tdf#125754 avoid recursive layout
670  // because all views share the layout, have to use AllAction
671  m_pWrtShell->StartAllAction();
672  m_pWrtShell->GetLayout()->SetHideRedlines(
673  !static_cast<const SfxBoolItem*>(pItem)->GetValue());
674  m_pWrtShell->EndAllAction();
675  if (m_pWrtShell->IsRedlineOn())
676  m_pWrtShell->SetInsMode();
677  }
678  break;
680  case FN_REDLINE_ACCEPT:
681  GetViewFrame()->ToggleChildWindow(nSlot);
682  break;
687  {
688  SwDoc *pDoc = m_pWrtShell->GetDoc();
689  SwPaM *pCursor = m_pWrtShell->GetCursor();
690  const SwRedlineTable& rRedlineTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
692  if (pArgs && pArgs->GetItemState(nSlot, false, &pItem) == SfxItemState::SET)
693  {
694  const sal_Int64 nChangeId = static_cast<const SfxUInt32Item*>(pItem)->GetValue();
695  for (SwRedlineTable::size_type i = 0; i < rRedlineTable.size(); ++i)
696  {
697  if (nChangeId == rRedlineTable[i]->GetId())
698  nRedline = i;
699  }
700  }
701 
702  if( pCursor->HasMark() && nRedline == SwRedlineTable::npos)
703  {
704  if (FN_REDLINE_ACCEPT_DIRECT == nSlot || FN_REDLINE_ACCEPT_TONEXT == nSlot)
705  m_pWrtShell->AcceptRedlinesInSelection();
706  else
707  m_pWrtShell->RejectRedlinesInSelection();
708  }
709  else
710  {
711  // We check for a redline at the start of the selection/cursor, not the point.
712  // This ensures we work properly with FN_REDLINE_NEXT_CHANGE, which leaves the
713  // point at the *end* of the redline and the mark at the start (so GetRedline
714  // would return NULL if called on the point)
715  const SwRangeRedline* pRedline = nullptr;
716  if (nRedline != SwRedlineTable::npos)
717  {
718  // A redline was explicitly requested by specifying an
719  // index, don't guess based on the cursor position.
720 
721  if (nRedline < rRedlineTable.size())
722  pRedline = rRedlineTable[nRedline];
723  }
724  else
725  pRedline = pDoc->getIDocumentRedlineAccess().GetRedline(*pCursor->Start(), &nRedline);
726 
727  assert(pRedline != nullptr);
728  if (pRedline)
729  {
730  if (FN_REDLINE_ACCEPT_DIRECT == nSlot || FN_REDLINE_ACCEPT_TONEXT == nSlot)
731  m_pWrtShell->AcceptRedline(nRedline);
732  else
733  m_pWrtShell->RejectRedline(nRedline);
734  }
735  }
736  if (FN_REDLINE_ACCEPT_TONEXT == nSlot || FN_REDLINE_REJECT_TONEXT == nSlot)
737  {
738  // Go to next change after accepting or rejecting one (tdf#101977)
739  GetViewFrame()->GetDispatcher()->Execute(FN_REDLINE_NEXT_CHANGE, SfxCallMode::ASYNCHRON);
740  }
741  }
742  break;
743 
745  {
746  // If a parameter is provided, try going to the nth change, not to
747  // the next one.
748  SwDoc* pDoc = m_pWrtShell->GetDoc();
749  const SwRedlineTable& rRedlineTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
751  if (pArgs && pArgs->GetItemState(nSlot, false, &pItem) == SfxItemState::SET)
752  {
753  const sal_uInt32 nChangeId = static_cast<const SfxUInt32Item*>(pItem)->GetValue();
754  for (SwRedlineTable::size_type i = 0; i < rRedlineTable.size(); ++i)
755  {
756  if (nChangeId == rRedlineTable[i]->GetId())
757  nRedline = i;
758  }
759  }
760 
761  const SwRangeRedline *pNext = nullptr;
762  if (nRedline < rRedlineTable.size())
763  pNext = m_pWrtShell->GotoRedline(nRedline, true);
764  else
765  pNext = m_pWrtShell->SelNextRedline();
766 
767  if (pNext)
768  {
770  {
771  OString aPayload(".uno:CurrentTrackedChangeId=");
772  sal_uInt32 nRedlineId = pNext->GetId();
773  aPayload += OString::number(nRedlineId);
774  libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aPayload.getStr());
775  }
776 
777  m_pWrtShell->SetInSelect();
778  }
779 
780  }
781  break;
782 
784  {
785  const SwRangeRedline *pPrev = m_pWrtShell->SelPrevRedline();
786 
787  if (pPrev)
788  {
790  {
791  OString aPayload(".uno:CurrentTrackedChangeId=");
792  sal_uInt32 nRedlineId = pPrev->GetId();
793  aPayload += OString::number(nRedlineId);
794  libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aPayload.getStr());
795  }
796 
797  m_pWrtShell->SetInSelect();
798  }
799  }
800  break;
801 
802  case SID_DOCUMENT_COMPARE:
803  case SID_DOCUMENT_MERGE:
804  {
805  OUString sFileName, sFilterName;
806  sal_Int16 nVersion = 0;
807  bool bHasFileName = false;
808  m_pViewImpl->SetParam( 0 );
809  bool bNoAcceptDialog = false;
810 
811  if( pArgs )
812  {
813  if( SfxItemState::SET == pArgs->GetItemState( SID_FILE_NAME, false, &pItem ))
814  sFileName = static_cast<const SfxStringItem*>(pItem)->GetValue();
815  bHasFileName = !sFileName.isEmpty();
816 
817  if( SfxItemState::SET == pArgs->GetItemState( SID_FILTER_NAME, false, &pItem ))
818  sFilterName = static_cast<const SfxStringItem*>(pItem)->GetValue();
819 
820  if( SfxItemState::SET == pArgs->GetItemState( SID_VERSION, false, &pItem ))
821  {
822  nVersion = static_cast<const SfxInt16Item *>(pItem)->GetValue();
823  m_pViewImpl->SetParam( nVersion );
824  }
825  if( SfxItemState::SET == pArgs->GetItemState( SID_NO_ACCEPT_DIALOG, false, &pItem ))
826  {
827  bNoAcceptDialog = static_cast<const SfxBoolItem *>(pItem)->GetValue();
828  }
829  }
830 
831  m_pViewImpl->InitRequest( rReq );
832  long nFound = InsertDoc( nSlot, sFileName, sFilterName, nVersion );
833 
834  if ( bHasFileName )
835  {
836  rReq.SetReturnValue( SfxInt32Item( nSlot, nFound ));
837 
838  if (nFound > 0 && !bNoAcceptDialog) // show Redline browser
839  {
840  SfxViewFrame* pVFrame = GetViewFrame();
842 
843  // re-initialize the Redline dialog
844  const sal_uInt16 nId = SwRedlineAcceptChild::GetChildWindowId();
845  SwRedlineAcceptChild *pRed = static_cast<SwRedlineAcceptChild*>(
846  pVFrame->GetChildWindow(nId));
847  if (pRed)
848  pRed->ReInitDlg(GetDocShell());
849  }
850  }
851  else
852  bIgnore = true;
853  }
854  break;
855  case FN_SYNC_LABELS:
856  GetViewFrame()->ShowChildWindow(nSlot);
857  break;
858  case FN_ESCAPE:
859  {
860  if ( m_pWrtShell->HasDrawViewDrag() )
861  {
862  m_pWrtShell->BreakDrag();
863  m_pWrtShell->EnterSelFrameMode();
864  }
865  else if ( m_pWrtShell->IsDrawCreate() )
866  {
867  GetDrawFuncPtr()->BreakCreate();
868  AttrChangedNotify(nullptr); // shell change if needed
869  }
870  else if ( m_pWrtShell->HasSelection() || IsDrawMode() )
871  {
872  SdrView *pSdrView = m_pWrtShell->HasDrawView() ? m_pWrtShell->GetDrawView() : nullptr;
873  if(pSdrView && pSdrView->AreObjectsMarked() &&
874  pSdrView->GetHdlList().GetFocusHdl())
875  {
876  const_cast<SdrHdlList&>(pSdrView->GetHdlList()).ResetFocusHdl();
877  }
878  else
879  {
880  if(pSdrView)
881  {
882  LeaveDrawCreate();
883  Point aPt(LONG_MIN, LONG_MIN);
884  //go out of the frame
885  m_pWrtShell->SelectObj(aPt, SW_LEAVE_FRAME);
886  SfxBindings& rBind = GetViewFrame()->GetBindings();
887  rBind.Invalidate( SID_ATTR_SIZE );
888  }
889  m_pWrtShell->EnterStdMode();
890  AttrChangedNotify(nullptr); // shell change if necessary
891  }
892  }
893  else if ( GetEditWin().GetApplyTemplate() )
894  {
895  GetEditWin().SetApplyTemplate(SwApplyTemplate());
896  }
897  else if( static_cast<SfxObjectShell*>(GetDocShell())->IsInPlaceActive() )
898  {
899  Escape();
900  }
901  else if ( GetEditWin().IsChainMode() )
902  {
903  GetEditWin().SetChainMode( false );
904  }
905  else if( m_pWrtShell->GetFlyFrameFormat() )
906  {
907  const SwFrameFormat* pFormat = m_pWrtShell->GetFlyFrameFormat();
908  if(m_pWrtShell->GotoFly( pFormat->GetName(), FLYCNTTYPE_FRM ))
909  {
910  m_pWrtShell->HideCursor();
911  m_pWrtShell->EnterSelFrameMode();
912  }
913  }
914  else
915  {
916  SfxBoolItem aItem( SID_WIN_FULLSCREEN, false );
917  GetViewFrame()->GetDispatcher()->ExecuteList(SID_WIN_FULLSCREEN,
918  SfxCallMode::RECORD, { &aItem });
919  bIgnore = true;
920  }
921  }
922  break;
923  case SID_ATTR_BORDER_INNER:
924  case SID_ATTR_BORDER_OUTER:
925  case SID_ATTR_BORDER_SHADOW:
926  if(pArgs)
927  m_pWrtShell->SetAttrSet(*pArgs);
928  break;
929 
930  case SID_ATTR_PAGE:
931  case SID_ATTR_PAGE_SIZE:
932  case SID_ATTR_PAGE_MAXSIZE:
933  case SID_ATTR_PAGE_PAPERBIN:
934  case SID_ATTR_PAGE_EXT1:
935  case FN_PARAM_FTN_INFO:
936  {
937  if(pArgs)
938  {
939  const size_t nCurIdx = m_pWrtShell->GetCurPageDesc();
940  SwPageDesc aPageDesc( m_pWrtShell->GetPageDesc( nCurIdx ) );
941  ::ItemSetToPageDesc( *pArgs, aPageDesc );
942  // change the descriptor of the core
943  m_pWrtShell->ChgPageDesc( nCurIdx, aPageDesc );
944  }
945  }
946  break;
947  case FN_GOTO_PAGE:
948  {
949  SwGotoPageDlg aDlg(GetViewFrame()->GetWindow().GetFrameWeld(), &GetViewFrame()->GetBindings());
950  if (aDlg.run() == RET_OK)
951  GetWrtShell().GotoPage(aDlg.GetPageSelection(), true);
952  }
953  break;
954  case FN_EDIT_CURRENT_TOX:
955  {
956  GetViewFrame()->GetDispatcher()->Execute(
957  FN_INSERT_MULTI_TOX, SfxCallMode::ASYNCHRON);
958  }
959  break;
960  case FN_UPDATE_CUR_TOX:
961  {
962  const SwTOXBase* pBase = m_pWrtShell->GetCurTOX();
963  if(pBase)
964  {
965  // tdf#106374: don't jump view on the update
966  const bool bWasLocked = m_pWrtShell->IsViewLocked();
967  m_pWrtShell->LockView(true);
968  m_pWrtShell->StartAction();
969  if(TOX_INDEX == pBase->GetType())
970  m_pWrtShell->ApplyAutoMark();
971  m_pWrtShell->UpdateTableOf( *pBase );
972  m_pWrtShell->EndAction();
973  if (!bWasLocked)
974  m_pWrtShell->LockView(false);
975  }
976  }
977  break;
978  case FN_UPDATE_TOX:
979  {
980  m_pWrtShell->StartAction();
981  m_pWrtShell->EnterStdMode();
982  bool bOldCursorInReadOnly = m_pWrtShell->IsReadOnlyAvailable();
983  m_pWrtShell->SetReadOnlyAvailable( true );
984 
985  for( int i = 0; i < 2; ++i )
986  {
987  if( m_pWrtShell->GetTOXCount() == 1 )
988  ++i;
989 
990  while( m_pWrtShell->GotoPrevTOXBase() )
991  ; // jump to the first "table of ..."
992 
993  // if we are not in one, jump to next
994  const SwTOXBase* pBase = m_pWrtShell->GetCurTOX();
995  if( !pBase )
996  {
997  m_pWrtShell->GotoNextTOXBase();
998  pBase = m_pWrtShell->GetCurTOX();
999  }
1000 
1001  bool bAutoMarkApplied = false;
1002  while( pBase )
1003  {
1004  if(TOX_INDEX == pBase->GetType() && !bAutoMarkApplied)
1005  {
1006  m_pWrtShell->ApplyAutoMark();
1007  bAutoMarkApplied = true;
1008  }
1009  // pBase is needed only for the interface. Should be changed in future! (JP 1996)
1010  m_pWrtShell->UpdateTableOf( *pBase );
1011 
1012  if( m_pWrtShell->GotoNextTOXBase() )
1013  pBase = m_pWrtShell->GetCurTOX();
1014  else
1015  pBase = nullptr;
1016  }
1017  }
1018  m_pWrtShell->SetReadOnlyAvailable( bOldCursorInReadOnly );
1019  m_pWrtShell->EndAction();
1020  }
1021  break;
1022  case SID_ATTR_BRUSH:
1023  {
1024  if(pArgs && SfxItemState::SET == pArgs->GetItemState(RES_BACKGROUND, false, &pItem))
1025  {
1026  const size_t nCurIdx = m_pWrtShell->GetCurPageDesc();
1027  SwPageDesc aDesc( m_pWrtShell->GetPageDesc( nCurIdx ));
1028  SwFrameFormat& rMaster = aDesc.GetMaster();
1029  rMaster.SetFormatAttr(*pItem);
1030  m_pWrtShell->ChgPageDesc( nCurIdx, aDesc);
1031  }
1032  }
1033  break;
1034  case SID_CLEARHISTORY:
1035  {
1036  m_pWrtShell->DelAllUndoObj();
1037  }
1038  break;
1039  case SID_UNDO:
1040  {
1041  m_pShell->ExecuteSlot(rReq);
1042  }
1043  break;
1044 #if defined(_WIN32) || defined UNX
1045  case SID_TWAIN_SELECT:
1046  case SID_TWAIN_TRANSFER:
1047  GetViewImpl()->ExecuteScan( rReq );
1048  break;
1049 #endif
1050 
1051  case SID_ATTR_DEFTABSTOP:
1052  {
1053  if(pArgs && SfxItemState::SET == pArgs->GetItemState(SID_ATTR_DEFTABSTOP, false, &pItem))
1054  {
1055  SvxTabStopItem aDefTabs( 0, 0, SvxTabAdjust::Default, RES_PARATR_TABSTOP );
1056  const sal_uInt16 nTab = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
1057  MakeDefTabs( nTab, aDefTabs );
1058  m_pWrtShell->SetDefault( aDefTabs );
1059  }
1060  }
1061  break;
1062  case SID_ATTR_LANGUAGE :
1063  if(pArgs && SfxItemState::SET == pArgs->GetItemState(SID_ATTR_LANGUAGE, false, &pItem))
1064  {
1065  SvxLanguageItem aLang(static_cast<const SvxLanguageItem*>(pItem)->GetLanguage(), RES_CHRATR_LANGUAGE);
1066  m_pWrtShell->SetDefault( aLang );
1068  }
1069  break;
1070  case SID_ATTR_CHAR_CTL_LANGUAGE:
1071  if(pArgs && SfxItemState::SET == pArgs->GetItemState(RES_CHRATR_CTL_LANGUAGE, false, &pItem))
1072  {
1073  m_pWrtShell->SetDefault( *pItem );
1075  }
1076  break;
1077  case SID_ATTR_CHAR_CJK_LANGUAGE:
1078  if(pArgs && SfxItemState::SET == pArgs->GetItemState(RES_CHRATR_CJK_LANGUAGE, false, &pItem))
1079  {
1080  m_pWrtShell->SetDefault( *pItem );
1082  }
1083  break;
1084  case FN_NAV_ELEMENT:
1085  {
1086  // nothing here on purpose - if removed only the listbox that changed is changed
1087  }
1088  break;
1089  case FN_SCROLL_PREV:
1090  case FN_SCROLL_NEXT:
1091  {
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  {
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:365
bool ToggleBlockMode()
Definition: select.cxx:763
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:650
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:500
#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:1553
#define FN_EDIT_REGION
Definition: cmdid.h:108
void ItemSetToPageDesc(const SfxItemSet &rSet, SwPageDesc &rPageDesc)
Definition: uitool.cxx:263
constexpr TypedWhichId< SvxTabStopItem > RES_PARATR_TABSTOP(68)
SfxChildWindow * GetChildWindow(sal_uInt16)
bool IsInsMode() const
Definition: wrtsh.hxx:165
bool JumpToSwMark(SwViewShell const *pVwSh, const OUString &rMark)
Definition: edtwin3.cxx:118
void ToggleInsMode()
Definition: wrtsh.hxx:164
bool IsDefault() const
Definition: format.hxx:109
#define FN_SET_ADD_MODE
Definition: cmdid.h:668
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)
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:294
const char aData[]
Definition: ww8scan.hxx:47
void SetState(const SfxItemSet &rSet)
constexpr TypedWhichId< SwFormatHeader > RES_HEADER(96)
std::string GetValue
static const std::vector< OUString > & GetFrameFormatUINameArray()
const SwNumRule * GetNumRuleAtCurrCursorPos() const
Definition: ednumber.cxx:723
long Height() const
#define FN_STAT_BOOKMARK
Definition: cmdid.h:825
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
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
Size GetObjSize() const
Definition: feshview.cxx:2294
OUString sDataSource
Definition: swdbdata.hxx:30
constexpr TypedWhichId< SwNumRuleItem > RES_PARATR_NUMRULE(72)
static const AllSettings & GetSettings()
void CountWords(SwDocStat &rStat) const
Count words in current selection.
Definition: editsh.cxx:1039
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
Definition: langhelper.cxx:399
SwFrameFormat * MakeFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom, bool bBroadcast=false, bool bAuto=true)
Definition: docfmt.cxx:809
bool Pop(SwCursorShell::PopMode=SwCursorShell::PopMode::DeleteStack)
Definition: wrtsh1.cxx:1708
bool IsAutoRule() const
Definition: numrule.hxx:227
sal_uInt16 GetPageSelection() const
Definition: gotodlg.hxx:33
Provides access to the marks of a document.
Definition: doc.hxx:186
#define FN_FORMAT_TABLE_DLG
Definition: cmdid.h:317
static SVL_DLLPUBLIC void GetHashPassword(css::uno::Sequence< sal_Int8 > &rPassHash, const char *pPass, sal_uInt32 nLen)
sal_uLong nChar
Definition: docstat.hxx:37
sal_Int16 nId
void setOriginURL(OUString const &rOriginURL)
sal_uInt16 FirstWhich()
const ContentProperties & rData
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
Definition: edws.cxx:234
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:2585
long SwTwips
Definition: swtypes.hxx:49
void EnterStdMode()
Definition: select.cxx:550
void Done(bool bRemove=false)
void ExtendedSelectAll(bool bFootnotes=true)
Definition: crsrsh.cxx:593
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:821
void SetCachedString(CachedStringID id, const OUString &sStr)
Definition: view.hxx:664
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
const SfxItemSet * GetArgs() const
void Invalidate(sal_uInt16 nId)
#define ERRCODE_GRFILTER_IOERROR
unsigned long GetSidebarBorderWidth(bool bPx=false) const
Definition: PostItMgr.cxx:2080
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:1647
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:698
void SetUseInputLanguage(bool bNew)
#i42732# display status of font size/name depending on either the input language or the selection pos...
Definition: edtwin.cxx:6239
SwFrameFormat * FindFrameFormatByName(const OUString &rName) const
Definition: docfmt.cxx:734
sal_uInt16 NextWhich()
SfxApplication * SfxGetpApp()
const SwSection * GetCurrSection() const
Definition: edsect.cxx:70
SvxZoomType GetZoomType() const
Definition: viewopt.hxx:519
size_type size() const
Definition: docary.hxx:266
const SwTextINetFormat * GetTextINetFormat() const
Definition: fmtinfmt.hxx:70
bool IsRedlineOn() const
Definition: edredln.cxx:42
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:73
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:460
RET_YES
virtual const_iterator_t findMark(const OUString &rMark) const =0
Finds a mark by name.
sal_uInt16 GetDocumentBorder() const
Definition: viewopt.hxx:429
static void SetFrameMode_(FlyMode eMode)
Definition: basesh.hxx:111
PropertiesInfo aProperties
bool getBrowseMode() const
Definition: viewopt.hxx:445
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CTL_LANGUAGE(29)
#define FN_EDIT_LINK_DLG
Definition: cmdid.h:71
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:132
virtual void DelAllUndoObj()=0
Delete all Undo actions.
#define FN_PARAM_FTN_INFO
Definition: cmdid.h:760
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:2307
const LocaleDataWrapper & GetUILocaleDataWrapper() const
#define ERRCODE_GRFILTER_OPENERROR
#define FN_STAT_SELMODE
Definition: cmdid.h:824
bool IsBlockMode() const
Definition: wrtsh.hxx:161
#define ERRCODE_GRFILTER_FORMATERROR
SwDoc * GetDoc() const
Definition: viewsh.hxx:284
const IDocumentMarkAccess * getIDocumentMarkAccess() const
Provides access to the document bookmark interface.
Definition: viewsh.cxx:2589
const SwTOXBase * GetCurTOX() const
Get current listing before or at the Cursor.
Definition: edtox.cxx:187
const OUString & GetName() const
RedlineFlags on.
static css::uno::Reference< css::linguistic2::XDictionary > GetIgnoreAllList()
void Insert(SwField const &, SwPaM *pAnnotationRange=nullptr)
Definition: wrtsh2.cxx:61
const char * sName
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:207
sal_uInt16 getRotation() const
#define FN_MAILMERGE_SENDMAIL_CHILDWINDOW
Definition: cmdid.h:264
#define FN_LINE_NUMBERING_DLG
Definition: cmdid.h:483
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
DocumentType eType
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:336
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:822
#define FN_REDLINE_ACCEPT_DIRECT
Definition: cmdid.h:137
T * get() const
#define FN_PAGEUP
Definition: cmdid.h:666
sal_uInt16 char * pName
static void FireColumnChangeEvent(sal_uInt16 nOldColumn, sal_uInt16 nNewColumn)
Definition: crsrsh.cxx:445
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:770
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:309
virtual const_iterator_t getAllMarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of marks.
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
int i
void EditLinkDlg()
show "edit link" dialog
Definition: view2.cxx:1950
void ToTop(ToTopFlags nFlags=ToTopFlags::NONE)
const OUString & GetSectionName() const
Definition: section.hxx:169
void ChildWindowExecute(SfxRequest &)
bool IsViewLayoutBookMode() const
Definition: viewopt.hxx:452
void EndAction(const bool bIdleEnd=false, const bool DoSetPosX=false)
Definition: crsrsh.cxx:238
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:880
SVL_DLLPUBLIC Link< OUString *, bool > const & GetMaybeFileHdl()
FlyCntType
Definition: flyenum.hxx:23
virtual bool IsConditionalFastCall(const SfxRequest &rReq)
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2235
static DialogMask HandleError(ErrCode nId, weld::Window *pParent=nullptr, DialogMask nMask=DialogMask::MAX)
#define FN_REDLINE_ACCEPT_TONEXT
Definition: cmdid.h:145
sal_uInt16 GetGutterWidth(bool bMin=false) const
Definition: atrfrm.cxx:895
SfxBindings & GetBindings()
ErrCode InsertGraphic(const OUString &rPath, const OUString &rFilter, bool bLink, GraphicFilter *pFlt)
Definition: view2.cxx:219
void SetOldFrameCat(const OUString &sStr)
Definition: view2.cxx:2557
static void FireSectionChangeEvent(sal_uInt16 nOldSection, sal_uInt16 nNewSection)
Definition: crsrsh.cxx:456
vector_type::size_type size_type
Definition: docary.hxx:228
const OUString & GetValue() const
HTMLMODE_ON
#define FN_REDLINE_PREV_CHANGE
Definition: cmdid.h:142
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:337
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:223
static size_t lcl_PageDescWithHeader(const SwDoc &rDoc)
Definition: view2.cxx:2097
size_t GetPageDescCnt() const
Definition: doc.hxx:879
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:183
SwDBData const & GetDBData() const
Database information.
Definition: edfld.cxx:294
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:588
#define FN_SCROLL_PREV
Definition: cmdid.h:182
bool HasName() const
void LockPaint()
Definition: viewsh.hxx:604
#define FN_UPDATE_CUR_TOX
Definition: cmdid.h:501
OUString SwResId(const char *pId)
Definition: swmodule.cxx:178
OUString GetPageStr(sal_uInt16 nPhyNum, sal_uInt16 nVirtNum, const OUString &rPgStr)
Create string for showing the page number in the statusbar.
Definition: view2.cxx:188
Shell * m_pShell
Reader * StartConvertFrom(SfxMedium &rMedium, SwReaderPtr &rpRdr, SwCursorShell const *pCursorSh=nullptr, SwPaM *pPaM=nullptr)
For inserting document.
Definition: docsh.cxx:138
bool HasReadonlySel() const
Definition: crsrsh.cxx:3328
void SelAll()
Definition: select.cxx:122
const char sStatusDelim[]
Definition: view2.cxx:139
sal_Int16 nVersion
#define FN_REDLINE_REJECT_TONEXT
Definition: cmdid.h:146
void ExecuteStatusLine(SfxRequest &)
execute method for the status line
Definition: view2.cxx:1674
SW_DLLPUBLIC void MakeDefTabs(SwTwips nDefDist, SvxTabStopItem &rTabs)
Definition: uitool.cxx:570
const sal_Unicode cMarkSeparator
Definition: swtypes.hxx:137
sal_uInt32 GetId() const
Definition: redline.hxx:183
#define DB_DELIM
Definition: swtypes.hxx:141
#define FN_STAT_WORDCOUNT
Definition: cmdid.h:826
#define FN_QRY_MERGE
Definition: cmdid.h:225
void SpellItAgainSam(bool bInvalid, bool bOnlyWrong, bool bSmartTags)
Re-trigger spelling in the idle handler.
Definition: doc.cxx:1166
const SwPosition * Start() const
Definition: pam.hxx:212
OUString GetBoxNms() const
Definition: trvltbl.cxx:745
SwFrameFormat * GetTableFormat()
Definition: edws.cxx:183
void SetMinLen(sal_uInt16 Len)
css::uno::Reference< css::linguistic2::XProofreadingIterator > const & GetGCIterator() const
Definition: docnew.cxx:110
const SwFrameFormat * GetDfltFrameFormat() const
Definition: doc.hxx:744
SW_DLLPUBLIC bool HasActiveSidebarWin() const
Definition: PostItMgr.cxx:2305
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:221
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:458
void SetReturnValue(const SfxPoolItem &)
const LanguageTag & getLocale()
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
SdrHdl * GetFocusHdl() const
void Update(sal_uInt16 nId)
bool IsError() const
#define ERRCODE_GRFILTER_TOOBIG
sal_uInt16 GetWishWidth() const
Definition: fmtclds.hxx:122
#define ERRCODE_GRFILTER_FILTERERROR
#define FN_FORMAT_FRAME_DLG
Definition: cmdid.h:315
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:217
const PropertyValue * pValues
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:133
#define FN_NAV_ELEMENT
Definition: cmdid.h:181
sal_uInt16 GetSlot() const
void ExecuteInsertDoc(SfxRequest &rRequest, const SfxPoolItem *pItem)
Definition: view2.cxx:2115
bool IsAnyDatabaseFieldInDoc() const
Definition: edfld.cxx:391
bool HasChildWindow(sal_uInt16)
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:334
#define FN_INSERT_FIELD
Definition: cmdid.h:195
void ToggleInsModeOnActiveSidebarWin()
Definition: PostItMgr.cxx:2348
static void FirePageChangeEvent(sal_uInt16 nOldPage, sal_uInt16 nNewPage)
Definition: crsrsh.cxx:434
bool IsCursorVisible() const
Definition: crsrsh.hxx:524
void DisableItem(sal_uInt16 nWhich)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(105)
void EnterExtMode()
Definition: select.cxx:583
#define FN_SPELL_GRAMMAR_DIALOG
Definition: cmdid.h:598
Rect covering the pages area.
static void CalculateNonBlankPages(const SwRootFrame &rLayout, sal_uInt16 &nDocPageCount, sal_uInt16 &nActualPage)
Definition: doc.cxx:642
void ToggleAddMode()
Definition: select.cxx:757
#define ERRCODE_NONE
#define FN_SET_BLOCK_MODE
Definition: cmdid.h:701
void SetValueSet(SvxZoomEnableFlags nValues)
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:149
TOXTypes GetType() const
Definition: tox.hxx:695
#define FN_REDLINE_NEXT_CHANGE
Definition: cmdid.h:141
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:69
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:478
void Execute(SfxRequest &)
Definition: view2.cxx:526
size_t IsObjSelected() const
Definition: feshview.cxx:1150
virtual short run()
virtual short run() override
Reference< XComponentContext > getProcessComponentContext()
#define FN_PAGEDOWN
Definition: cmdid.h:667
void SetOldGrfCat(const OUString &sStr)
Definition: view2.cxx:2537
bool HasNotes() const
Definition: PostItMgr.cxx:2049
bool IsExtMode() const
Definition: wrtsh.hxx:151
#define FN_FORMAT_PAGE_DLG
Definition: cmdid.h:312
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
#define FN_SET_EXT_MODE
Definition: cmdid.h:669
Header, for PageFormats Client of FrameFormat describing the header.
Definition: fmthdft.hxx:33
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
Definition: edattr.cxx:176
static OUString GetEventName(sal_Int32 nId)
Definition: docsh.cxx:1317
bool bColumnChange()
Definition: crsrsh.cxx:467
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:1197
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:2054
static GraphicFilter & GetGraphicFilter()
SAL_DLLPRIVATE bool InsertGraphicDlg(SfxRequest &)
Definition: view2.cxx:287
static SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
constexpr TypedWhichId< SwFormatFooter > RES_FOOTER(97)
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 &)
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
OUString getNum(sal_Int64 nNumber, sal_uInt16 nDecimals, bool bUseThousandSep=true, bool bTrailingZeros=true) const
size_t size() const
const SdrHdlList & GetHdlList() const
bool IsAddMode() const
Definition: wrtsh.hxx: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:183
void ResetAttr(const std::set< sal_uInt16 > &attrs=std::set< sal_uInt16 >(), SwPaM *pCursor=nullptr)
Definition: edatmisc.cxx:32
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:1054
int GetCurrentParaOutlineLevel() const
Get Outline level of current paragraph.
Definition: ednumber.cxx:406
const SwFormatPageDesc & GetPageDesc(bool=true) const
Definition: fmtpdsc.hxx:79
virtual const SwRedlineTable & GetRedlineTable() const =0
bool ShowNotes() const
Definition: PostItMgr.cxx:2043
const SwFrameFormats * GetFrameFormats() const
Definition: doc.hxx:735
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:946
void EnterAddMode()
Definition: select.cxx:625
SelectionType GetSelectionType() const
Definition: wrtsh1.cxx:1388
#define FN_ESCAPE
Definition: cmdid.h:670
#define FN_REDLINE_SHOW
Definition: cmdid.h:122
#define FN_INSERT_MULTI_TOX
Definition: cmdid.h:278
void Ignore()
#define FN_REDLINE_REJECT_DIRECT
Definition: cmdid.h:138
void ExecuteFormLetter(SwWrtShell &rSh, const css::uno::Sequence< css::beans::PropertyValue > &rProperties)
Definition: dbmgr.cxx:2953
static constexpr size_type npos
Definition: docary.hxx:229
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:130
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:1158
sal_uInt16 GetViewLayoutColumns() const
Definition: viewopt.hxx:454
void SetOldDrwCat(const OUString &sStr)
Definition: view2.cxx:2567
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
OUString SfxResId(const char *pId)
no RedlineFlags
bool IsOutlineRule() const
Definition: numrule.hxx:239
static void lcl_SetAllTextToDefaultLanguage(SwWrtShell &rWrtSh, sal_uInt16 nWhichId)
Definition: view2.cxx:153
Definition: view.hxx:146
virtual VclPtr< AbstractSvxZoomDialog > CreateSvxZoomDialog(weld::Window *pParent, const SfxItemSet &rCoreSet)=0
sal_uInt16 nPos
sal_uInt16 GetGapBetweenPages() const
Definition: viewopt.hxx:430
void UnlockPaint(bool bVirDev=false)
Definition: viewsh.hxx:609
#define FN_GOTO_PAGE
Definition: cmdid.h:504
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)