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