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