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