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#include <config_fuzzers.h>
22
23#include <com/sun/star/util/SearchAlgorithms2.hpp>
24#include <o3tl/any.hxx>
25#include <vcl/graphicfilter.hxx>
26#include <com/sun/star/sdb/DatabaseContext.hpp>
27#include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
28#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
29#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
30#include <com/sun/star/ui/dialogs/ListboxControlActions.hpp>
31#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
32#include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
33#include <com/sun/star/linguistic2/XDictionary.hpp>
35#include <officecfg/Office/Common.hxx>
36#include <SwCapObjType.hxx>
37#include <SwStyleNameMapper.hxx>
38#include <docary.hxx>
39#include <hintids.hxx>
40#include <SwRewriter.hxx>
41#include <numrule.hxx>
42#include <swundo.hxx>
44#include <svl/urihelper.hxx>
45#include <sfx2/passwd.hxx>
46#include <sfx2/sfxdlg.hxx>
48#include <editeng/langitem.hxx>
51#include <svx/linkwarn.hxx>
52#include <sfx2/htmlmode.hxx>
53#include <vcl/svapp.hxx>
54#include <sfx2/app.hxx>
55#include <sfx2/request.hxx>
56#include <sfx2/bindings.hxx>
57#include <editeng/lrspitem.hxx>
60#include <editeng/unolingu.hxx>
61#include <vcl/weld.hxx>
62#include <editeng/tstpitem.hxx>
63#include <sfx2/event.hxx>
64#include <sfx2/docfile.hxx>
65#include <sfx2/docfilt.hxx>
66#include <sfx2/fcontnr.hxx>
67#include <editeng/sizeitem.hxx>
68#include <sfx2/dispatch.hxx>
69#include <svl/whiter.hxx>
70#include <svl/ptitem.hxx>
71#include <sfx2/viewfrm.hxx>
72#include <vcl/errinf.hxx>
73#include <tools/urlobj.hxx>
74#include <svx/svdview.hxx>
75#include <swtypes.hxx>
76#include <swwait.hxx>
77#include <redlndlg.hxx>
78#include <gotodlg.hxx>
79#include <view.hxx>
80#include <uivwimp.hxx>
81#include <docsh.hxx>
82#include <doc.hxx>
83#include <printdata.hxx>
87#include <IDocumentUndoRedo.hxx>
92#include <wrtsh.hxx>
93#include <viewopt.hxx>
94#include <basesh.hxx>
95#include <swmodule.hxx>
96#include <uitool.hxx>
97#include <shellio.hxx>
98#include <fmtinfmt.hxx>
99#include <mdiexp.hxx>
100#include <drawbase.hxx>
101#include <frmatr.hxx>
102#include <frmmgr.hxx>
103#include <pagedesc.hxx>
104#include <section.hxx>
105#include <tox.hxx>
106#include <edtwin.hxx>
107#include <wview.hxx>
108#include <cmdid.h>
109#include <sfx2/strings.hrc>
110#include <sfx2/sfxresid.hxx>
111#include <strings.hrc>
112#include <swerror.h>
113#include <globals.hrc>
114#include <fmtclds.hxx>
115#include <sfx2/templatedlg.hxx>
116#include <dbconfig.hxx>
117#include <dbmgr.hxx>
118#include <reffld.hxx>
119#include <comphelper/lok.hxx>
120#include <comphelper/string.hxx>
122
123#include <PostItMgr.hxx>
124
126#include <LibreOfficeKit/LibreOfficeKitEnums.h>
127
128#include <svx/svxdlg.hxx>
129#include <swabstdlg.hxx>
130#include <fmthdft.hxx>
131#include <unotextrange.hxx>
132#include <docstat.hxx>
133#include <wordcountdialog.hxx>
136
139#include <vcl/settings.hxx>
140#include <i18nutil/searchopt.hxx>
141#include <osl/diagnose.h>
142#include <paratr.hxx>
143#include <rootfrm.hxx>
144#include <frameformats.hxx>
145
146#include <viewimp.hxx>
147#include <pagefrm.hxx>
148
149#include <memory>
150#include <string_view>
151#include <svl/slstitm.hxx>
152
154
155#include <ndtxt.hxx>
156
157#include <svx/srchdlg.hxx>
158#include <o3tl/string_view.hxx>
159
160const char sStatusDelim[] = " : ";
161
162using namespace sfx2;
163using namespace ::com::sun::star;
164using namespace ::com::sun::star::i18n;
165using namespace ::com::sun::star::util;
166using namespace ::com::sun::star::uno;
167using namespace ::com::sun::star::lang;
168using namespace ::com::sun::star::scanner;
169using namespace ::com::sun::star::beans;
170using namespace ::com::sun::star::container;
171using namespace ::com::sun::star::sdb;
172using namespace ::com::sun::star::ui::dialogs;
173
174namespace {
175
176class SwNumberInputDlg : public SfxDialogController
177{
178private:
179 std::unique_ptr<weld::Label> m_xLabel1;
180 std::unique_ptr<weld::SpinButton> m_xSpinButton;
181 std::unique_ptr<weld::Label> m_xLabel2;
182 std::unique_ptr<weld::Button> m_xOKButton;
183
184 DECL_LINK(InputModifiedHdl, weld::Entry&, void);
185public:
186 SwNumberInputDlg(weld::Window* pParent, const OUString& rTitle,
187 const OUString& rLabel1, const sal_Int64 nValue, const sal_Int64 min, const sal_Int64 max,
188 OUString rLabel2 = OUString())
189 : SfxDialogController(pParent, "modules/swriter/ui/numberinput.ui", "NumberInputDialog")
190 , m_xLabel1(m_xBuilder->weld_label("label1"))
191 , m_xSpinButton(m_xBuilder->weld_spin_button("spinbutton"))
192 , m_xLabel2(m_xBuilder->weld_label("label2"))
193 , m_xOKButton(m_xBuilder->weld_button("ok"))
194 {
195 m_xDialog->set_title(rTitle);
196 m_xLabel1->set_label(rLabel1);
197 m_xSpinButton->set_value(nValue);
198 m_xSpinButton->set_range(min, max);
199 m_xSpinButton->set_position(-1);
200 m_xSpinButton->select_region(0, -1);
201 m_xSpinButton->connect_changed(LINK(this, SwNumberInputDlg, InputModifiedHdl));
202 if (!rLabel2.isEmpty())
203 {
204 m_xLabel2->set_label(rLabel2);
205 m_xLabel2->show();
206 }
207 }
208
209 auto GetNumber()
210 {
211 return m_xSpinButton->get_text().toInt32();
212 }
213};
214
215IMPL_LINK_NOARG(SwNumberInputDlg, InputModifiedHdl, weld::Entry&, void)
216{
217 m_xOKButton->set_sensitive(!m_xSpinButton->get_text().isEmpty());
218 if (!m_xOKButton->get_sensitive())
219 return;
220
221 auto nValue = m_xSpinButton->get_text().toInt32();
222 if (nValue <= m_xSpinButton->get_min())
223 m_xSpinButton->set_value(m_xSpinButton->get_min());
224 else if (nValue > m_xSpinButton->get_max())
225 m_xSpinButton->set_value(m_xSpinButton->get_max());
226 else
227 m_xSpinButton->set_value(nValue);
228
229 m_xSpinButton->set_position(-1);
230}
231
232}
233
234static void lcl_SetAllTextToDefaultLanguage( SwWrtShell &rWrtSh, sal_uInt16 nWhichId )
235{
236 if (!(nWhichId == RES_CHRATR_LANGUAGE ||
237 nWhichId == RES_CHRATR_CJK_LANGUAGE ||
238 nWhichId == RES_CHRATR_CTL_LANGUAGE))
239 return;
240
241 rWrtSh.StartAction();
242 rWrtSh.LockView( true );
243 rWrtSh.Push();
244
245 // prepare to apply new language to all text in document
246 rWrtSh.SelAll();
247 rWrtSh.ExtendedSelectAll();
248
249 // set language attribute to default for all text
250 rWrtSh.ResetAttr({ nWhichId });
251
253 rWrtSh.LockView( false );
254 rWrtSh.EndAction();
255
256}
257
267OUString SwView::GetPageStr(sal_uInt16 nPhyNum, sal_uInt16 nVirtNum, const OUString& rPgStr)
268{
269 // Show user-defined page number in brackets if any.
270 OUString extra;
271 if (!rPgStr.isEmpty() && std::u16string_view(OUString::number(nPhyNum)) != rPgStr)
272 extra = rPgStr;
273 else if (nPhyNum != nVirtNum)
274 extra = OUString::number(nVirtNum);
275
276 sal_uInt16 nPageCount = GetWrtShell().GetPageCnt();
277 sal_uInt16 nPrintedPhyNum = nPhyNum;
278 sal_uInt16 nPrintedPageCount = nPageCount;
279 if (!GetWrtShell().getIDocumentDeviceAccess().getPrintData().IsPrintEmptyPages())
280 SwDoc::CalculateNonBlankPages(*m_pWrtShell->GetLayout(), nPrintedPageCount, nPrintedPhyNum);
281 // Show printed page numbers only, when they are different
282 OUString aStr( nPageCount != nPrintedPageCount
283 ? SwResId(STR_PAGE_COUNT_PRINTED)
284 : (extra.isEmpty() ? SwResId(STR_PAGE_COUNT) : SwResId(STR_PAGE_COUNT_CUSTOM)));
285 aStr = aStr.replaceFirst("%1", OUString::number(nPhyNum));
286 aStr = aStr.replaceFirst("%2", OUString::number(nPageCount));
287 if (nPageCount != nPrintedPageCount)
288 {
289 aStr = aStr.replaceFirst("%3", OUString::number(nPrintedPhyNum));
290 aStr = aStr.replaceFirst("%4", OUString::number(nPrintedPageCount));
291 }
292 else
293 aStr = aStr.replaceFirst("%3", extra);
294
295 return aStr;
296}
297
298ErrCode SwView::InsertGraphic( const OUString &rPath, const OUString &rFilter,
299 bool bLink, GraphicFilter *pFilter )
300{
301 SwWait aWait( *GetDocShell(), true );
302
303 Graphic aGraphic;
304 ErrCode aResult = ERRCODE_NONE;
305 if( !pFilter )
306 {
308 }
309 aResult = GraphicFilter::LoadGraphic( rPath, rFilter, aGraphic, pFilter );
310
311 if( ERRCODE_NONE == aResult )
312 {
313 GraphicNativeMetadata aMetadata;
314 if ( aMetadata.read(aGraphic) )
315 {
316 const Degree10 aRotation = aMetadata.getRotation();
317 if (aRotation)
318 {
319 GraphicNativeTransform aTransform( aGraphic );
320 aTransform.rotate( aRotation );
321 }
322 }
323
324 SwFlyFrameAttrMgr aFrameManager( true, GetWrtShellPtr(), Frmmgr_Type::GRF, nullptr );
325 SwWrtShell& rShell = GetWrtShell();
326
327 // #i123922# determine if we really want to insert or replace the graphic at a selected object
328 const bool bReplaceMode(rShell.HasSelection() && SelectionType::Frame == rShell.GetSelectionType());
329
330 if(bReplaceMode)
331 {
332 // #i123922# Do same as in D&D, ReRead graphic and all is done
333 rShell.ReRead(
334 bLink ? rPath : OUString(),
335 bLink ? rFilter : OUString(),
336 &aGraphic);
337 }
338 else
339 {
340 rShell.StartAction();
341 if( bLink )
342 {
343 SwDocShell* pDocSh = GetDocShell();
344 INetURLObject aTemp(
345 pDocSh->HasName() ?
347 OUString());
348
349 OUString sURL = URIHelper::SmartRel2Abs(
350 aTemp, rPath, URIHelper::GetMaybeFileHdl() );
351 aGraphic.setOriginURL(sURL);
352 rShell.InsertGraphic( sURL, rFilter, aGraphic, &aFrameManager );
353 }
354 else
355 {
356 rShell.InsertGraphic( OUString(), OUString(), aGraphic, &aFrameManager );
357 }
358
359 // it is too late after "EndAction" because the Shell can already be destroyed.
360 rShell.EndAction();
361 }
362 }
363 return aResult;
364}
365
367{
368 bool bReturn = false;
369 SwDocShell* pDocShell = GetDocShell();
370 SwDoc* pDoc = pDocShell->GetDoc();
371
372 OUString sGraphicFormat = SwResId(STR_POOLFRM_GRAPHIC);
373
374// No file pickers in a non-desktop (mobile app) build.
375
376#if HAVE_FEATURE_DESKTOP
377 // when in HTML mode insert only as a link
378 const sal_uInt16 nHtmlMode = ::GetHtmlMode(pDocShell);
379 std::unique_ptr<FileDialogHelper> pFileDlg(new FileDialogHelper(
380 ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE,
381 FileDialogFlags::Graphic, GetFrameWeld()));
382 pFileDlg->SetTitle(SwResId(STR_INSERT_GRAPHIC ));
383 pFileDlg->SetContext( FileDialogHelper::WriterInsertImage );
384
385 uno::Reference < XFilePicker3 > xFP = pFileDlg->GetFilePicker();
386 uno::Reference < XFilePickerControlAccess > xCtrlAcc(xFP, UNO_QUERY);
387 if(nHtmlMode & HTMLMODE_ON)
388 {
389 xCtrlAcc->setValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, Any(true));
390 xCtrlAcc->enableControl( ExtendedFilePickerElementIds::CHECKBOX_LINK, false);
391 }
392
393 std::vector<OUString> aFormats;
394 const size_t nArrLen = pDoc->GetFrameFormats()->size();
395 for( size_t i = 0; i < nArrLen; ++i )
396 {
397 const SwFrameFormat* pFormat = (*pDoc->GetFrameFormats())[ i ];
398 if(pFormat->IsDefault() || pFormat->IsAuto())
399 continue;
400 aFormats.push_back(pFormat->GetName());
401 }
402
403 // pool formats
404
405 const std::vector<OUString>& rFramePoolArr(
407 for(const auto & i : rFramePoolArr)
408 {
409 aFormats.push_back(i);
410 }
411
412 std::sort(aFormats.begin(), aFormats.end());
413 aFormats.erase(std::unique(aFormats.begin(), aFormats.end()), aFormats.end());
414
415 Sequence<OUString> aListBoxEntries(aFormats.size());
416 OUString* pEntries = aListBoxEntries.getArray();
417 sal_Int16 nSelect = 0;
418 for( size_t i = 0; i < aFormats.size(); ++i )
419 {
420 pEntries[i] = aFormats[i];
421 if(pEntries[i] == sGraphicFormat)
422 nSelect = i;
423 }
424 try
425 {
426 Any aTemplates(&aListBoxEntries, cppu::UnoType<decltype(aListBoxEntries)>::get());
427
428 xCtrlAcc->setValue( ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE,
429 ListboxControlActions::ADD_ITEMS , aTemplates );
430
431 Any aSelectPos(&nSelect, cppu::UnoType<decltype(nSelect)>::get());
432 xCtrlAcc->setValue( ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE,
433 ListboxControlActions::SET_SELECT_ITEM, aSelectPos );
434 }
435 catch (const Exception&)
436 {
437 OSL_FAIL("control access failed");
438 }
439#endif
440
441 const SfxStringItem* pName = rReq.GetArg<SfxStringItem>(SID_INSERT_GRAPHIC);
442 bool bShowError = !pName;
443 if( pName
444#if HAVE_FEATURE_DESKTOP
445 || (!Application::IsHeadlessModeEnabled() && ERRCODE_NONE == pFileDlg->Execute())
446#endif
447 )
448 {
449
450 OUString aFileName, aFilterName;
451 if ( pName )
452 {
453 aFileName = pName->GetValue();
454 const SfxStringItem* pFilter = rReq.GetArg<SfxStringItem>(FN_PARAM_FILTER);
455 if ( pFilter )
456 aFilterName = pFilter->GetValue();
457 }
458#if HAVE_FEATURE_DESKTOP
459 else
460 {
461 aFileName = pFileDlg->GetPath();
462 aFilterName = pFileDlg->GetCurrentFilter();
463 rReq.AppendItem( SfxStringItem( SID_INSERT_GRAPHIC, aFileName ) );
464 rReq.AppendItem( SfxStringItem( FN_PARAM_FILTER, aFilterName ) );
465
466 bool bAsLink = false;
467 if(nHtmlMode & HTMLMODE_ON)
468 bAsLink = true;
469 else
470 {
471 try
472 {
473 Any aVal = xCtrlAcc->getValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0);
474 OSL_ENSURE(aVal.hasValue(), "Value CBX_INSERT_AS_LINK not found");
475 bAsLink = !aVal.hasValue() || *o3tl::doAccess<bool>(aVal);
476 Any aTemplateValue = xCtrlAcc->getValue(
477 ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE,
478 ListboxControlActions::GET_SELECTED_ITEM );
479 OUString sTmpl;
480 aTemplateValue >>= sTmpl;
481 rReq.AppendItem( SfxStringItem( FN_PARAM_2, sTmpl) );
482 }
483 catch (const Exception&)
484 {
485 OSL_FAIL("control access failed");
486 }
487 }
488 rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bAsLink ) );
489 }
490 const SfxBoolItem* pAsLink = rReq.GetArg<SfxBoolItem>(FN_PARAM_1);
491 const SfxStringItem* pStyle = rReq.GetArg<SfxStringItem>(FN_PARAM_2);
492#endif
493
494 bool bAsLink = false;
495
496#if HAVE_FEATURE_DESKTOP
497 if( nHtmlMode & HTMLMODE_ON )
498 bAsLink = true;
499 else
500 {
501 if ( rReq.GetArgs() )
502 {
503 if ( pAsLink )
504 bAsLink = pAsLink->GetValue();
505 if ( pStyle && !pStyle->GetValue().isEmpty() )
506 sGraphicFormat = pStyle->GetValue();
507 }
508 else
509 {
510 Any aVal = xCtrlAcc->getValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0);
511 OSL_ENSURE(aVal.hasValue(), "Value CBX_INSERT_AS_LINK not found");
512 bAsLink = !aVal.hasValue() || *o3tl::doAccess<bool>(aVal);
513 Any aTemplateValue = xCtrlAcc->getValue(
514 ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE,
515 ListboxControlActions::GET_SELECTED_ITEM );
516 OUString sTmpl;
517 aTemplateValue >>= sTmpl;
518 if( !sTmpl.isEmpty() )
519 sGraphicFormat = sTmpl;
520 rReq.AppendItem( SfxStringItem( FN_PARAM_2, sGraphicFormat ) );
521 rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bAsLink ) );
522 }
523
524 // really store as link only?
526 {
527 SvxLinkWarningDialog aWarnDlg(GetFrameWeld(), pFileDlg->GetPath());
528 if (aWarnDlg.run() != RET_OK)
529 bAsLink=false; // don't store as link
530 }
531 }
532#endif
533
534 SwWrtShell& rSh = GetWrtShell();
535 rSh.LockPaint();
536 rSh.StartAction();
537
538 SwRewriter aRewriter;
539 aRewriter.AddRule(UndoArg1, SwResId(STR_GRAPHIC_DEFNAME));
540
541 // #i123922# determine if we really want to insert or replace the graphic at a selected object
542 const bool bReplaceMode(rSh.HasSelection() && SelectionType::Frame == rSh.GetSelectionType());
543
544 rSh.StartUndo(SwUndoId::INSERT, &aRewriter);
545
546 ErrCode nError = InsertGraphic( aFileName, aFilterName, bAsLink, &GraphicFilter::GetGraphicFilter() );
547
548 // format not equal to current filter (with autodetection)
549 if( nError == ERRCODE_GRFILTER_FORMATERROR )
550 nError = InsertGraphic( aFileName, OUString(), bAsLink, &GraphicFilter::GetGraphicFilter() );
551
552 // #i123922# no new FrameFormat for replace mode, only when new object was created,
553 // else this would reset the current setting for the frame holding the graphic
554 if ( !bReplaceMode && rSh.IsFrameSelected() )
555 {
556 SwFrameFormat* pFormat = pDoc->FindFrameFormatByName( sGraphicFormat );
557 if(!pFormat)
558 pFormat = pDoc->MakeFrameFormat(sGraphicFormat,
559 pDocShell->GetDoc()->GetDfltFrameFormat(),
560 true, false);
561 rSh.SetFrameFormat( pFormat );
562 }
563
564 TranslateId pResId;
565 if( nError == ERRCODE_GRFILTER_OPENERROR )
566 pResId = STR_GRFILTER_OPENERROR;
567 else if( nError == ERRCODE_GRFILTER_IOERROR )
568 pResId = STR_GRFILTER_IOERROR;
569 else if( nError ==ERRCODE_GRFILTER_FORMATERROR )
570 pResId = STR_GRFILTER_FORMATERROR;
571 else if( nError ==ERRCODE_GRFILTER_VERSIONERROR )
572 pResId = STR_GRFILTER_VERSIONERROR;
573 else if( nError ==ERRCODE_GRFILTER_FILTERERROR )
574 pResId = STR_GRFILTER_FILTERERROR;
575 else if( nError ==ERRCODE_GRFILTER_TOOBIG )
576 pResId = STR_GRFILTER_TOOBIG;
577
578 rSh.EndAction();
579 rSh.UnlockPaint();
580 if (pResId)
581 {
582 if( bShowError )
583 {
584 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(),
585 VclMessageType::Info, VclButtonsType::Ok,
586 SwResId(pResId)));
587 xInfoBox->run();
588 }
589 rReq.Ignore();
590 }
591 else
592 {
593 // set the specific graphic attributes to the graphic
594 bReturn = true;
596 rReq.Done();
597 }
598
599 rSh.EndUndo(); // due to possible change of Shell
600 }
601
602 return bReturn;
603}
604
606{
607 const sal_uInt16 nSlot = rReq.GetSlot();
608 const SfxItemSet* pArgs = rReq.GetArgs();
609 const SfxPoolItem* pItem;
610 bool bIgnore = false;
611 switch( nSlot )
612 {
613 case SID_CREATE_SW_DRAWVIEW:
614 m_pWrtShell->getIDocumentDrawModelAccess().GetOrCreateDrawModel();
615 break;
616
618 {
622 aContext.maEndDialogFn = [](sal_Int32){};
623 pDlg->StartExecuteAsync(aContext);
624 break;
625 }
626 case FN_EDIT_LINK_DLG:
627 EditLinkDlg();
628 break;
629 case SID_REFRESH_VIEW:
631 m_pWrtShell->Reformat();
632 break;
633 case FN_PAGEUP:
634 case FN_PAGEUP_SEL:
635 case FN_PAGEDOWN:
636 case FN_PAGEDOWN_SEL:
637 {
639 SwEditWin& rTmpWin = GetEditWin();
640 if ( FN_PAGEUP == nSlot || FN_PAGEUP_SEL == nSlot )
641 PageUpCursor(FN_PAGEUP_SEL == nSlot);
642 else
643 PageDownCursor(FN_PAGEDOWN_SEL == nSlot);
644
645 rReq.SetReturnValue(SfxBoolItem(nSlot,
646 aVis != GetVisArea()));
647 //#i42732# - notify the edit window that from now on we do not use the input language
648 rTmpWin.SetUseInputLanguage( false );
649 }
650 break;
651 case SID_ZOOM_IN:
652 case SID_ZOOM_OUT:
653 {
654 sal_uInt16 nFact = m_pWrtShell->GetViewOptions()->GetZoom();
655 if (SID_ZOOM_IN == nSlot)
656 nFact = basegfx::zoomtools::zoomIn(nFact);
657 else
658 nFact = basegfx::zoomtools::zoomOut(nFact);
659 SetZoom(SvxZoomType::PERCENT, nFact);
660 }
661 break;
662 case FN_TO_PREV_PAGE:
663 case FN_TO_NEXT_PAGE:
664 {
665 sal_uInt16 nPage = 0;
666 if (m_pWrtShell->IsCursorVisible())
667 nPage = m_pWrtShell->GetCursor()->GetPageNum();
668 else
669 {
670 SwFrame* pPageFrame = m_pWrtShell->Imp()->GetFirstVisPage(m_pWrtShell->GetOut());
671 if (pPageFrame)
672 nPage = pPageFrame->GetPhyPageNum();
673 }
674 if (nPage != 0)
675 {
676 sal_uInt16 nOldPage(nPage);
677 if (FN_TO_PREV_PAGE == nSlot && nPage > 1)
678 nPage--;
679 else if (FN_TO_NEXT_PAGE == nSlot && nPage < m_pWrtShell->GetPageCount())
680 nPage++;
681 if (nPage != nOldPage)
682 {
683 m_pWrtShell->LockPaint();
684 if (IsDrawMode())
686 m_pWrtShell->EnterStdMode();
687 m_pWrtShell->GotoPage(nPage, true);
688 // set visible area (borrowed from SwView::PhyPageUp/Down)
689 const Point aPt(m_aVisArea.Left(), m_pWrtShell->GetPagePos(nPage).Y());
690 Point aAlPt(AlignToPixel(aPt));
691 if(aPt.Y() != aAlPt.Y())
692 aAlPt.AdjustY(3 * GetEditWin().PixelToLogic(Size(0, 1)).Height());
693 SetVisArea(aAlPt);
694 m_pWrtShell->UnlockPaint();
695 }
696 }
697 }
698 break;
700 {
701 if (m_pWrtShell->IsSelFrameMode())
702 break;
703 if (!m_pWrtShell->IsStdMode())
704 m_pWrtShell->EnterStdMode();
705 SwShellCursor *pCursor = m_pWrtShell->SwCursorShell::GetCursor_();
706 Point CurrMarkPt = pCursor->GetMkPos();
707 Point CurrPointPt = pCursor->GetPtPos();
708 sal_uInt16 nStep = m_aSelectCycle.nStep;
709 if (nStep && (CurrMarkPt != m_aSelectCycle.m_MarkPt || CurrPointPt != m_aSelectCycle.m_PointPt))
710 nStep = 0;
711 switch(nStep)
712 {
713 case 0:
714 m_aSelectCycle.m_pInitialCursor = CurrPointPt;
715 m_pWrtShell->SwCursorShell::ClearMark();
716 m_pWrtShell->SelWrd(&CurrPointPt);
717 break;
718 case 1:
719 m_pWrtShell->SelSentence(&CurrPointPt);
720 break;
721 case 2:
722 m_pWrtShell->SelPara(&CurrPointPt);
723 break;
724 case 3:
725 m_pWrtShell->SwCursorShell::ClearMark();
726 m_pWrtShell->SwCursorShell::SetCursor(m_aSelectCycle.m_pInitialCursor);
727 break;
728 }
729 nStep++;
730 nStep %= 4;
731 pCursor = m_pWrtShell->SwCursorShell::GetCursor_();
732 m_aSelectCycle.m_MarkPt = pCursor->GetMkPos();
733 m_aSelectCycle.m_PointPt = pCursor->GetPtPos();
734 m_aSelectCycle.nStep = nStep;
735 }
736 break;
737 case FN_REDLINE_ON:
738 {
739 if( pArgs &&
740 SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem ))
741 {
742 IDocumentRedlineAccess& rIDRA = m_pWrtShell->getIDocumentRedlineAccess();
743 Sequence <sal_Int8> aPasswd = rIDRA.GetRedlinePassword();
744 if( aPasswd.hasElements() )
745 {
746 OSL_ENSURE( !static_cast<const SfxBoolItem*>(pItem)->GetValue(), "SwView::Execute(): password set and redlining off doesn't match!" );
747
748 // xmlsec05: new password dialog
749 SfxPasswordDialog aPasswdDlg(GetFrameWeld());
750 aPasswdDlg.SetMinLen(1);
751 //#i69751# the result of Execute() can be ignored
752 (void)aPasswdDlg.run();
753 OUString sNewPasswd(aPasswdDlg.GetPassword());
754
755 // password verification
756 bool bPasswordOk = false;
757 if (aPasswd.getLength() == 1 && aPasswd[0] == 1)
758 {
759 // dummy RedlinePassword from OOXML import: get real password info
760 // from the grab-bag to verify the password
761 const css::uno::Sequence< css::beans::PropertyValue > aDocumentProtection =
762 static_cast<SfxObjectShell*>(GetDocShell())->
763 GetDocumentProtectionFromGrabBag();
764
765 bPasswordOk =
766 // password is ok, if there is no DocumentProtection in the GrabBag,
767 // i.e. the dummy RedlinePassword imported from an OpenDocument file
768 !aDocumentProtection.hasElements() ||
769 // verify password with the password info imported from OOXML
772 }
773 else
774 {
775 // the simplified RedlinePassword
776 Sequence <sal_Int8> aNewPasswd = rIDRA.GetRedlinePassword();
777 SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd );
778 bPasswordOk = SvPasswordHelper::CompareHashPassword(aPasswd, sNewPasswd);
779 }
780
781 if (bPasswordOk)
782 rIDRA.SetRedlinePassword(Sequence <sal_Int8> ());
783 else
784 { // xmlsec05: message box for wrong password
785 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(nullptr,
786 VclMessageType::Info, VclButtonsType::Ok,
787 SfxResId(RID_SVXSTR_INCORRECT_PASSWORD)));
788 xInfoBox->run();
789 break;
790 }
791 }
792
793 SwDocShell* pDocShell = GetDocShell();
794 pDocShell->SetChangeRecording( static_cast<const SfxBoolItem*>(pItem)->GetValue(), /*bLockAllViews=*/true );
795
796 // Notify all view shells of this document, as the track changes mode is document-global.
797 for (SfxViewFrame* pViewFrame = SfxViewFrame::GetFirst(pDocShell); pViewFrame; pViewFrame = SfxViewFrame::GetNext(*pViewFrame, pDocShell))
798 {
799 pViewFrame->GetBindings().Invalidate(FN_REDLINE_ON);
800 pViewFrame->GetBindings().Update(FN_REDLINE_ON);
801 }
802 }
803 }
804 break;
805 case FN_REDLINE_PROTECT :
806 {
807 IDocumentRedlineAccess& rIDRA = m_pWrtShell->getIDocumentRedlineAccess();
808 Sequence <sal_Int8> aPasswd = rIDRA.GetRedlinePassword();
809 if( pArgs && SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem )
810 && static_cast<const SfxBoolItem*>(pItem)->GetValue() == aPasswd.hasElements() )
811 break;
812
813 // xmlsec05: new password dialog
814 // message box for wrong password
815 SfxPasswordDialog aPasswdDlg(GetFrameWeld());
816 aPasswdDlg.SetMinLen(1);
817 if (!aPasswd.hasElements())
818 aPasswdDlg.ShowExtras(SfxShowExtras::CONFIRM);
819 if (aPasswdDlg.run())
820 {
822 OUString sNewPasswd(aPasswdDlg.GetPassword());
823 Sequence <sal_Int8> aNewPasswd =
824 rIDRA.GetRedlinePassword();
825 SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd );
826 if(!aPasswd.hasElements())
827 {
828 rIDRA.SetRedlinePassword(aNewPasswd);
829 }
830 else if(SvPasswordHelper::CompareHashPassword(aPasswd, sNewPasswd))
831 {
832 rIDRA.SetRedlinePassword(Sequence <sal_Int8> ());
833 nOn = RedlineFlags::NONE;
834 }
835 const RedlineFlags nMode = rIDRA.GetRedlineFlags();
836 m_pWrtShell->SetRedlineFlagsAndCheckInsMode( (nMode & ~RedlineFlags::On) | nOn);
837 rReq.AppendItem( SfxBoolItem( FN_REDLINE_PROTECT, !(nMode&RedlineFlags::On) ) );
838 }
839 else
840 bIgnore = true;
841 }
842 break;
843 case FN_REDLINE_SHOW:
844
845 if( pArgs &&
846 SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem))
847 {
848 // tdf#125754 avoid recursive layout
849 // because all views share the layout, have to use AllAction
850 const bool bShow = static_cast<const SfxBoolItem*>(pItem)->GetValue();
851 m_pWrtShell->StartAllAction();
852 // always show redline insertions in Hide Changes mode
853 if ( m_pWrtShell->GetViewOptions()->IsShowChangesInMargin() &&
854 m_pWrtShell->GetViewOptions()->IsShowChangesInMargin2() )
855 {
856 GetDocShell()->GetDoc()->GetDocumentRedlineManager().HideAll(/*bDeletion=*/!bShow);
857 }
858 m_pWrtShell->GetLayout()->SetHideRedlines( !bShow );
859 m_pWrtShell->EndAllAction();
860 if (m_pWrtShell->IsRedlineOn())
861 m_pWrtShell->SetInsMode();
862 }
863 break;
867 break;
872 {
873 SwDoc *pDoc = m_pWrtShell->GetDoc();
874 SwPaM *pCursor = m_pWrtShell->GetCursor();
875 const SwRedlineTable& rRedlineTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
877 if (pArgs && pArgs->GetItemState(nSlot, false, &pItem) == SfxItemState::SET)
878 {
879 const sal_Int64 nChangeId = static_cast<const SfxUInt32Item*>(pItem)->GetValue();
880 for (SwRedlineTable::size_type i = 0; i < rRedlineTable.size(); ++i)
881 {
882 if (nChangeId == rRedlineTable[i]->GetId())
883 nRedline = i;
884 }
885 }
886
887 if( pCursor->HasMark() && nRedline == SwRedlineTable::npos)
888 {
889 bool bAccept = FN_REDLINE_ACCEPT_DIRECT == nSlot || FN_REDLINE_ACCEPT_TONEXT == nSlot;
891 SwWrtShell& rSh = GetWrtShell();
892 SwRewriter aRewriter;
893 bool bTableSelection = rSh.IsTableMode();
894 if ( bTableSelection )
895 {
896 aRewriter.AddRule(UndoArg1, SwResId( STR_REDLINE_TABLECHG ));
897 rSh.StartUndo( eUndoId, &aRewriter);
898 }
899 if ( bAccept )
900 m_pWrtShell->AcceptRedlinesInSelection();
901 else
902 m_pWrtShell->RejectRedlinesInSelection();
903 if ( bTableSelection )
904 rSh.EndUndo( eUndoId, &aRewriter);
905 }
906 else
907 {
908 // We check for a redline at the start of the selection/cursor, not the point.
909 // This ensures we work properly with FN_REDLINE_NEXT_CHANGE, which leaves the
910 // point at the *end* of the redline and the mark at the start (so GetRedline
911 // would return NULL if called on the point)
912 const SwRangeRedline* pRedline = nullptr;
913 if (nRedline != SwRedlineTable::npos)
914 {
915 // A redline was explicitly requested by specifying an
916 // index, don't guess based on the cursor position.
917
918 if (nRedline < rRedlineTable.size())
919 pRedline = rRedlineTable[nRedline];
920 }
921 else
922 pRedline = pDoc->getIDocumentRedlineAccess().GetRedline(*pCursor->Start(), &nRedline);
923
924 // accept or reject table row deletion or insertion
925 bool bTableChange = false;
926 if ( !pRedline && m_pWrtShell->IsCursorInTable() )
927 {
928 nRedline = 0;
929 auto pTabLine = pCursor->Start()->GetNode().GetTableBox()->GetUpper();
930
931 if ( RedlineType::None != pTabLine->GetRedlineType() )
932 {
933 nRedline = pTabLine->UpdateTextChangesOnly(nRedline);
934
935 if ( nRedline != SwRedlineTable::npos )
936 {
937 bTableChange = true;
938
939 SwWrtShell& rSh = GetWrtShell();
940 SwRewriter aRewriter;
941
942 aRewriter.AddRule(UndoArg1, SwResId(
943 rRedlineTable[nRedline]->GetType() == RedlineType::Delete
944 ? STR_REDLINE_TABLE_ROW_DELETE
945 : STR_REDLINE_TABLE_ROW_INSERT ));
946
947 SwUndoId eUndoId =
951
952 rSh.StartUndo( eUndoId, &aRewriter);
953 while ( nRedline != SwRedlineTable::npos && nRedline < rRedlineTable.size() )
954 {
955 pRedline = rRedlineTable[nRedline];
956
957 // until next redline is not in the same row
958 SwTableBox* pTableBox = pRedline->Start()->GetNode().GetTableBox();
959 if ( !pTableBox || pTableBox->GetUpper() != pTabLine )
960 break;
961
962 if (FN_REDLINE_ACCEPT_DIRECT == nSlot || FN_REDLINE_ACCEPT_TONEXT == nSlot)
963 m_pWrtShell->AcceptRedline(nRedline);
964 else
965 m_pWrtShell->RejectRedline(nRedline);
966 }
967 rSh.EndUndo( eUndoId, &aRewriter);
968 }
969 }
970 }
971 else
972 {
973 assert(pRedline != nullptr);
974 }
975
976 if (pRedline && !bTableChange)
977 {
978 if (FN_REDLINE_ACCEPT_DIRECT == nSlot || FN_REDLINE_ACCEPT_TONEXT == nSlot)
979 m_pWrtShell->AcceptRedline(nRedline);
980 else
981 m_pWrtShell->RejectRedline(nRedline);
982 }
983 }
984 if (FN_REDLINE_ACCEPT_TONEXT == nSlot || FN_REDLINE_REJECT_TONEXT == nSlot)
985 {
986 // Go to next change after accepting or rejecting one (tdf#101977)
987 GetViewFrame()->GetDispatcher()->Execute(FN_REDLINE_NEXT_CHANGE, SfxCallMode::ASYNCHRON);
988 }
989 }
990 break;
991
993 {
994 // If a parameter is provided, try going to the nth change, not to
995 // the next one.
996 SwDoc* pDoc = m_pWrtShell->GetDoc();
997 const SwRedlineTable& rRedlineTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
999 if (pArgs && pArgs->GetItemState(nSlot, false, &pItem) == SfxItemState::SET)
1000 {
1001 const sal_uInt32 nChangeId = static_cast<const SfxUInt32Item*>(pItem)->GetValue();
1002 for (SwRedlineTable::size_type i = 0; i < rRedlineTable.size(); ++i)
1003 {
1004 if (nChangeId == rRedlineTable[i]->GetId())
1005 nRedline = i;
1006 }
1007 }
1008
1009 const SwRangeRedline *pNext = nullptr;
1010 if (nRedline < rRedlineTable.size())
1011 pNext = m_pWrtShell->GotoRedline(nRedline, true);
1012 else
1013 pNext = m_pWrtShell->SelNextRedline();
1014
1015 if (pNext)
1016 {
1018 {
1019 OString aPayload(".uno:CurrentTrackedChangeId=");
1020 sal_uInt32 nRedlineId = pNext->GetId();
1021 aPayload += OString::number(nRedlineId);
1022 libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aPayload.getStr());
1023 }
1024
1025 m_pWrtShell->SetInSelect();
1026 }
1027
1028 }
1029 break;
1030
1032 {
1033 const SwRangeRedline *pPrev = m_pWrtShell->SelPrevRedline();
1034
1035 if (pPrev)
1036 {
1038 {
1039 OString aPayload(".uno:CurrentTrackedChangeId=");
1040 sal_uInt32 nRedlineId = pPrev->GetId();
1041 aPayload += OString::number(nRedlineId);
1042 libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aPayload.getStr());
1043 }
1044
1045 m_pWrtShell->SetInSelect();
1046 }
1047 }
1048 break;
1049
1050 case SID_DOCUMENT_COMPARE:
1051 case SID_DOCUMENT_MERGE:
1052 {
1053 OUString sFileName, sFilterName;
1054 sal_Int16 nVersion = 0;
1055 bool bHasFileName = false;
1056 m_pViewImpl->SetParam( 0 );
1057 bool bNoAcceptDialog = false;
1058
1059 if( pArgs )
1060 {
1061 if( const SfxStringItem* pFileItem = pArgs->GetItemIfSet( SID_FILE_NAME, false ))
1062 sFileName = pFileItem->GetValue();
1063 bHasFileName = !sFileName.isEmpty();
1064
1065 if( const SfxStringItem* pFilterNameItem = pArgs->GetItemIfSet( SID_FILTER_NAME, false ))
1066 sFilterName = pFilterNameItem->GetValue();
1067
1068 if( const SfxInt16Item* pVersionItem = pArgs->GetItemIfSet( SID_VERSION, false ))
1069 {
1070 nVersion = pVersionItem->GetValue();
1071 m_pViewImpl->SetParam( nVersion );
1072 }
1073 if( const SfxBoolItem* pDialogItem = pArgs->GetItemIfSet( SID_NO_ACCEPT_DIALOG, false ))
1074 {
1075 bNoAcceptDialog = pDialogItem->GetValue();
1076 }
1077 }
1078
1079 m_pViewImpl->InitRequest( rReq );
1080 tools::Long nFound = InsertDoc( nSlot, sFileName, sFilterName, nVersion );
1081
1082 if ( bHasFileName )
1083 {
1084 rReq.SetReturnValue( SfxInt32Item( nSlot, nFound ));
1085
1086 if (nFound > 0 && !bNoAcceptDialog) // show Redline browser
1087 {
1088 SfxViewFrame* pVFrame = GetViewFrame();
1090
1091 // re-initialize the Redline dialog
1092 const sal_uInt16 nId = SwRedlineAcceptChild::GetChildWindowId();
1093 SwRedlineAcceptChild *pRed = static_cast<SwRedlineAcceptChild*>(
1094 pVFrame->GetChildWindow(nId));
1095 if (pRed)
1096 pRed->ReInitDlg(GetDocShell());
1097 }
1098 }
1099 else
1100 bIgnore = true;
1101 }
1102 break;
1103 case FN_SYNC_LABELS:
1104 GetViewFrame()->ShowChildWindow(nSlot);
1105 break;
1106 case FN_ESCAPE:
1107 {
1108 if ( m_pWrtShell->HasDrawViewDrag() )
1109 {
1110 m_pWrtShell->BreakDrag();
1111 m_pWrtShell->EnterSelFrameMode();
1112 }
1113 else if ( m_pWrtShell->IsDrawCreate() )
1114 {
1116 AttrChangedNotify(nullptr); // shell change if needed
1117 }
1118 else if ( m_pWrtShell->HasSelection() || IsDrawMode() )
1119 {
1120 SdrView *pSdrView = m_pWrtShell->HasDrawView() ? m_pWrtShell->GetDrawView() : nullptr;
1121 if(pSdrView && pSdrView->AreObjectsMarked() &&
1122 pSdrView->GetHdlList().GetFocusHdl())
1123 {
1124 const_cast<SdrHdlList&>(pSdrView->GetHdlList()).ResetFocusHdl();
1125 }
1126 else
1127 {
1128 if(pSdrView)
1129 {
1131 Point aPt(LONG_MIN, LONG_MIN);
1132 //go out of the frame
1133 m_pWrtShell->SelectObj(aPt, SW_LEAVE_FRAME);
1134 SfxBindings& rBind = GetViewFrame()->GetBindings();
1135 rBind.Invalidate( SID_ATTR_SIZE );
1136 }
1137 m_pWrtShell->EnterStdMode();
1138 AttrChangedNotify(nullptr); // shell change if necessary
1139 }
1140 }
1141 else if ( GetEditWin().GetApplyTemplate() )
1142 {
1144 }
1145 else if( static_cast<SfxObjectShell*>(GetDocShell())->IsInPlaceActive() )
1146 {
1147 Escape();
1148 }
1149 else if ( GetEditWin().IsChainMode() )
1150 {
1151 GetEditWin().SetChainMode( false );
1152 }
1153 else if( m_pWrtShell->GetFlyFrameFormat() )
1154 {
1155 const SwFrameFormat* pFormat = m_pWrtShell->GetFlyFrameFormat();
1156 if(m_pWrtShell->GotoFly( pFormat->GetName(), FLYCNTTYPE_FRM ))
1157 {
1158 m_pWrtShell->HideCursor();
1159 m_pWrtShell->EnterSelFrameMode();
1160 }
1161 }
1162 else
1163 {
1164 SfxBoolItem aItem( SID_WIN_FULLSCREEN, false );
1165 GetViewFrame()->GetDispatcher()->ExecuteList(SID_WIN_FULLSCREEN,
1166 SfxCallMode::RECORD, { &aItem });
1167 bIgnore = true;
1168 }
1169 }
1170 break;
1171 case SID_ATTR_BORDER_INNER:
1172 case SID_ATTR_BORDER_OUTER:
1173 case SID_ATTR_BORDER_SHADOW:
1174 if(pArgs)
1175 m_pWrtShell->SetAttrSet(*pArgs);
1176 break;
1177
1178 case SID_ATTR_PAGE:
1179 case SID_ATTR_PAGE_SIZE:
1180 case SID_ATTR_PAGE_MAXSIZE:
1181 case SID_ATTR_PAGE_PAPERBIN:
1182 case SID_ATTR_PAGE_EXT1:
1183 case FN_PARAM_FTN_INFO:
1184 {
1185 if(pArgs)
1186 {
1187 const size_t nCurIdx = m_pWrtShell->GetCurPageDesc();
1188 SwPageDesc aPageDesc( m_pWrtShell->GetPageDesc( nCurIdx ) );
1189 ::ItemSetToPageDesc( *pArgs, aPageDesc );
1190 // change the descriptor of the core
1191 m_pWrtShell->ChgPageDesc( nCurIdx, aPageDesc );
1192 }
1193 }
1194 break;
1195 case FN_GOTO_PAGE:
1196 {
1198 if (aDlg.run() == RET_OK)
1199 GetWrtShell().GotoPage(aDlg.GetPageSelection(), true);
1200 }
1201 break;
1203 {
1205 FN_INSERT_MULTI_TOX, SfxCallMode::ASYNCHRON);
1206 }
1207 break;
1208 case FN_UPDATE_CUR_TOX:
1209 {
1210 const SwTOXBase* pBase = m_pWrtShell->GetCurTOX();
1211 if(pBase)
1212 {
1213 // tdf#106374: don't jump view on the update
1214 const bool bWasLocked = m_pWrtShell->IsViewLocked();
1215 m_pWrtShell->LockView(true);
1216 m_pWrtShell->StartAction();
1217 if(TOX_INDEX == pBase->GetType())
1218 m_pWrtShell->ApplyAutoMark();
1219 m_pWrtShell->UpdateTableOf( *pBase );
1220 m_pWrtShell->EndAction();
1221 if (!bWasLocked)
1222 m_pWrtShell->LockView(false);
1223 }
1224 }
1225 break;
1226 case FN_UPDATE_TOX:
1227 {
1228 m_pWrtShell->StartAction();
1229 m_pWrtShell->EnterStdMode();
1230 bool bOldCursorInReadOnly = m_pWrtShell->IsReadOnlyAvailable();
1231 m_pWrtShell->SetReadOnlyAvailable( true );
1232
1233 for( int i = 0; i < 2; ++i )
1234 {
1235 if( m_pWrtShell->GetTOXCount() == 1 )
1236 ++i;
1237
1238 while( m_pWrtShell->GotoPrevTOXBase() )
1239 ; // jump to the first "table of ..."
1240
1241 // if we are not in one, jump to next
1242 const SwTOXBase* pBase = m_pWrtShell->GetCurTOX();
1243 if( !pBase )
1244 {
1245 m_pWrtShell->GotoNextTOXBase();
1246 pBase = m_pWrtShell->GetCurTOX();
1247 }
1248
1249 bool bAutoMarkApplied = false;
1250 while( pBase )
1251 {
1252 if(TOX_INDEX == pBase->GetType() && !bAutoMarkApplied)
1253 {
1254 m_pWrtShell->ApplyAutoMark();
1255 bAutoMarkApplied = true;
1256 }
1257 // pBase is needed only for the interface. Should be changed in future! (JP 1996)
1258 m_pWrtShell->UpdateTableOf( *pBase );
1259
1260 if( m_pWrtShell->GotoNextTOXBase() )
1261 pBase = m_pWrtShell->GetCurTOX();
1262 else
1263 pBase = nullptr;
1264 }
1265 }
1266 m_pWrtShell->SetReadOnlyAvailable( bOldCursorInReadOnly );
1267 m_pWrtShell->EndAction();
1268 }
1269 break;
1270 case SID_ATTR_BRUSH:
1271 {
1272 if(pArgs && SfxItemState::SET == pArgs->GetItemState(RES_BACKGROUND, false, &pItem))
1273 {
1274 const size_t nCurIdx = m_pWrtShell->GetCurPageDesc();
1275 SwPageDesc aDesc( m_pWrtShell->GetPageDesc( nCurIdx ));
1276 SwFrameFormat& rMaster = aDesc.GetMaster();
1277 rMaster.SetFormatAttr(*pItem);
1278 m_pWrtShell->ChgPageDesc( nCurIdx, aDesc);
1279 }
1280 }
1281 break;
1282 case SID_CLEARHISTORY:
1283 {
1284 m_pWrtShell->DelAllUndoObj();
1285 }
1286 break;
1287 case SID_UNDO:
1288 {
1289 m_pShell->ExecuteSlot(rReq);
1290 }
1291 break;
1292#if defined(_WIN32) || defined UNX
1293 case SID_TWAIN_SELECT:
1294 case SID_TWAIN_TRANSFER:
1295 GetViewImpl()->ExecuteScan( rReq );
1296 break;
1297#endif
1298
1299 case SID_ATTR_DEFTABSTOP:
1300 {
1301 const SfxUInt16Item* pTabStopItem = nullptr;
1302 if(pArgs && (pTabStopItem = pArgs->GetItemIfSet(SID_ATTR_DEFTABSTOP, false)))
1303 {
1304 SvxTabStopItem aDefTabs( 0, 0, SvxTabAdjust::Default, RES_PARATR_TABSTOP );
1305 const sal_uInt16 nTab = pTabStopItem->GetValue();
1306 MakeDefTabs( nTab, aDefTabs );
1307 m_pWrtShell->SetDefault( aDefTabs );
1308 }
1309 }
1310 break;
1311 case SID_ATTR_LANGUAGE :
1312 {
1313 const SvxLanguageItem* pLangItem;
1314 if(pArgs && (pLangItem = pArgs->GetItemIfSet(SID_ATTR_LANGUAGE, false)))
1315 {
1316 SvxLanguageItem aLang(pLangItem->GetLanguage(), RES_CHRATR_LANGUAGE);
1317 m_pWrtShell->SetDefault( aLang );
1319 }
1320 }
1321 break;
1322 case SID_ATTR_CHAR_CTL_LANGUAGE:
1323 if(pArgs && SfxItemState::SET == pArgs->GetItemState(RES_CHRATR_CTL_LANGUAGE, false, &pItem))
1324 {
1325 m_pWrtShell->SetDefault( *pItem );
1327 }
1328 break;
1329 case SID_ATTR_CHAR_CJK_LANGUAGE:
1330 if(pArgs && SfxItemState::SET == pArgs->GetItemState(RES_CHRATR_CJK_LANGUAGE, false, &pItem))
1331 {
1332 m_pWrtShell->SetDefault( *pItem );
1334 }
1335 break;
1337 {
1338 SwWrtShell& rSh = GetWrtShell();
1339 int nOutlineLevel = -1;
1340 auto nOutlinePos = rSh.GetOutlinePos();
1341 if (nOutlinePos != SwOutlineNodes::npos)
1342 nOutlineLevel = rSh.getIDocumentOutlineNodesAccess()->getOutlineLevel(nOutlinePos);
1343 SwNumberInputDlg aDlg(GetViewFrame()->GetFrameWeld(),
1344 SwResId(STR_OUTLINE_LEVELS_SHOWN_TITLE),
1345 SwResId(STR_OUTLINE_LEVELS_SHOWN_SPIN_LABEL),
1346 nOutlineLevel + 1, 1, 10,
1347 SwResId(STR_OUTLINE_LEVELS_SHOWN_HELP_LABEL));
1348 if (aDlg.run() == RET_OK)
1349 rSh.MakeOutlineLevelsVisible(aDlg.GetNumber());
1350 }
1351 break;
1353 {
1354 size_t nPos(m_pWrtShell->GetOutlinePos());
1357 }
1358 break;
1359 case FN_NAV_ELEMENT:
1360 {
1361 pArgs->GetItemState(GetPool().GetWhich(FN_NAV_ELEMENT), false, &pItem);
1362 if(pItem)
1363 {
1364 SvxSearchDialogWrapper::SetSearchLabel(SearchLabel::Empty);
1365 sal_uInt32 nMoveType(static_cast<const SfxUInt32Item*>(pItem)->GetValue());
1366 SwView::SetMoveType(nMoveType);
1367 }
1368 }
1369 break;
1370 case FN_SCROLL_PREV:
1371 case FN_SCROLL_NEXT:
1372 {
1373 bool *pbNext = new bool(true);
1374 if (nSlot == FN_SCROLL_PREV)
1375 *pbNext = false;
1376 MoveNavigationHdl(pbNext);
1377 }
1378 break;
1379 case SID_JUMPTOMARK:
1380 if( pArgs && SfxItemState::SET == pArgs->GetItemState(SID_JUMPTOMARK, false, &pItem))
1381 JumpToSwMark( static_cast<const SfxStringItem*>(pItem)->GetValue() );
1382 break;
1383 case SID_GALLERY :
1384 // First make sure that the sidebar is visible
1385 GetViewFrame()->ShowChildWindow(SID_SIDEBAR);
1386
1388 u"GalleryPanel",
1389 GetViewFrame()->GetFrame().GetFrameInterface());
1390 break;
1391 case SID_AVMEDIA_PLAYER :
1393 break;
1394 case SID_VIEW_DATA_SOURCE_BROWSER:
1395 {
1396 SfxViewFrame* pVFrame = GetViewFrame();
1397 pVFrame->ChildWindowExecute(rReq);
1398 if(pVFrame->HasChildWindow(SID_BROWSER))
1399 {
1400 const SwDBData& rData = GetWrtShell().GetDBData();
1401 SwModule::ShowDBObj(*this, rData);
1402 }
1403 }
1404 break;
1406 {
1407 bool bShow = false;
1408 if( pArgs &&
1409 SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem ))
1410 bShow = static_cast<const SfxBoolItem*>(pItem)->GetValue();
1411 if((bShow && m_bInMailMerge) != GetViewFrame()->HasChildWindow(nSlot))
1413 //if fields have been successfully inserted call the "real"
1414 //mail merge dialog
1415#if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
1416 SwWrtShell &rSh = GetWrtShell();
1418 {
1419 SwDBManager* pDBManager = rSh.GetDBManager();
1420 if (pDBManager)
1421 {
1422 SwDBData aData = rSh.GetDBData();
1423 rSh.EnterStdMode(); // force change in text shell; necessary for mixing DB fields
1424 AttrChangedNotify(nullptr);
1425
1426 Sequence<PropertyValue> aProperties
1427 {
1428 comphelper::makePropertyValue("DataSourceName", aData.sDataSource),
1429 comphelper::makePropertyValue("Command", aData.sCommand),
1430 comphelper::makePropertyValue("CommandType", aData.nCommandType)
1431 };
1432 pDBManager->ExecuteFormLetter(rSh, aProperties);
1433 }
1434 }
1435#endif
1436 m_bInMailMerge &= bShow;
1438 }
1439 break;
1440 case FN_QRY_MERGE:
1441 {
1442 bool bUseCurrentDocument = true;
1443 bool bQuery = !pArgs || SfxItemState::SET != pArgs->GetItemState(nSlot);
1444 if(bQuery)
1445 {
1446 SfxViewFrame* pTmpFrame = GetViewFrame();
1449 if (RET_OK == pDlg->Execute())
1450 bUseCurrentDocument = pDlg->IsThisDocument();
1451 else
1452 break;
1453 }
1454 GenerateFormLetter(bUseCurrentDocument);
1455 }
1456 break;
1457 case SID_RECHECK_DOCUMENT:
1458 {
1459 SwDocShell* pDocShell = GetDocShell();
1460 SwDoc* pDoc = pDocShell->GetDoc();
1461 uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( pDoc->GetGCIterator() );
1462 if( xGCIterator.is() )
1463 {
1464 xGCIterator->resetIgnoreRules();
1465 }
1466 // reset ignore lists
1467 pDoc->SpellItAgainSam( true, false, false );
1468 // clear ignore dictionary
1469 uno::Reference< linguistic2::XDictionary > xDictionary = LinguMgr::GetIgnoreAllList();
1470 if( xDictionary.is() )
1471 xDictionary->clear();
1472 // put cursor to the start of the document
1473 m_pWrtShell->StartOfSection();
1474 [[fallthrough]]; // call spell/grammar dialog
1475 }
1477 {
1478 SfxViewFrame* pViewFrame = GetViewFrame();
1479 if (rReq.GetArgs() != nullptr)
1481 static_cast<const SfxBoolItem&>( (rReq.GetArgs()->
1483 else
1485
1487 rReq.Ignore ();
1488 }
1489 break;
1490 case SID_ALIGN_ANY_LEFT :
1491 case SID_ALIGN_ANY_HCENTER :
1492 case SID_ALIGN_ANY_RIGHT :
1493 case SID_ALIGN_ANY_JUSTIFIED:
1494 case SID_ALIGN_ANY_TOP :
1495 case SID_ALIGN_ANY_VCENTER :
1496 case SID_ALIGN_ANY_BOTTOM :
1497 case SID_ALIGN_ANY_HDEFAULT :
1498 case SID_ALIGN_ANY_VDEFAULT :
1499 {
1500 sal_uInt16 nAlias = 0;
1502 {
1503 switch( nSlot )
1504 {
1505 case SID_ALIGN_ANY_LEFT : nAlias = SID_ATTR_PARA_ADJUST_LEFT; break;
1506 case SID_ALIGN_ANY_HCENTER : nAlias = SID_ATTR_PARA_ADJUST_CENTER; break;
1507 case SID_ALIGN_ANY_RIGHT : nAlias = SID_ATTR_PARA_ADJUST_RIGHT; break;
1508 case SID_ALIGN_ANY_JUSTIFIED: nAlias = SID_ATTR_PARA_ADJUST_BLOCK; break;
1509 case SID_ALIGN_ANY_TOP : nAlias = SID_TABLE_VERT_NONE; break;
1510 case SID_ALIGN_ANY_VCENTER : nAlias = SID_TABLE_VERT_CENTER; break;
1511 case SID_ALIGN_ANY_BOTTOM : nAlias = SID_TABLE_VERT_BOTTOM; break;
1512 }
1513 }
1514 else
1515 {
1516 switch( nSlot )
1517 {
1518 case SID_ALIGN_ANY_LEFT : nAlias = SID_OBJECT_ALIGN_LEFT ; break;
1519 case SID_ALIGN_ANY_HCENTER : nAlias = SID_OBJECT_ALIGN_CENTER ; break;
1520 case SID_ALIGN_ANY_RIGHT : nAlias = SID_OBJECT_ALIGN_RIGHT ; break;
1521 case SID_ALIGN_ANY_TOP : nAlias = SID_OBJECT_ALIGN_UP ; break;
1522 case SID_ALIGN_ANY_VCENTER : nAlias = SID_OBJECT_ALIGN_MIDDLE ; break;
1523 case SID_ALIGN_ANY_BOTTOM : nAlias = SID_OBJECT_ALIGN_DOWN ; break;
1524 }
1525 }
1526 //these slots are either re-mapped to text or object alignment
1527 if (nAlias)
1529 nAlias, SfxCallMode::ASYNCHRON);
1530 }
1531 break;
1532 case SID_RESTORE_EDITING_VIEW:
1533 {
1534 //#i33307# restore editing position
1535 Point aCursorPos;
1536 bool bSelectObj;
1537 if(m_pViewImpl->GetRestorePosition(aCursorPos, bSelectObj))
1538 {
1539 m_pWrtShell->SwCursorShell::SetCursor( aCursorPos, !bSelectObj );
1540 if( bSelectObj )
1541 {
1542 m_pWrtShell->SelectObj( aCursorPos );
1543 m_pWrtShell->EnterSelFrameMode( &aCursorPos );
1544 }
1545 }
1546 }
1547 break;
1548 case SID_INSERT_GRAPHIC:
1549 {
1550 rReq.SetReturnValue(SfxBoolItem(nSlot, InsertGraphicDlg( rReq )));
1551 }
1552 break;
1553 case SID_MOVE_SHAPE_HANDLE:
1554 {
1555 if (pArgs && pArgs->Count() >= 3)
1556 {
1557 SdrView *pSdrView = m_pWrtShell->HasDrawView() ? m_pWrtShell->GetDrawView() : nullptr;
1558 if (pSdrView == nullptr)
1559 break;
1560 const SfxUInt32Item* handleNumItem = rReq.GetArg<SfxUInt32Item>(FN_PARAM_1);
1561 const SfxUInt32Item* newPosXTwips = rReq.GetArg<SfxUInt32Item>(FN_PARAM_2);
1562 const SfxUInt32Item* newPosYTwips = rReq.GetArg<SfxUInt32Item>(FN_PARAM_3);
1563 const SfxInt32Item* OrdNum = rReq.GetArg<SfxInt32Item>(FN_PARAM_4);
1564
1565 const sal_uLong handleNum = handleNumItem->GetValue();
1566 const sal_uLong newPosX = newPosXTwips->GetValue();
1567 const sal_uLong newPosY = newPosYTwips->GetValue();
1568 const Point mPoint(newPosX, newPosY);
1569 const SdrHdl* handle = pSdrView->GetHdlList().GetHdl(handleNum);
1570 if (!handle)
1571 {
1572 break;
1573 }
1574
1575 if (handle->GetKind() == SdrHdlKind::Anchor || handle->GetKind() == SdrHdlKind::Anchor_TR)
1576 m_pWrtShell->FindAnchorPos(mPoint, /*bMoveIt=*/true);
1577 else
1578 pSdrView->MoveShapeHandle(handleNum, mPoint, OrdNum ? OrdNum->GetValue() : -1);
1579 }
1580 break;
1581 }
1582
1583 default:
1584 OSL_ENSURE(false, "wrong dispatcher");
1585 return;
1586 }
1587 if(!bIgnore)
1588 rReq.Done();
1589}
1590
1592{
1593 sal_uInt16 nId = rReq.GetSlot();
1594 bool bRet = false;
1595
1597 {
1599 bRet = true;
1600 }
1601 return bRet || SfxShell::IsConditionalFastCall(rReq);
1602
1603}
1604
1607{
1610}
1611
1613{
1616 rBnd.Update( FN_STAT_WORDCOUNT );
1617}
1618
1621{
1622 SwWrtShell& rShell = GetWrtShell();
1623
1624 SfxWhichIter aIter( rSet );
1625 sal_uInt16 nWhich = aIter.FirstWhich();
1626 OSL_ENSURE( nWhich, "empty set");
1627
1628 //get section change event
1629 const SwSection* CurrSect = rShell.GetCurrSection();
1630 if( CurrSect )
1631 {
1632 const OUString& sCurrentSectionName = CurrSect->GetSectionName();
1633 if(sCurrentSectionName != m_sOldSectionName)
1634 {
1636 }
1637 m_sOldSectionName = sCurrentSectionName;
1638 }
1639 else if (!m_sOldSectionName.isEmpty())
1640 {
1642 m_sOldSectionName= OUString();
1643 }
1644 //get column change event
1645 if(rShell.bColumnChange())
1646 {
1648 }
1649
1650 while( nWhich )
1651 {
1652 switch( nWhich )
1653 {
1654 case FN_STAT_PAGE:
1655 {
1656 OUString aTooltip;
1657 OUString aPageStr;
1658
1659 SwVisiblePageNumbers aVisiblePageNumbers;
1660 m_pWrtShell->GetFirstLastVisPageNumbers(aVisiblePageNumbers);
1661
1662 // convert to strings and define references
1663 OUString sFirstPhy = OUString::number(aVisiblePageNumbers.nFirstPhy);
1664 OUString sLastPhy = OUString::number(aVisiblePageNumbers.nLastPhy);
1665 OUString sFirstVirt = OUString::number(aVisiblePageNumbers.nFirstVirt);
1666 OUString sLastVirt = OUString::number(aVisiblePageNumbers.nLastVirt);
1667 OUString& sFirstCustomPhy = aVisiblePageNumbers.sFirstCustomPhy;
1668 OUString& sLastCustomPhy = aVisiblePageNumbers.sLastCustomPhy;
1669 OUString& sFirstCustomVirt = aVisiblePageNumbers.sFirstCustomVirt;
1670 OUString& sLastCustomVirt = aVisiblePageNumbers.sLastCustomVirt;
1671 OUString sPageCount = OUString::number(m_pWrtShell->GetPageCount());
1672
1673 if (aVisiblePageNumbers.nFirstPhy == aVisiblePageNumbers.nFirstVirt)
1674 {
1675 aTooltip = SwResId(STR_BOOKCTRL_HINT);
1676 if (aVisiblePageNumbers.nFirstPhy != aVisiblePageNumbers.nLastPhy)
1677 {
1678 if (sFirstPhy == sFirstCustomPhy && sLastPhy == sLastCustomPhy)
1679 {
1680 aPageStr = SwResId(STR_PAGES_COUNT);
1681 aPageStr = aPageStr.replaceFirst("%1", sFirstPhy);
1682 aPageStr = aPageStr.replaceFirst("%2", sLastPhy);
1683 aPageStr = aPageStr.replaceFirst("%3", sPageCount);
1684 }
1685 else
1686 {
1687 aPageStr = SwResId(STR_PAGES_COUNT_CUSTOM);
1688 aPageStr = aPageStr.replaceFirst("%1", sFirstPhy);
1689 aPageStr = aPageStr.replaceFirst("%2", sLastPhy);
1690 aPageStr = aPageStr.replaceFirst("%3", sFirstCustomPhy);
1691 aPageStr = aPageStr.replaceFirst("%4", sLastCustomPhy);
1692 aPageStr = aPageStr.replaceFirst("%5", sPageCount);
1693 }
1694 }
1695 else
1696 {
1697 if (sFirstPhy == sFirstCustomPhy && sLastPhy == sLastCustomPhy)
1698 {
1699 aPageStr = SwResId(STR_PAGE_COUNT);
1700 aPageStr = aPageStr.replaceFirst("%1", sFirstPhy);
1701 aPageStr = aPageStr.replaceFirst("%2", sPageCount);
1702 }
1703 else
1704 {
1705 aPageStr = SwResId(STR_PAGE_COUNT_CUSTOM);
1706 aPageStr = aPageStr.replaceFirst("%1", sFirstPhy);
1707 aPageStr = aPageStr.replaceFirst("%2", sFirstCustomPhy);
1708 aPageStr = aPageStr.replaceFirst("%3", sPageCount);
1709 }
1710 }
1711 }
1712 else
1713 {
1714 aTooltip = SwResId(STR_BOOKCTRL_HINT_EXTENDED);
1715 if (aVisiblePageNumbers.nFirstPhy != aVisiblePageNumbers.nLastPhy)
1716 {
1717 if (sFirstPhy == sFirstCustomPhy && sLastPhy == sLastCustomPhy)
1718 {
1719 aPageStr = SwResId(STR_PAGES_COUNT_EXTENDED);
1720 aPageStr = aPageStr.replaceFirst("%1", sFirstPhy);
1721 aPageStr = aPageStr.replaceFirst("%2", sLastPhy);
1722 aPageStr = aPageStr.replaceFirst("%3", sPageCount);
1723 aPageStr = aPageStr.replaceFirst("%4", sFirstVirt);
1724 aPageStr = aPageStr.replaceFirst("%5", sLastVirt);
1725 }
1726 else
1727 {
1728 aPageStr = SwResId(STR_PAGES_COUNT_CUSTOM_EXTENDED);
1729 aPageStr = aPageStr.replaceFirst("%1", sFirstPhy);
1730 aPageStr = aPageStr.replaceFirst("%2", sLastPhy);
1731 aPageStr = aPageStr.replaceFirst("%3", sFirstCustomPhy);
1732 aPageStr = aPageStr.replaceFirst("%4", sLastCustomPhy);
1733 aPageStr = aPageStr.replaceFirst("%5", sPageCount);
1734 aPageStr = aPageStr.replaceFirst("%6", sFirstVirt);
1735 aPageStr = aPageStr.replaceFirst("%7", sLastVirt);
1736 aPageStr = aPageStr.replaceFirst("%8", sFirstCustomVirt);
1737 aPageStr = aPageStr.replaceFirst("%9", sLastCustomVirt);
1738 }
1739 }
1740 else
1741 {
1742 if (sFirstPhy == sFirstCustomPhy && sLastPhy == sLastCustomPhy)
1743 {
1744 aPageStr = SwResId(STR_PAGE_COUNT_EXTENDED);
1745 aPageStr = aPageStr.replaceFirst("%1", sFirstPhy);
1746 aPageStr = aPageStr.replaceFirst("%2", sPageCount);
1747 aPageStr = aPageStr.replaceFirst("%3", sFirstVirt);
1748 }
1749 else
1750 {
1751 aPageStr = SwResId(STR_PAGE_COUNT_CUSTOM_EXTENDED);
1752 aPageStr = aPageStr.replaceFirst("%1", sFirstPhy);
1753 aPageStr = aPageStr.replaceFirst("%2", sFirstCustomPhy);
1754 aPageStr = aPageStr.replaceFirst("%3", sPageCount);
1755 aPageStr = aPageStr.replaceFirst("%4", sFirstVirt);
1756 aPageStr = aPageStr.replaceFirst("%5", sFirstCustomVirt);
1757 }
1758 }
1759 }
1760
1761 // replace range indicator with two pages conjunction if applicable
1762 if ((aVisiblePageNumbers.nLastPhy - aVisiblePageNumbers.nFirstPhy) == 1)
1763 aPageStr = aPageStr.replaceAll("-", SwResId(STR_PAGES_TWO_CONJUNCTION));
1764
1765 // status bar bookmark control string and tooltip
1766 std::vector<OUString> aStringList
1767 {
1768 aPageStr,
1769 aTooltip
1770 };
1772
1773 //if existing page number is not equal to old page number, send out this event.
1774 if (m_nOldPageNum != aVisiblePageNumbers.nFirstPhy)
1775 {
1776 if (m_nOldPageNum != 0)
1778 m_nOldPageNum = aVisiblePageNumbers.nFirstPhy;
1779 }
1780 const sal_uInt16 nCnt = GetWrtShell().GetPageCnt();
1781 if (m_nPageCnt != nCnt) // notify Basic
1782 {
1783 m_nPageCnt = nCnt;
1785 }
1786 }
1787 break;
1788
1789 case FN_STAT_WORDCOUNT:
1790 {
1791 SwDocStat selectionStats;
1792 SwDocStat documentStats;
1793 rShell.CountWords(selectionStats);
1794 documentStats = rShell.GetDoc()->getIDocumentStatistics().GetUpdatedDocStat( true /* complete-async */, false /* don't update fields */ );
1795
1796 sal_uLong nWord = selectionStats.nWord ? selectionStats.nWord : documentStats.nWord;
1797 sal_uLong nChar = selectionStats.nChar ? selectionStats.nChar : documentStats.nChar;
1798 TranslateId pResId = selectionStats.nWord ? STR_WORDCOUNT : STR_WORDCOUNT_NO_SELECTION;
1799 TranslateNId pWordResId = selectionStats.nWord ? STR_WORDCOUNT_WORDARG : STR_WORDCOUNT_WORDARG_NO_SELECTION;
1800 TranslateNId pCharResId = selectionStats.nWord ? STR_WORDCOUNT_CHARARG : STR_WORDCOUNT_CHARARG_NO_SELECTION;
1801
1803 OUString aWordArg = SwResId(pWordResId, nWord).replaceAll("$1", rLocaleData.getNum(nWord, 0));
1804 OUString aCharArg = SwResId(pCharResId, nChar).replaceAll("$1", rLocaleData.getNum(nChar, 0));
1805 OUString aWordCount(SwResId(pResId));
1806 aWordCount = aWordCount.replaceAll("$1", aWordArg);
1807 aWordCount = aWordCount.replaceAll("$2", aCharArg);
1808
1809 rSet.Put( SfxStringItem( FN_STAT_WORDCOUNT, aWordCount ) );
1810
1811 SwWordCountWrapper *pWrdCnt = static_cast<SwWordCountWrapper*>(GetViewFrame()->GetChildWindow(SwWordCountWrapper::GetChildWindowId()));
1812 if (pWrdCnt)
1813 pWrdCnt->SetCounts(selectionStats, documentStats);
1814 }
1815 break;
1817 {
1818 std::unique_ptr<sw::OnlineAccessibilityCheck> const& rOnlineAccessibilityCheck = rShell.GetDoc()->getOnlineAccessibilityCheck();
1819 if (rOnlineAccessibilityCheck)
1820 {
1821 sal_Int32 nIssues = rOnlineAccessibilityCheck->getNumberOfAccessibilityIssues();
1823 }
1824 }
1825 break;
1826
1827 case FN_STAT_TEMPLATE:
1828 {
1830 rShell.GetCurPageStyle()));
1831
1832 }
1833 break;
1834 case SID_ATTR_ZOOM:
1835 {
1836 if ( ( GetDocShell()->GetCreateMode() != SfxObjectCreateMode::EMBEDDED ) || !GetDocShell()->IsInPlaceActive() )
1837 {
1838 const SwViewOption* pVOpt = rShell.GetViewOptions();
1839 SvxZoomType eZoom = pVOpt->GetZoomType();
1840 SvxZoomItem aZoom(eZoom,
1841 pVOpt->GetZoom());
1842 if( pVOpt->getBrowseMode() )
1843 {
1844 aZoom.SetValueSet(
1845 SvxZoomEnableFlags::N50|
1846 SvxZoomEnableFlags::N75|
1847 SvxZoomEnableFlags::N100|
1848 SvxZoomEnableFlags::N150|
1849 SvxZoomEnableFlags::N200);
1850 }
1851 rSet.Put( aZoom );
1852 }
1853 else
1854 rSet.DisableItem( SID_ATTR_ZOOM );
1855 }
1856 break;
1857 case SID_ATTR_VIEWLAYOUT:
1858 {
1859 if ( ( GetDocShell()->GetCreateMode() != SfxObjectCreateMode::EMBEDDED ) || !GetDocShell()->IsInPlaceActive() )
1860 {
1861 const SwViewOption* pVOpt = rShell.GetViewOptions();
1862 const sal_uInt16 nColumns = pVOpt->GetViewLayoutColumns();
1863 const bool bBookMode = pVOpt->IsViewLayoutBookMode();
1864 SvxViewLayoutItem aViewLayout(nColumns, bBookMode);
1865 rSet.Put( aViewLayout );
1866 }
1867 else
1868 rSet.DisableItem( SID_ATTR_VIEWLAYOUT );
1869 }
1870 break;
1871 case SID_ATTR_ZOOMSLIDER:
1872 {
1873 if ( ( GetDocShell()->GetCreateMode() != SfxObjectCreateMode::EMBEDDED ) || !GetDocShell()->IsInPlaceActive() )
1874 {
1875 const SwViewOption* pVOpt = rShell.GetViewOptions();
1876 const sal_uInt16 nCurrentZoom = pVOpt->GetZoom();
1877 SvxZoomSliderItem aZoomSliderItem( nCurrentZoom, MINZOOM, MAXZOOM );
1878 aZoomSliderItem.AddSnappingPoint( 100 );
1879
1880 if ( !m_pWrtShell->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE) )
1881 {
1882 const sal_uInt16 nColumns = pVOpt->GetViewLayoutColumns();
1883 const bool bAutomaticViewLayout = 0 == nColumns;
1884 const SwPostItMgr* pMgr = GetPostItMgr();
1885
1886 // snapping points:
1887 // automatic mode: 1 Page, 2 Pages, 100%
1888 // n Columns mode: n Pages, 100%
1889 // n Columns book mode: nPages without gaps, 100%
1890 const SwRect aPageRect( m_pWrtShell->GetAnyCurRect( CurRectType::PageCalc ) );
1891 const SwRect aRootRect( m_pWrtShell->GetAnyCurRect( CurRectType::PagesArea ) ); // width of columns
1892 Size aPageSize( aPageRect.SSize() );
1893 aPageSize.AdjustWidth(pMgr->HasNotes() && pMgr->ShowNotes() ?
1894 pMgr->GetSidebarWidth() + pMgr->GetSidebarBorderWidth() :
1895 0 );
1896
1897 Size aRootSize( aRootRect.SSize() );
1898
1899 const MapMode aTmpMap( MapUnit::MapTwip );
1900 const Size& rEditSize = GetEditWin().GetOutputSizePixel();
1901 const Size aWindowSize( GetEditWin().PixelToLogic( rEditSize, aTmpMap ) );
1902
1903 const tools::Long nOf = pVOpt->GetDocumentBorder() * 2;
1904 tools::Long nTmpWidth = bAutomaticViewLayout ? aPageSize.Width() : aRootSize.Width();
1905 nTmpWidth += nOf;
1906 aPageSize.AdjustHeight(nOf );
1907 tools::Long nFac = aWindowSize.Width() * 100 / nTmpWidth;
1908
1909 tools::Long nVisPercent = aWindowSize.Height() * 100 / aPageSize.Height();
1910 nFac = std::min( nFac, nVisPercent );
1911
1912 if (nFac >= MINZOOM)
1913 {
1914 aZoomSliderItem.AddSnappingPoint( nFac );
1915 }
1916
1917 if ( bAutomaticViewLayout )
1918 {
1919 nTmpWidth += aPageSize.Width() + pVOpt->GetGapBetweenPages();
1920 nFac = aWindowSize.Width() * 100 / nTmpWidth;
1921 nFac = std::min( nFac, nVisPercent );
1922 if (nFac >= MINZOOM)
1923 {
1924 aZoomSliderItem.AddSnappingPoint( nFac );
1925 }
1926 }
1927 }
1928
1929 rSet.Put( aZoomSliderItem );
1930 }
1931 else
1932 rSet.DisableItem( SID_ATTR_ZOOMSLIDER );
1933 }
1934 break;
1935 case SID_ATTR_POSITION:
1936 case SID_ATTR_SIZE:
1937 {
1938 if( !rShell.IsFrameSelected() && !rShell.IsObjSelected() )
1940 else
1941 {
1942 FlyMode eFrameMode = SwBaseShell::GetFrameMode();
1943 if ( eFrameMode == FLY_DRAG_START || eFrameMode == FLY_DRAG )
1944 {
1945 if ( nWhich == SID_ATTR_POSITION )
1946 rSet.Put( SfxPointItem( SID_ATTR_POSITION,
1947 rShell.GetAnchorObjDiff()));
1948 else
1949 rSet.Put( SvxSizeItem( SID_ATTR_SIZE,
1950 rShell.GetObjSize()));
1951 }
1952 }
1953 }
1954 break;
1955 case SID_TABLE_CELL:
1956
1957 if( rShell.IsFrameSelected() || rShell.IsObjSelected() )
1958 {
1959 // #i39171# Don't put a SvxSizeItem into a slot which is defined as SfxStringItem.
1960 // SvxPosSizeStatusBarControl no longer resets to empty display if only one slot
1961 // has no item, so SID_TABLE_CELL can remain empty (the SvxSizeItem is supplied
1962 // in SID_ATTR_SIZE).
1963 }
1964 else
1965 {
1966 OUString sStr;
1967 if( rShell.IsCursorInTable() )
1968 {
1969 // table name + cell coordinate
1970 sStr = rShell.GetTableFormat()->GetName() + ":";
1971 sStr += rShell.GetBoxNms();
1972 }
1973 else
1974 {
1975 const SwSection* pCurrSect = rShell.GetCurrSection();
1976 if( pCurrSect )
1977 {
1978 switch( pCurrSect->GetType() )
1979 {
1982 {
1983 const SwTOXBase* pTOX = m_pWrtShell->GetCurTOX();
1984 if( pTOX )
1985 sStr = pTOX->GetTOXName();
1986 else
1987 {
1988 OSL_ENSURE( false,
1989 "Unknown kind of section" );
1990 sStr = pCurrSect->GetSectionName();
1991 }
1992 }
1993 break;
1994 default:
1995 sStr = pCurrSect->GetSectionName();
1996 break;
1997 }
1998 }
1999 }
2000
2001 const SwNumRule* pNumRule = rShell.GetNumRuleAtCurrCursorPos();
2002 const bool bOutlineNum = pNumRule && pNumRule->IsOutlineRule();
2003
2004 if (pNumRule && !bOutlineNum ) // cursor in numbering
2005 {
2006 sal_uInt8 nNumLevel = rShell.GetNumLevel();
2007 if ( nNumLevel < MAXLEVEL )
2008 {
2009 if(!pNumRule->IsAutoRule())
2010 {
2012 rShell.GetCurAttr(aSet);
2013 if(SfxItemState::DEFAULT <=
2015 {
2016 const OUString& rNumStyle =
2017 aSet.Get(RES_PARATR_NUMRULE).GetValue();
2018 if(!rNumStyle.isEmpty())
2019 {
2020 if(!sStr.isEmpty())
2021 sStr += sStatusDelim;
2022 sStr += rNumStyle;
2023 }
2024 }
2025 }
2026 if (!sStr.isEmpty())
2027 sStr += sStatusDelim;
2028 sStr += SwResId(STR_NUM_LEVEL) + OUString::number( nNumLevel + 1 );
2029
2030 }
2031 }
2032 const int nOutlineLevel = rShell.GetCurrentParaOutlineLevel();
2033 if( nOutlineLevel != 0 )
2034 {
2035 if (!sStr.isEmpty())
2036 sStr += " , ";
2037 if( bOutlineNum )
2038 {
2039 sStr += SwResId(STR_OUTLINE_NUMBERING) +
2040 sStatusDelim + SwResId(STR_NUM_LEVEL);
2041 }
2042 else
2043 sStr += SwResId(STR_NUM_OUTLINE);
2044 sStr += OUString::number( nOutlineLevel);
2045 }
2046
2047 if( rShell.HasReadonlySel() )
2048 {
2049 if (!sStr.isEmpty())
2050 sStr = sStatusDelim + sStr;
2051 sStr = SwResId(SW_STR_READONLY) + sStr;
2052 }
2053 if (!sStr.isEmpty())
2054 rSet.Put( SfxStringItem( SID_TABLE_CELL, sStr ));
2055 }
2056 break;
2057 case FN_STAT_SELMODE:
2058 {
2059 if(rShell.IsStdMode())
2061 else if(rShell.IsAddMode())
2063 else if(rShell.IsBlockMode())
2065 else
2067 break;
2068 }
2069 case SID_ATTR_INSERT:
2070 if( rShell.IsRedlineOn() )
2071 rSet.DisableItem( nWhich );
2072 else
2073 {
2074 rSet.Put(SfxBoolItem(SID_ATTR_INSERT,rShell.IsInsMode()));
2075 }
2076 break;
2077 }
2078 nWhich = aIter.NextWhich();
2079 }
2080}
2081
2087{
2088 SwWrtShell &rSh = GetWrtShell();
2089 const SfxItemSet* pArgs = rReq.GetArgs();
2090 const SfxPoolItem* pItem=nullptr;
2091 bool bUp = false;
2092 sal_uInt16 nWhich = rReq.GetSlot();
2093 switch( nWhich )
2094 {
2095 case FN_STAT_PAGE:
2096 {
2098 SfxCallMode::SYNCHRON|SfxCallMode::RECORD );
2099 }
2100 break;
2101
2102 case FN_STAT_WORDCOUNT:
2103 {
2105 SfxCallMode::SYNCHRON|SfxCallMode::RECORD );
2106 }
2107 break;
2108
2109 case FN_STAT_BOOKMARK:
2110 if ( pArgs )
2111 {
2112 if (SfxItemState::SET == pArgs->GetItemState( nWhich, true, &pItem))
2113 {
2114 const IDocumentMarkAccess* pMarkAccess = rSh.getIDocumentMarkAccess();
2115 const sal_Int32 nIdx = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
2116 if(nIdx < pMarkAccess->getBookmarksCount())
2117 {
2119 rSh.EnterStdMode();
2120 rSh.GotoMark( *ppBookmark );
2121 }
2122 else
2123 OSL_FAIL("SwView::ExecuteStatusLine(..)"
2124 " - Ignoring out of range bookmark index");
2125 }
2126 }
2127 break;
2128
2129 case FN_STAT_TEMPLATE:
2130 {
2131 weld::Window* pDialogParent = GetViewFrame()->GetFrameWeld();
2132 css::uno::Any aAny(pDialogParent->GetXWindow());
2133 SfxUnoAnyItem aDialogParent(SID_DIALOG_PARENT, aAny);
2134 const SfxPoolItem* pInternalItems[ 2 ];
2135 pInternalItems[ 0 ] = &aDialogParent;
2136 pInternalItems[ 1 ] = nullptr;
2138 SfxCallMode::SYNCHRON|SfxCallMode::RECORD,
2139 nullptr, 0, pInternalItems);
2140 }
2141 break;
2142 case SID_ATTR_ZOOM:
2143 {
2144 if ( ( GetDocShell()->GetCreateMode() != SfxObjectCreateMode::EMBEDDED ) || !GetDocShell()->IsInPlaceActive() )
2145 {
2146 const SfxItemSet *pSet = nullptr;
2148 if ( pArgs )
2149 pSet = pArgs;
2150 else
2151 {
2152 const SwViewOption& rViewOptions = *rSh.GetViewOptions();
2154 SvxZoomItem aZoom( rViewOptions.GetZoomType(), rViewOptions.GetZoom() );
2155
2156 const bool bBrowseMode = rSh.GetViewOptions()->getBrowseMode();
2157 if( bBrowseMode )
2158 {
2159 aZoom.SetValueSet(
2160 SvxZoomEnableFlags::N50|
2161 SvxZoomEnableFlags::N75|
2162 SvxZoomEnableFlags::N100|
2163 SvxZoomEnableFlags::N150|
2164 SvxZoomEnableFlags::N200);
2165 }
2166 aCoreSet.Put( aZoom );
2167
2168 if ( !bBrowseMode )
2169 {
2170 const SvxViewLayoutItem aViewLayout( rViewOptions.GetViewLayoutColumns(), rViewOptions.IsViewLayoutBookMode() );
2171 aCoreSet.Put( aViewLayout );
2172 }
2173
2175 pDlg.disposeAndReset(pFact->CreateSvxZoomDialog(GetViewFrame()->GetFrameWeld(), aCoreSet));
2176 pDlg->SetLimits( MINZOOM, MAXZOOM );
2177 if( pDlg->Execute() != RET_CANCEL )
2178 pSet = pDlg->GetOutputItemSet();
2179 }
2180
2181 const SvxViewLayoutItem* pViewLayoutItem = nullptr;
2182 if ( pSet && (pViewLayoutItem = pSet->GetItemIfSet(SID_ATTR_VIEWLAYOUT)))
2183 {
2184 const sal_uInt16 nColumns = pViewLayoutItem->GetValue();
2185 const bool bBookMode = pViewLayoutItem->IsBookMode();
2186 SetViewLayout( nColumns, bBookMode );
2187 }
2188
2189 const SvxZoomItem* pZoomItem = nullptr;
2190 if ( pSet && (pZoomItem = pSet->GetItemIfSet(SID_ATTR_ZOOM)))
2191 {
2192 SvxZoomType eType = pZoomItem->GetType();
2193 SetZoom( eType, pZoomItem->GetValue() );
2194 }
2195 bUp = true;
2196 if ( pZoomItem )
2197 rReq.AppendItem( *pZoomItem );
2198 rReq.Done();
2199 }
2200 }
2201 break;
2202
2203 case SID_ATTR_VIEWLAYOUT:
2204 {
2206 ( ( GetDocShell()->GetCreateMode() != SfxObjectCreateMode::EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) )
2207 {
2208 if ( const SvxViewLayoutItem* pLayoutItem = pArgs->GetItemIfSet(SID_ATTR_VIEWLAYOUT ))
2209 {
2210 const sal_uInt16 nColumns = pLayoutItem->GetValue();
2211 const bool bBookMode = (0 != nColumns && 0 == (nColumns % 2)) && pLayoutItem->IsBookMode();
2212
2213 SetViewLayout( nColumns, bBookMode );
2214 }
2215
2216 bUp = true;
2217 rReq.Done();
2218
2220 }
2221 }
2222 break;
2223
2224 case SID_ATTR_ZOOMSLIDER:
2225 {
2226 if ( pArgs && ( ( GetDocShell()->GetCreateMode() != SfxObjectCreateMode::EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) )
2227 {
2228 if ( const SvxZoomSliderItem* pZoomItem = pArgs->GetItemIfSet(SID_ATTR_ZOOMSLIDER) )
2229 {
2230 const sal_uInt16 nCurrentZoom = pZoomItem->GetValue();
2231 SetZoom( SvxZoomType::PERCENT, nCurrentZoom );
2232 }
2233
2234 bUp = true;
2235 rReq.Done();
2236 }
2237 }
2238 break;
2239
2240 case SID_ATTR_SIZE:
2241 {
2242 sal_uInt16 nId = 0;
2243 if( rSh.IsCursorInTable() )
2245 else if( rSh.GetCurTOX() )
2247 else if( rSh.GetCurrSection() )
2249 else
2250 {
2251 const SwNumRule* pNumRule = rSh.GetNumRuleAtCurrCursorPos();
2252 if( pNumRule ) // cursor in numbering
2253 {
2254 if( pNumRule->IsAutoRule() )
2256 else
2257 {
2258 // start dialog of the painter
2259 nId = 0;
2260 }
2261 }
2262 else if( rSh.IsFrameSelected() )
2264 else if( rSh.IsObjSelected() )
2265 nId = SID_ATTR_TRANSFORM;
2266 }
2267 if( nId )
2269 SfxCallMode::SYNCHRON | SfxCallMode::RECORD );
2270 }
2271 break;
2272
2273 case FN_STAT_SELMODE:
2274 {
2275 if ( pArgs )
2276 {
2277 if (SfxItemState::SET == pArgs->GetItemState( nWhich, true, &pItem))
2278 {
2279 switch ( static_cast<const SfxUInt16Item *>(pItem)->GetValue() )
2280 {
2281 case 0: rSh.EnterStdMode(); break;
2282 case 1: rSh.EnterExtMode(); break;
2283 case 2: rSh.EnterAddMode(); break;
2284 case 3: rSh.EnterBlockMode(); break;
2285 }
2286 }
2287 }
2288 bUp = true;
2289 break;
2290 }
2291 case FN_SET_ADD_MODE:
2292 rSh.ToggleAddMode();
2293 nWhich = FN_STAT_SELMODE;
2294 bUp = true;
2295 break;
2296 case FN_SET_BLOCK_MODE:
2297 rSh.ToggleBlockMode();
2298 nWhich = FN_STAT_SELMODE;
2299 bUp = true;
2300 break;
2301 case FN_SET_EXT_MODE:
2302 rSh.ToggleExtMode();
2303 nWhich = FN_STAT_SELMODE;
2304 bUp = true;
2305 break;
2306 case SID_ATTR_INSERT:
2307 SwPostItMgr* pMgr = GetPostItMgr();
2308 if ( pMgr && pMgr->HasActiveSidebarWin() )
2309 {
2311 }
2312 else
2313 rSh.ToggleInsMode();
2314 bUp = true;
2315 break;
2316
2317 }
2318 if ( bUp )
2319 {
2321 rBnd.Invalidate(nWhich);
2322 rBnd.Update(nWhich);
2323 }
2324}
2325
2326void SwView::InsFrameMode(sal_uInt16 nCols)
2327{
2328 if ( m_pWrtShell->HasWholeTabSelection() )
2329 {
2330 SwFlyFrameAttrMgr aMgr( true, m_pWrtShell.get(), Frmmgr_Type::TEXT, nullptr );
2331
2332 const SwFrameFormat &rPageFormat =
2333 m_pWrtShell->GetPageDesc(m_pWrtShell->GetCurPageDesc()).GetMaster();
2334 SwTwips lWidth = rPageFormat.GetFrameSize().GetWidth();
2335 const SvxLRSpaceItem &rLR = rPageFormat.GetLRSpace();
2336 lWidth -= rLR.GetLeft() + rLR.GetRight();
2337 aMgr.SetSize(Size(lWidth, aMgr.GetSize().Height()));
2338 if(nCols > 1)
2339 {
2340 SwFormatCol aCol;
2341 aCol.Init( nCols, aCol.GetGutterWidth(), aCol.GetWishWidth() );
2342 aMgr.SetCol( aCol );
2343 }
2344 aMgr.InsertFlyFrame();
2345 }
2346 else
2347 GetEditWin().InsFrame(nCols);
2348}
2349
2352{
2353 bool bWeb = dynamic_cast<SwWebView*>( this ) != nullptr;
2355 ScopedVclPtr<SfxAbstractLinksDialog> pDlg(pFact->CreateLinksDialog(GetViewFrame()->GetFrameWeld(), &GetWrtShell().GetLinkManager(), bWeb));
2356 pDlg->Execute();
2357}
2358
2359namespace sw {
2360
2361auto PrepareJumpToTOXMark(SwDoc const& rDoc, std::u16string_view aName)
2362 -> std::optional<std::pair<SwTOXMark, sal_Int32>>
2363{
2364 size_t const first(aName.find(toxMarkSeparator));
2365 if (first == std::u16string_view::npos)
2366 {
2367 SAL_WARN("sw.ui", "JumpToTOXMark: missing separator");
2368 return std::optional<std::pair<SwTOXMark, sal_Int32>>();
2369 }
2370 sal_Int32 const counter(o3tl::toInt32(aName.substr(0, first)));
2371 if (counter <= 0)
2372 {
2373 SAL_WARN("sw.ui", "JumpToTOXMark: invalid counter");
2374 return std::optional<std::pair<SwTOXMark, sal_Int32>>();
2375 }
2376 size_t const second(aName.find(toxMarkSeparator, first + 1));
2377 if (second == std::u16string_view::npos)
2378 {
2379 SAL_WARN("sw.ui", "JumpToTOXMark: missing separator");
2380 return std::optional<std::pair<SwTOXMark, sal_Int32>>();
2381 }
2382 std::u16string_view const entry(aName.substr(first + 1, second - (first + 1)));
2383 if (aName.size() < second + 2)
2384 {
2385 SAL_WARN("sw.ui", "JumpToTOXMark: invalid tox");
2386 return std::optional<std::pair<SwTOXMark, sal_Int32>>();
2387 }
2388 sal_uInt16 const indexType(aName[second + 1]);
2389 std::u16string_view const indexName(aName.substr(second + 2));
2390 SwTOXType const* pType(nullptr);
2391 switch (indexType)
2392 {
2393 case 'A':
2394 pType = rDoc.GetTOXType(TOX_INDEX, 0);
2395 assert(pType);
2396 break;
2397 case 'C':
2398 pType = rDoc.GetTOXType(TOX_CONTENT, 0);
2399 assert(pType);
2400 break;
2401 case 'U':
2402 for (auto i = rDoc.GetTOXTypeCount(TOX_USER); 0 < i; )
2403 {
2404 --i;
2405 auto const pTmp(rDoc.GetTOXType(TOX_USER, i));
2406 if (pTmp->GetTypeName() == indexName)
2407 {
2408 pType = pTmp;
2409 break;
2410 }
2411 }
2412 break;
2413 }
2414 if (!pType)
2415 {
2416 SAL_WARN("sw.ui", "JumpToTOXMark: tox doesn't exist");
2417 return std::optional<std::pair<SwTOXMark, sal_Int32>>();
2418 }
2419 // type and alt text are the search keys
2420 SwTOXMark tmp(pType);
2421 tmp.SetAlternativeText(OUString(entry));
2422 return std::optional<std::pair<SwTOXMark, sal_Int32>>(std::pair<SwTOXMark, sal_Int32>(tmp, counter));
2423}
2424
2425} // namespace sw
2426
2427static auto JumpToTOXMark(SwWrtShell & rSh, std::u16string_view aName) -> bool
2428{
2429 std::optional<std::pair<SwTOXMark, sal_Int32>> const tmp(
2430 sw::PrepareJumpToTOXMark(*rSh.GetDoc(), aName));
2431 if (!tmp)
2432 {
2433 return false;
2434 }
2435 SwTOXMark const* pMark(&tmp->first);
2436 // hack: check first if one exists
2437 if (&tmp->first != &rSh.GetDoc()->GotoTOXMark(tmp->first, TOX_SAME_NXT, rSh.IsReadOnlyAvailable()))
2438 {
2439 for (sal_Int32 i = 0; i < tmp->second; ++i)
2440 {
2441 pMark = &rSh.GotoTOXMark(*pMark, TOX_SAME_NXT);
2442 }
2443 return true;
2444 }
2445 else
2446 {
2447 SAL_WARN("sw.ui", "JumpToTOXMark: tox mark doesn't exist");
2448 return false;
2449 }
2450}
2451
2452bool SwView::JumpToSwMark( std::u16string_view rMark )
2453{
2454 bool bRet = false;
2455 if( !rMark.empty() )
2456 {
2457 // place bookmark at top-center
2458 bool bSaveCC = m_bCenterCursor;
2459 bool bSaveCT = m_bTopCursor;
2460 SetCursorAtTop( true );
2461
2462 // For scrolling the FrameSet, the corresponding shell needs to have the focus.
2463 bool bHasShFocus = m_pWrtShell->HasShellFocus();
2464 if( !bHasShFocus )
2465 m_pWrtShell->ShellGetFocus();
2466
2467 const SwFormatINetFormat* pINet;
2468 OUString sCmp;
2469 OUString sMark( INetURLObject::decode( rMark,
2471
2472 sal_Int32 nLastPos, nPos = sMark.indexOf( cMarkSeparator );
2473 if( -1 != nPos )
2474 while( -1 != ( nLastPos = sMark.indexOf( cMarkSeparator, nPos + 1 )) )
2475 nPos = nLastPos;
2476
2478 IDocumentMarkAccess* const pMarkAccess = m_pWrtShell->getIDocumentMarkAccess();
2479 if( -1 != nPos )
2480 sCmp = sMark.copy(nPos + 1).replaceAll(" ", "");
2481
2482 if( !sCmp.isEmpty() )
2483 {
2484 OUString sName( sMark.copy( 0, nPos ) );
2485 sCmp = sCmp.toAsciiLowerCase();
2486 FlyCntType eFlyType = FLYCNTTYPE_ALL;
2487
2488 if (sCmp == "drawingobject")
2489 bRet = m_pWrtShell->GotoDrawingObject(sName);
2490 else if( sCmp == "region" )
2491 {
2492 m_pWrtShell->EnterStdMode();
2493 bRet = m_pWrtShell->GotoRegion( sName );
2494 }
2495 else if( sCmp == "outline" )
2496 {
2497 m_pWrtShell->EnterStdMode();
2498 bRet = m_pWrtShell->GotoOutline( sName );
2499 }
2500 else if( sCmp == "frame" )
2501 eFlyType = FLYCNTTYPE_FRM;
2502 else if( sCmp == "graphic" )
2503 eFlyType = FLYCNTTYPE_GRF;
2504 else if( sCmp == "ole" )
2505 eFlyType = FLYCNTTYPE_OLE;
2506 else if( sCmp == "table" )
2507 {
2508 m_pWrtShell->EnterStdMode();
2509 bRet = m_pWrtShell->GotoTable( sName );
2510 }
2511 else if( sCmp == "sequence" )
2512 {
2513 m_pWrtShell->EnterStdMode();
2514 sal_Int32 nNoPos = sName.indexOf( cSequenceMarkSeparator );
2515 if ( nNoPos != -1 )
2516 {
2517 sal_uInt16 nSeqNo = o3tl::toInt32(sName.subView( nNoPos + 1 ));
2518 sName = sName.copy( 0, nNoPos );
2519 bRet = m_pWrtShell->GotoRefMark(sName, REF_SEQUENCEFLD, nSeqNo);
2520 }
2521 }
2522 else if (sCmp == "toxmark")
2523 {
2525 }
2526 else if( sCmp == "text" )
2527 {
2528 // normal text search
2529 m_pWrtShell->EnterStdMode();
2530
2531 i18nutil::SearchOptions2 aSearchOpt(
2532 SearchAlgorithms_ABSOLUTE, 0,
2533 sName, OUString(),
2534 SvtSysLocale().GetLanguageTag().getLocale(),
2535 0,0,0,
2536 TransliterationFlags::IGNORE_CASE,
2537 SearchAlgorithms2::ABSOLUTE,
2538 '\\' );
2539
2540 //todo/mba: assuming that notes shouldn't be searched
2541 if( m_pWrtShell->SearchPattern( aSearchOpt, false/*bSearchInNotes*/, SwDocPositions::Start, SwDocPositions::End ))
2542 {
2543 m_pWrtShell->EnterStdMode(); // remove the selection
2544 bRet = true;
2545 }
2546 }
2547 else if( pMarkAccess->getAllMarksEnd() != (ppMark = pMarkAccess->findMark(sMark)) )
2548 {
2549 bRet = m_pWrtShell->GotoMark( *ppMark, false );
2550 }
2551 else if( nullptr != ( pINet = m_pWrtShell->FindINetAttr( sMark ) )) {
2552 m_pWrtShell->addCurrentPosition();
2553 bRet = m_pWrtShell->GotoINetAttr( *pINet->GetTextINetFormat() );
2554 }
2555
2556 // for all types of Flys
2557 if( FLYCNTTYPE_ALL != eFlyType && m_pWrtShell->GotoFly( sName, eFlyType ))
2558 {
2559 bRet = true;
2560 if( FLYCNTTYPE_FRM == eFlyType )
2561 {
2562 // TextFrames: set Cursor in the frame
2563 m_pWrtShell->UnSelectFrame();
2564 m_pWrtShell->LeaveSelFrameMode();
2565 }
2566 else
2567 {
2568 m_pWrtShell->HideCursor();
2569 m_pWrtShell->EnterSelFrameMode();
2570 }
2571 }
2572 }
2573 else if( pMarkAccess->getAllMarksEnd() != (ppMark = pMarkAccess->findMark(sMark)))
2574 {
2575 bRet = m_pWrtShell->GotoMark( *ppMark, false );
2576 }
2577 else if( nullptr != ( pINet = m_pWrtShell->FindINetAttr( sMark ) ))
2578 bRet = m_pWrtShell->GotoINetAttr( *pINet->GetTextINetFormat() );
2579
2580 // make selection visible later
2581 if ( m_aVisArea.IsEmpty() )
2583
2584 // reset ViewStatus
2585 SetCursorAtTop( bSaveCT, bSaveCC );
2586
2587 if(!m_pWrtShell->IsFrameSelected() && !m_pWrtShell->IsObjSelected())
2588 m_pWrtShell->ShowCursor();
2589
2590 if( !bHasShFocus )
2591 m_pWrtShell->ShellLoseFocus();
2592 }
2593 return bRet;
2594}
2595
2596// #i67305# Undo after insert from file:
2597// Undo "Insert form file" crashes with documents imported from binary filter (.sdw) => disabled
2598// Undo "Insert form file" crashes with (.odt) documents crashes if these documents contains
2599// page styles with active header/footer => disabled for those documents
2600static size_t lcl_PageDescWithHeader( const SwDoc& rDoc )
2601{
2602 size_t nRet = 0;
2603 size_t nCnt = rDoc.GetPageDescCnt();
2604 for( size_t i = 0; i < nCnt; ++i )
2605 {
2606 const SwPageDesc& rPageDesc = rDoc.GetPageDesc( i );
2607 const SwFrameFormat& rMaster = rPageDesc.GetMaster();
2608 const SwFormatHeader* pHeaderItem = rMaster.GetAttrSet().GetItemIfSet( RES_HEADER, false );
2609 const SwFormatFooter* pFooterItem = rMaster.GetAttrSet().GetItemIfSet( RES_FOOTER, false );
2610 if( (pHeaderItem && pHeaderItem->IsActive()) ||
2611 (pFooterItem && pFooterItem->IsActive()) )
2612 ++nRet;
2613 }
2614 return nRet; // number of page styles with active header/footer
2615}
2616
2617void SwView::ExecuteInsertDoc( SfxRequest& rRequest, const SfxPoolItem* pItem )
2618{
2619 m_pViewImpl->InitRequest( rRequest );
2620 m_pViewImpl->SetParam( pItem ? 1 : 0 );
2621 const sal_uInt16 nSlot = rRequest.GetSlot();
2622
2623 if ( !pItem )
2624 {
2625 InsertDoc( nSlot, "", "" );
2626 }
2627 else
2628 {
2629 OUString sFile, sFilter;
2630 sFile = static_cast<const SfxStringItem *>( pItem )->GetValue();
2631 if ( SfxItemState::SET == rRequest.GetArgs()->GetItemState( FN_PARAM_1, true, &pItem ) )
2632 sFilter = static_cast<const SfxStringItem *>(pItem )->GetValue();
2633
2634 bool bHasFileName = !sFile.isEmpty();
2635 tools::Long nFound = InsertDoc( nSlot, sFile, sFilter );
2636
2637 if ( bHasFileName )
2638 {
2639 rRequest.SetReturnValue( SfxBoolItem( nSlot, nFound != -1 ) );
2640 rRequest.Done();
2641 }
2642 }
2643}
2644
2645tools::Long SwView::InsertDoc( sal_uInt16 nSlotId, const OUString& rFileName, const OUString& rFilterName, sal_Int16 nVersion )
2646{
2647 std::unique_ptr<SfxMedium> pMed;
2648 SwDocShell* pDocSh = GetDocShell();
2649
2650 if( !rFileName.isEmpty() )
2651 {
2652 SfxObjectFactory& rFact = pDocSh->GetFactory();
2653 std::shared_ptr<const SfxFilter> pFilter = rFact.GetFilterContainer()->GetFilter4FilterName( rFilterName );
2654 if ( !pFilter )
2655 {
2656 pMed.reset(new SfxMedium(rFileName, StreamMode::READ, nullptr, nullptr ));
2657 SfxFilterMatcher aMatcher( rFact.GetFilterContainer()->GetName() );
2658 pMed->UseInteractionHandler( true );
2659 ErrCode nErr = aMatcher.GuessFilter(*pMed, pFilter, SfxFilterFlags::NONE);
2660 if ( nErr )
2661 pMed.reset();
2662 else
2663 pMed->SetFilter( pFilter );
2664 }
2665 else
2666 pMed.reset(new SfxMedium(rFileName, StreamMode::READ, pFilter, nullptr));
2667 }
2668 else
2669 {
2670 m_pViewImpl->StartDocumentInserter(
2671 // tdf#118578 allow inserting any Writer document except GlobalDoc
2672 SwDocShell::Factory().GetFactoryName(),
2673 LINK( this, SwView, DialogClosedHdl ),
2674 nSlotId
2675 );
2676 return -1;
2677 }
2678
2679 if( !pMed )
2680 return -1;
2681
2682 return InsertMedium( nSlotId, std::move(pMed), nVersion );
2683}
2684
2685tools::Long SwView::InsertMedium( sal_uInt16 nSlotId, std::unique_ptr<SfxMedium> pMedium, sal_Int16 nVersion )
2686{
2687 bool bInsert = false, bCompare = false;
2688 tools::Long nFound = 0;
2689 SwDocShell* pDocSh = GetDocShell();
2690
2691 switch( nSlotId )
2692 {
2693 case SID_DOCUMENT_MERGE: break;
2694 case SID_DOCUMENT_COMPARE: bCompare = true; break;
2695 case SID_INSERTDOC: bInsert = true; break;
2696
2697 default:
2698 OSL_ENSURE( false, "unknown SlotId!" );
2699 bInsert = true;
2700 break;
2701 }
2702
2703 if( bInsert )
2704 {
2705 uno::Reference< frame::XDispatchRecorder > xRecorder =
2707 if ( xRecorder.is() )
2708 {
2709 SfxRequest aRequest(GetViewFrame(), SID_INSERTDOC);
2710 aRequest.AppendItem(SfxStringItem(SID_INSERTDOC, pMedium->GetOrigURL()));
2711 if(pMedium->GetFilter())
2712 aRequest.AppendItem(SfxStringItem(FN_PARAM_1, pMedium->GetFilter()->GetName()));
2713 aRequest.Done();
2714 }
2715
2716 SfxObjectShellRef aRef( pDocSh );
2717
2718 ErrCode nError = SfxObjectShell::HandleFilter( pMedium.get(), pDocSh );
2719 // #i16722# aborted?
2720 if(nError != ERRCODE_NONE)
2721 {
2722 return -1;
2723 }
2724
2725 pMedium->Download(); // start download if needed
2726 if( aRef.is() && 1 < aRef->GetRefCount() ) // still a valid ref?
2727 {
2728 SwReaderPtr pRdr;
2729 Reader *pRead = pDocSh->StartConvertFrom(*pMedium, pRdr, m_pWrtShell.get());
2730 if( pRead ||
2731 (pMedium->GetFilter()->GetFilterFlags() & SfxFilterFlags::STARONEFILTER) )
2732 {
2733 size_t nUndoCheck = 0;
2734 SwDoc *pDoc = pDocSh->GetDoc();
2735 if( pRead && pDocSh->GetDoc() )
2736 nUndoCheck = lcl_PageDescWithHeader( *pDoc );
2737 ErrCode nErrno;
2738 { //Scope for SwWait-Object, to be able to execute slots
2739 //outside this scope.
2740 SwWait aWait( *GetDocShell(), true );
2741 m_pWrtShell->StartAllAction();
2742 if ( m_pWrtShell->HasSelection() )
2743 m_pWrtShell->DelRight(); // delete selections
2744 if( pRead )
2745 {
2746 nErrno = pRdr->Read( *pRead ); // and insert document
2747 pRdr.reset();
2748 }
2749 else
2750 {
2751 ::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo());
2752 rtl::Reference<SwXTextRange> const xInsertPosition(
2754 *m_pWrtShell->GetCursor()->GetPoint(), nullptr));
2755 nErrno = pDocSh->ImportFrom(*pMedium, xInsertPosition)
2757 }
2758
2759 }
2760
2761 // update all "table of ..." sections if needed
2762 if( m_pWrtShell->IsUpdateTOX() )
2763 {
2764 SfxRequest aReq( FN_UPDATE_TOX, SfxCallMode::SLOT, GetPool() );
2765 Execute( aReq );
2766 m_pWrtShell->SetUpdateTOX( false ); // reset
2767 }
2768
2769 if( pDoc )
2770 { // Disable Undo for .sdw or
2771 // if the number of page styles with header/footer has changed
2772 if( !pRead || nUndoCheck != lcl_PageDescWithHeader( *pDoc ) )
2773 {
2775 }
2776 }
2777
2778 m_pWrtShell->EndAllAction();
2779 if( nErrno )
2780 {
2781 ErrorHandler::HandleError( nErrno );
2782 nFound = nErrno.IsError() ? -1 : 0;
2783 }
2784 else
2785 nFound = 0;
2786 }
2787 }
2788 }
2789 else
2790 {
2791 SfxObjectShellRef xDocSh;
2792 SfxObjectShellLock xLockRef;
2793
2794 const int nRet = SwFindDocShell( xDocSh, xLockRef, pMedium->GetName(), OUString(),
2795 OUString(), nVersion, pDocSh );
2796 if( nRet )
2797 {
2798 SwWait aWait( *GetDocShell(), true );
2799 m_pWrtShell->StartAllAction();
2800
2801 m_pWrtShell->EnterStdMode(); // delete selections
2802
2803 if( bCompare )
2804 nFound = m_pWrtShell->CompareDoc( *static_cast<SwDocShell*>( xDocSh.get() )->GetDoc() );
2805 else
2806 nFound = m_pWrtShell->MergeDoc( *static_cast<SwDocShell*>( xDocSh.get() )->GetDoc() );
2807
2808 m_pWrtShell->EndAllAction();
2809
2810 if (!bCompare && !nFound)
2811 {
2812 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetEditWin().GetFrameWeld(),
2813 VclMessageType::Info, VclButtonsType::Ok,
2814 SwResId(STR_NO_MERGE_ENTRY)));
2815 xInfoBox->run();
2816 }
2817 if( nRet==2 && xDocSh.is() )
2818 xDocSh->DoClose();
2819 }
2820 }
2821
2822 return nFound;
2823}
2824
2826{
2827 m_bInMailMerge = true;
2828 SfxBindings& rBind = GetViewFrame()->GetBindings();
2831}
2832
2833#if HAVE_FEATURE_DBCONNECTIVITY && !ENABLE_FUZZERS
2834
2835namespace
2836{
2837 bool lcl_NeedAdditionalDataSource( const uno::Reference< XDatabaseContext >& _rDatasourceContext )
2838 {
2839 Sequence < OUString > aNames = _rDatasourceContext->getElementNames();
2840
2841 return ( !aNames.hasElements()
2842 || ( ( 1 == aNames.getLength() )
2843 && aNames.getConstArray()[0] == SW_MOD()->GetDBConfig()->GetBibliographySource().sDataSource
2844 )
2845 );
2846 }
2847}
2848
2849#endif
2850
2851void SwView::GenerateFormLetter(bool bUseCurrentDocument)
2852{
2853#if !HAVE_FEATURE_DBCONNECTIVITY || ENABLE_FUZZERS
2854 (void) bUseCurrentDocument;
2855#else
2856 if(bUseCurrentDocument)
2857 {
2859 {
2860 //check availability of data sources (except biblio source)
2861 uno::Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
2862 uno::Reference<XDatabaseContext> xDBContext = DatabaseContext::create(xContext);
2863 bool bCallAddressPilot = false;
2864 if ( lcl_NeedAdditionalDataSource( xDBContext ) )
2865 {
2866 // no data sources are available - create a new one
2867 std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "modules/swriter/ui/datasourcesunavailabledialog.ui"));
2868 std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("DataSourcesUnavailableDialog"));
2869 // no cancel allowed
2870 if (RET_OK != xQuery->run())
2871 return;
2872 bCallAddressPilot = true;
2873 }
2874 else
2875 {
2876 //take an existing data source or create a new one?
2879 if(RET_OK == pConnectionsDlg->Execute())
2880 bCallAddressPilot = !pConnectionsDlg->IsUseExistingConnections();
2881 else
2882 return;
2883
2884 }
2885 if(bCallAddressPilot)
2886 {
2888 SID_ADDRESS_DATA_SOURCE, SfxCallMode::SYNCHRON);
2889 if ( lcl_NeedAdditionalDataSource( xDBContext ) )
2890 // no additional data source has been created
2891 // -> assume that the user has cancelled the pilot
2892 return;
2893 }
2894
2895 //call insert fields with database field page available, only
2896 SfxViewFrame* pVFrame = GetViewFrame();
2897 //at first hide the default field dialog if currently visible
2898 pVFrame->SetChildWindow(FN_INSERT_FIELD, false);
2899 //enable the status of the db field dialog - it is disabled in the status method
2900 //to prevent creation of the dialog without mail merge active
2902 //then show the "Data base only" field dialog
2905 SfxCallMode::SYNCHRON, { &aOn });
2906 return;
2907 }
2908 else
2909 {
2910 OUString sSource;
2911 if(!GetWrtShell().IsFieldDataSourceAvailable(sSource))
2912 {
2913 std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "modules/swriter/ui/warndatasourcedialog.ui"));
2914 std::unique_ptr<weld::MessageDialog> xWarning(xBuilder->weld_message_dialog("WarnDataSourceDialog"));
2915 OUString sTmp(xWarning->get_primary_text());
2916 xWarning->set_primary_text(sTmp.replaceFirst("%1", sSource));
2917 if (RET_OK == xWarning->run())
2918 {
2920 ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateVclDialog( nullptr, SID_OPTIONS_DATABASES ));
2921 pDlg->Execute();
2922 }
2923 return ;
2924 }
2925 }
2926 SwDBManager* pDBManager = GetWrtShell().GetDBManager();
2927
2929 SwWrtShell &rSh = GetWrtShell();
2930
2931 std::vector<OUString> aDBNameList;
2932 std::vector<OUString> aAllDBNames;
2933 rSh.GetAllUsedDB( aDBNameList, &aAllDBNames );
2934 if(!aDBNameList.empty())
2935 {
2936 OUString sDBName(aDBNameList[0]);
2937 sal_Int32 nIdx {0};
2938 aData.sDataSource = sDBName.getToken(0, DB_DELIM, nIdx);
2939 aData.sCommand = sDBName.getToken(0, DB_DELIM, nIdx);
2940 aData.nCommandType = o3tl::toInt32(o3tl::getToken(sDBName, 0, DB_DELIM, nIdx));
2941 }
2942 rSh.EnterStdMode(); // force change in text shell; necessary for mixing DB fields
2943 AttrChangedNotify(nullptr);
2944
2945 if (pDBManager)
2946 {
2947 Sequence<PropertyValue> aProperties
2948 {
2949 comphelper::makePropertyValue("DataSourceName", aData.sDataSource),
2950 comphelper::makePropertyValue("Command", aData.sCommand),
2951 comphelper::makePropertyValue("CommandType", aData.nCommandType),
2952 };
2954 }
2955 }
2956 else
2957 {
2958 // call documents and template dialog
2959 SfxApplication* pSfxApp = SfxGetpApp();
2960 weld::Window* pTopWin = pSfxApp->GetTopWindow();
2961
2962 SfxTemplateManagerDlg aDocTemplDlg(GetFrameWeld());
2963 int nRet = aDocTemplDlg.run();
2964 bool bNewWin = false;
2965 if ( nRet == RET_OK )
2966 {
2967 if ( pTopWin != pSfxApp->GetTopWindow() )
2968 {
2969 // the dialogue opens a document -> a new TopWindow appears
2970 pTopWin = pSfxApp->GetTopWindow();
2971 bNewWin = true;
2972 }
2973 }
2974
2975 if (bNewWin)
2976 {
2977 // after the destruction of the dialogue its parent comes to top,
2978 // but we want that the new document is on top
2979 pTopWin->present();
2980 }
2981 }
2982#endif
2983}
2984
2985IMPL_LINK( SwView, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, void )
2986{
2987 if ( ERRCODE_NONE != _pFileDlg->GetError() )
2988 return;
2989
2990 std::unique_ptr<SfxMedium> pMed = m_pViewImpl->CreateMedium();
2991 if ( !pMed )
2992 {
2993 std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetEditWin().GetFrameWeld(),
2994 VclMessageType::Info, VclButtonsType::Ok,
2995 SwResId(RID_SVXSTR_TXTFILTER_FILTERERROR)));
2996 xInfoBox->run();
2997 return;
2998 }
2999
3000 const sal_uInt16 nSlot = m_pViewImpl->GetRequest()->GetSlot();
3001 tools::Long nFound = InsertMedium( nSlot, std::move(pMed), m_pViewImpl->GetParam() );
3002
3003 if ( SID_INSERTDOC == nSlot )
3004 {
3005 if ( m_pViewImpl->GetParam() == 0 )
3006 {
3007 m_pViewImpl->GetRequest()->SetReturnValue( SfxBoolItem( nSlot, nFound != -1 ) );
3008 m_pViewImpl->GetRequest()->Ignore();
3009 }
3010 else
3011 {
3012 m_pViewImpl->GetRequest()->SetReturnValue( SfxBoolItem( nSlot, nFound != -1 ) );
3013 m_pViewImpl->GetRequest()->Done();
3014 }
3015 }
3016 else if ( SID_DOCUMENT_COMPARE == nSlot || SID_DOCUMENT_MERGE == nSlot )
3017 {
3018 m_pViewImpl->GetRequest()->SetReturnValue( SfxInt32Item( nSlot, nFound ) );
3019
3020 if ( nFound > 0 ) // show Redline browser
3021 {
3022 SfxViewFrame* pVFrame = GetViewFrame();
3024
3025 // re-initialize Redline dialog
3026 sal_uInt16 nId = SwRedlineAcceptChild::GetChildWindowId();
3027 SwRedlineAcceptChild* pRed = static_cast<SwRedlineAcceptChild*>(pVFrame->GetChildWindow( nId ));
3028 if ( pRed )
3029 pRed->ReInitDlg( GetDocShell() );
3030 }
3031 }
3032}
3033
3035{
3036 if (m_pViewImpl)
3037 m_pViewImpl->ExecuteScan(rReq) ;
3038}
3039
3040const OUString& SwView::GetOldGrfCat()
3041{
3042 return GetCachedString(OldGrfCat);
3043}
3044
3045void SwView::SetOldGrfCat(const OUString& sStr)
3046{
3048}
3049
3050const OUString& SwView::GetOldTabCat()
3051{
3052 return GetCachedString(OldTabCat);
3053}
3054
3055void SwView::SetOldTabCat(const OUString& sStr)
3056{
3058}
3059
3060const OUString& SwView::GetOldFrameCat()
3061{
3063}
3064
3065void SwView::SetOldFrameCat(const OUString& sStr)
3066{
3068}
3069
3070const OUString& SwView::GetOldDrwCat()
3071{
3072 return GetCachedString(OldDrwCat);
3073}
3074
3075void SwView::SetOldDrwCat(const OUString& sStr)
3076{
3078}
3079
3080
3081/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@ On
RedlineFlags on.
@ NONE
no RedlineFlags
@ GRAPHIC_CAP
@ UndoArg1
Definition: SwRewriter.hxx:29
PropertiesInfo aProperties
const char * pName
SfxApplication * SfxGetpApp()
Reference< XExecutableDialog > m_xDialog
#define GetWhich(nSlot)
const LocaleDataWrapper & GetUILocaleDataWrapper() const
static const AllSettings & GetSettings()
static std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, bool bMobile=false)
static bool IsHeadlessModeEnabled()
sal_uInt16 GetValue() const
sal_uInt32 GetValue() const
const OUString & GetValue() const
bool IsError() const
static DialogMask HandleError(ErrCode nId, weld::Window *pParent=nullptr, DialogMask nMask=DialogMask::MAX)
static GraphicFilter & GetGraphicFilter()
static ErrCode LoadGraphic(const OUString &rPath, const OUString &rFilter, Graphic &rGraphic, GraphicFilter *pFilter=nullptr, sal_uInt16 *pDeterminedFormat=nullptr)
Degree10 getRotation() const
bool read(Graphic const &rGraphic)
void rotate(Degree10 aRotation)
void setOriginURL(OUString const &rOriginURL)
wrapper iterator: wraps iterator of implementation while hiding MarkBase class; only IMark instances ...
Provides access to the marks of a document.
virtual const_iterator_t getBookmarksBegin() const =0
returns a STL-like random access iterator to the begin of the sequence the IBookmarks.
virtual const_iterator_t getAllMarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of marks.
virtual const_iterator_t findMark(const OUString &rMark) const =0
Finds a mark by name.
virtual int getOutlineLevel(const tSortedOutlineNodeList::size_type nIdx) const =0
virtual void SetRedlinePassword(const css::uno::Sequence< sal_Int8 > &rNewPassword)=0
virtual const SwRedlineTable & GetRedlineTable() const =0
virtual const SwRangeRedline * GetRedline(const SwPosition &rPos, SwRedlineTable::size_type *pFndPos) const =0
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
virtual const css::uno::Sequence< sal_Int8 > & GetRedlinePassword() const =0
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
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...
virtual void DelAllUndoObj()=0
Delete all Undo actions.
static OUString decode(std::u16string_view rText, DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
static css::uno::Reference< css::linguistic2::XDictionary > GetIgnoreAllList()
OUString getNum(sal_Int64 nNumber, sal_uInt16 nDecimals, bool bUseThousandSep=true, bool bTrailingZeros=true) const
void disposeAndReset(reference_type *pBody)
SdrHdl * GetFocusHdl() const
SdrHdl * GetHdl(size_t nNum) const
SdrHdlKind GetKind() const
bool AreObjectsMarked() const
const SdrHdlList & GetHdlList() const
bool MoveShapeHandle(const sal_uInt32 handleNum, const Point &aEndPoint, const sal_Int32 aObjectOrdNum=-1)
static SfxAbstractDialogFactory * Create()
void NotifyEvent(const SfxEventHint &rEvent, bool bSynchron=true)
weld::Window * GetTopWindow() const
void Update(sal_uInt16 nId)
void Invalidate(sal_uInt16 nId)
const css::uno::Reference< css::frame::XDispatchRecorder > & GetRecorder() const
bool GetValue() const
SfxDialogController(weld::Widget *pParent, const OUString &rUIFile, const OString &rDialogId)
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
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 * >())
std::shared_ptr< const SfxFilter > GetFilter4FilterName(const OUString &rName, SfxFilterFlags nMust=SfxFilterFlags::NONE, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
OUString const & GetName() const
ErrCode GuessFilter(SfxMedium &rMedium, std::shared_ptr< const SfxFilter > &, SfxFilterFlags nMust=SfxFilterFlags::IMPORT, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
sal_uInt16 Count() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void DisableItem(sal_uInt16 nWhich)
const INetURLObject & GetURLObject() const
SfxFilterContainer * GetFilterContainer() const
virtual bool ImportFrom(SfxMedium &rMedium, css::uno::Reference< css::text::XTextRange > const &xInsertPosition)
bool HasName() const
virtual SfxObjectFactory & GetFactory() const=0
SfxMedium * GetMedium() const
bool IsInPlaceActive() const
static ErrCode HandleFilter(SfxMedium *pMedium, SfxObjectShell const *pDoc)
OUString GetPassword() const
virtual short run() override
void SetMinLen(sal_uInt16 Len)
void ShowExtras(SfxShowExtras nExtras)
sal_uInt16 GetSlot() const
void Ignore()
const SfxItemSet * GetArgs() const
const T * GetArg(sal_uInt16 nSlotId) const
void AppendItem(const SfxPoolItem &)
void SetReturnValue(const SfxPoolItem &)
void Done(bool bRemove=false)
SfxItemPool & GetPool() const
const OUString & GetName() const
virtual bool IsConditionalFastCall(const SfxRequest &rReq)
SfxViewFrame * GetFrame() const
const SfxPoolItem * ExecuteSlot(SfxRequest &rReq, const SfxInterface *pIF=nullptr)
virtual short run() override
void ToggleChildWindow(sal_uInt16)
SfxBindings & GetBindings()
bool HasChildWindow(sal_uInt16)
void SetChildWindow(sal_uInt16 nId, bool bVisible, bool bSetFocus=true)
static SfxViewFrame * GetNext(const SfxViewFrame &rPrev, const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
SfxDispatcher * GetDispatcher()
SfxChildWindow * GetChildWindow(sal_uInt16)
static SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
weld::Window * GetFrameWeld() const
void ShowChildWindow(sal_uInt16, bool bVisible=true)
void ChildWindowExecute(SfxRequest &)
weld::Window * GetFrameWeld() const
static SfxViewShell * Get(const css::uno::Reference< css::frame::XController > &i_rController)
SfxViewFrame * GetViewFrame() const
virtual SfxObjectShell * GetObjectShell() override
virtual void libreOfficeKitViewCallback(int nType, const char *pPayload) const override
sal_uInt16 FirstWhich()
sal_uInt16 NextWhich()
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
tools::Long AdjustWidth(tools::Long n)
constexpr tools::Long Width() const
static SVL_DLLPUBLIC void GetHashPassword(css::uno::Sequence< sal_Int8 > &rPassHash, const char *pPass, sal_uInt32 nLen)
static SVL_DLLPUBLIC bool CompareHashPassword(const css::uno::Sequence< sal_Int8 > &rOldPassHash, std::u16string_view sNewPass)
virtual VclPtr< AbstractSvxZoomDialog > CreateSvxZoomDialog(weld::Window *pParent, const SfxItemSet &rCoreSet)=0
static SvxAbstractDialogFactory * Create()
tools::Long GetRight() const
tools::Long GetLeft() const
LanguageType GetLanguage() const
static void SetSearchLabel(const SearchLabel &rSL)
tools::Long GetWidth() const
bool IsBookMode() const
void SetValueSet(SvxZoomEnableFlags nValues)
SvxZoomType GetType() const
void AddSnappingPoint(sal_Int32 nNew)
virtual VclPtr< AbstractMailMergeCreateFromDlg > CreateMailMergeCreateFromDlg(weld::Window *pParent)=0
virtual VclPtr< VclAbstractDialog > CreateVclSwViewDialog(SwView &rView)=0
virtual VclPtr< AbstractMailMergeFieldConnectionsDlg > CreateMailMergeFieldConnectionsDlg(weld::Window *pParent)=0
static SwAbstractDialogFactory * Create()
Definition: swabstdlg.cxx:36
static void SetFrameMode_(FlyMode eMode)
Definition: basesh.hxx:113
static FlyMode GetFrameMode()
Definition: basesh.hxx:114
void ExtendedSelectAll(bool bFootnotes=true)
Definition: crsrsh.cxx:594
static void FireSectionChangeEvent(sal_uInt16 nOldSection, sal_uInt16 nNewSection)
Definition: crsrsh.cxx:457
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2251
OUString GetBoxNms() const
Definition: trvltbl.cxx:743
void StartAction()
Definition: crsrsh.cxx:226
const SwTableNode * IsCursorInTable() const
Definition: crsrsh.hxx:909
static void FirePageChangeEvent(sal_uInt16 nOldPage, sal_uInt16 nNewPage)
Definition: crsrsh.cxx:435
static void FireColumnChangeEvent(sal_uInt16 nOldColumn, sal_uInt16 nNewColumn)
Definition: crsrsh.cxx:446
bool bColumnChange()
Definition: crsrsh.cxx:468
void EndAction(const bool bIdleEnd=false)
Definition: crsrsh.cxx:243
SwOutlineNodes::size_type GetOutlinePos(sal_uInt8 nLevel=UCHAR_MAX, SwPaM *pPaM=nullptr)
search "outline position" before previous outline node at given level
Definition: crstrvl.cxx:1188
bool HasReadonlySel(bool isReplace=false) const
Definition: crsrsh.cxx:3359
bool IsTableMode() const
Definition: crsrsh.hxx:659
sal_uInt16 GetPageCnt()
Definition: crsrsh.cxx:1291
void ExecuteFormLetter(SwWrtShell &rSh, const css::uno::Sequence< css::beans::PropertyValue > &rProperties)
Definition: dbmgr.cxx:2925
static OUString GetEventName(sal_Int32 nId)
Definition: docsh.cxx:1329
virtual void SetChangeRecording(bool bActivate, bool bLockAllViews=false) override
Definition: docsh.cxx:1357
Reader * StartConvertFrom(SfxMedium &rMedium, SwReaderPtr &rpRdr, SwCursorShell const *pCursorSh=nullptr, SwPaM *pPaM=nullptr)
For inserting document.
Definition: docsh.cxx:137
SwDoc * GetDoc()
returns Doc. But be careful!
Definition: docsh.hxx:204
Definition: doc.hxx:194
std::unique_ptr< sw::OnlineAccessibilityCheck > const & getOnlineAccessibilityCheck() const
Definition: doc.hxx:1567
SwFrameFormat * MakeFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom, bool bBroadcast=false, bool bAuto=true)
Definition: docfmt.cxx:820
size_t GetPageDescCnt() const
Definition: doc.hxx:888
void SpellItAgainSam(bool bInvalid, bool bOnlyWrong, bool bSmartTags)
Re-trigger spelling in the idle handler.
Definition: doc.cxx:1166
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:150
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:341
static void CalculateNonBlankPages(const SwRootFrame &rLayout, sal_uInt16 &nDocPageCount, sal_uInt16 &nActualPage)
Definition: doc.cxx:648
::sw::DocumentRedlineManager const & GetDocumentRedlineManager() const
Definition: doc.cxx:351
const SwFrameFormats * GetFrameFormats() const
Definition: doc.hxx:746
css::uno::Reference< css::linguistic2::XProofreadingIterator > const & GetGCIterator() const
Definition: docnew.cxx:123
const SwFrameFormat * GetDfltFrameFormat() const
Definition: doc.hxx:755
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:889
IDocumentStatistics const & getIDocumentStatistics() const
Definition: doc.cxx:379
SwFrameFormat * FindFrameFormatByName(const OUString &rName) const
Definition: docfmt.cxx:745
void BreakCreate()
Definition: drawbase.cxx:469
void CountWords(SwDocStat &rStat) const
Count words in current selection.
Definition: editsh.cxx:1081
const SwTOXBase * GetCurTOX() const
Get current listing before or at the Cursor.
Definition: edtox.cxx:191
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
Definition: edattr.cxx:171
bool IsRedlineOn() const
Definition: edredln.cxx:43
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
Definition: edws.cxx:223
SwDBManager * GetDBManager() const
For evaluation of DB fields (new DB-manager).
Definition: edfld.cxx:328
SwFrameFormat * GetTableFormat()
Definition: edws.cxx:183
const SwSection * GetCurrSection() const
Definition: edsect.cxx:71
bool IsAnyDatabaseFieldInDoc() const
Definition: edfld.cxx:383
sal_uInt8 GetNumLevel() const
Definition: ednumber.cxx:669
int GetCurrentParaOutlineLevel() const
Get Outline level of current paragraph.
Definition: ednumber.cxx:377
SwDBData const & GetDBData() const
Database information.
Definition: edfld.cxx:291
const SwNumRule * GetNumRuleAtCurrCursorPos() const
Definition: ednumber.cxx:694
void GetAllUsedDB(std::vector< OUString > &rDBNameList, std::vector< OUString > const *pAllDBNames)
Definition: edfld.cxx:301
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
Definition: edws.cxx:234
void ResetAttr(const o3tl::sorted_vector< sal_uInt16 > &attrs=o3tl::sorted_vector< sal_uInt16 >(), SwPaM *pCursor=nullptr)
Definition: edatmisc.cxx:32
void ReRead(const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic=nullptr)
Re-read if graphic is not ok. Current graphic is replaced by the new one.
Definition: editsh.cxx:294
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:61
void SetApplyTemplate(const SwApplyTemplate &)
Apply template.
Definition: edtwin.cxx:5266
void InsFrame(sal_uInt16 nCols)
Insert mode for frames.
Definition: edtwin.cxx:726
void SetUseInputLanguage(bool bNew)
#i42732# display status of font size/name depending on either the input language or the selection pos...
Definition: edtwin.cxx:6593
void SetChainMode(bool bOn)
Definition: edtwin.cxx:6172
void ToggleOutlineContentVisibility(const size_t nOutlinePos, const bool bSubs)
Definition: edtwin.cxx:6803
Point GetAnchorObjDiff() const
Methods for status line.
Definition: feshview.cxx:2403
void SetFrameFormat(SwFrameFormat *pFormat, bool bKeepOrient=false, Point const *pDocPos=nullptr)
If frame then set frame style.
Definition: fefly1.cxx:1223
bool IsFrameSelected() const
Definition: feshview.cxx:1253
Size GetObjSize() const
Definition: feshview.cxx:2390
size_t IsObjSelected() const
Definition: feshview.cxx:1245
void InsertFlyFrame()
Definition: frmmgr.cxx:189
void SetSize(const Size &rLSize)
Definition: frmmgr.cxx:612
void SetCol(const SwFormatCol &rCol)
Definition: frmmgr.cxx:244
const Size & GetSize() const
Definition: frmmgr.hxx:138
sal_uInt16 GetGutterWidth(bool bMin=false) const
Definition: atrfrm.cxx:918
sal_uInt16 GetWishWidth() const
Definition: fmtclds.hxx:122
void Init(sal_uInt16 nNumCols, sal_uInt16 nGutterWidth, sal_uInt16 nAct)
This function allows to (repeatedly) initialize the columns.
Definition: atrfrm.cxx:969
Footer, for pageformats Client of FrameFormat describing the footer.
Definition: fmthdft.hxx:65
bool IsActive() const
Definition: fmthdft.hxx:89
Header, for PageFormats Client of FrameFormat describing the header.
Definition: fmthdft.hxx:34
bool IsActive() const
Definition: fmthdft.hxx:58
const SwTextINetFormat * GetTextINetFormat() const
Definition: fmtinfmt.hxx:70
bool IsDefault() const
Definition: format.hxx:129
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
const SvxLRSpaceItem & GetLRSpace(bool=true) const
Definition: frmatr.hxx:74
const OUString & GetName() const
Definition: format.hxx:131
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:136
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:447
bool IsAuto() const
Query / set AutoFormat-flag.
Definition: format.hxx:178
Style of a layout element.
Definition: frmfmt.hxx:62
size_t size() const
Base class of the Writer layout elements.
Definition: frame.hxx:315
sal_uInt16 GetPhyPageNum() const
Definition: trvlfrm.cxx:1706
sal_uInt16 GetPageSelection() const
Definition: gotodlg.hxx:33
static void ShowDBObj(SwView const &rView, const SwDBData &rData)
Definition: swmodul1.cxx:368
SwTableBox * GetTableBox() const
If node is in a table return the respective table box.
Definition: node.cxx:777
bool IsAutoRule() const
Definition: numrule.hxx:229
bool IsOutlineRule() const
Definition: numrule.hxx:241
static constexpr auto npos
Definition: ndarr.hxx:81
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:187
const SwPosition * Start() const
Definition: pam.hxx:266
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:259
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:238
bool HasNotes() const
Definition: PostItMgr.cxx:2122
bool ShowNotes() const
Definition: PostItMgr.cxx:2116
void ToggleInsModeOnActiveSidebarWin()
Definition: PostItMgr.cxx:2421
tools::ULong GetSidebarWidth(bool bPx=false) const
Definition: PostItMgr.cxx:2127
tools::ULong GetSidebarBorderWidth(bool bPx=false) const
Definition: PostItMgr.cxx:2153
SW_DLLPUBLIC bool HasActiveSidebarWin() const
Definition: PostItMgr.cxx:2378
sal_uInt32 GetId() const
Definition: redline.hxx:188
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
void SSize(const Size &rNew)
Definition: swrect.hxx:180
virtual bool ReInitDlg(SwDocShell *pDocSh) override
Definition: redlndlg.cxx:72
static constexpr size_type npos
Definition: docary.hxx:223
size_type size() const
Definition: docary.hxx:267
vector_type::size_type size_type
Definition: docary.hxx:222
void AddRule(SwUndoArg eWhat, const OUString &rWith)
Definition: SwRewriter.cxx:25
const OUString & GetSectionName() const
Definition: section.hxx:169
SectionType GetType() const
Definition: section.hxx:171
Represents the current text cursor of one opened edit window.
Definition: viscrs.hxx:140
const Point & GetPtPos() const
Definition: viscrs.hxx:165
const Point & GetMkPos() const
Definition: viscrs.hxx:167
static const std::vector< OUString > & GetFrameFormatUINameArray()
const OUString & GetTOXName() const
Definition: tox.hxx:481
TOXTypes GetType() const
Definition: tox.hxx:722
void SetAlternativeText(const OUString &rAlt)
Definition: tox.hxx:582
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:426
SwTableLine * GetUpper()
Definition: swtable.hxx:460
SwRedlineTable::size_type UpdateTextChangesOnly(SwRedlineTable::size_type &rRedlinePos, bool bUpdateProperty=true) const
Definition: swtable.cxx:1618
sal_uInt16 GetGapBetweenPages() const
Definition: viewopt.hxx:565
bool IsViewLayoutBookMode() const
Definition: viewopt.hxx:587
SvxZoomType GetZoomType() const
Definition: viewopt.hxx:654
sal_uInt16 GetZoom() const
Definition: viewopt.hxx:613
sal_uInt16 GetViewLayoutColumns() const
Definition: viewopt.hxx:589
bool getBrowseMode() const
Definition: viewopt.hxx:580
sal_uInt16 GetDocumentBorder() const
Definition: viewopt.hxx:564
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:433
void UnlockPaint(bool bVirDev=false)
Definition: viewsh.hxx:619
const IDocumentSettingAccess & getIDocumentSettingAccess() const
Provides access to the document setting interface.
Definition: viewsh.cxx:2803
const IDocumentMarkAccess * getIDocumentMarkAccess() const
Provides access to the document bookmark interface.
Definition: viewsh.cxx:2807
void LockPaint()
Definition: viewsh.hxx:614
SwDoc * GetDoc() const
Definition: viewsh.hxx:290
void LockView(bool b)
Definition: viewsh.hxx:472
const IDocumentOutlineNodes * getIDocumentOutlineNodesAccess() const
Definition: viewsh.cxx:2830
void ExecuteScan(SfxRequest &rReq)
Definition: uivwimp.cxx:100
Definition: view.hxx:146
@ OldTabCat
Definition: view.hxx:673
@ OldFrameCat
Definition: view.hxx:674
@ OldDrwCat
Definition: view.hxx:675
@ OldGrfCat
Definition: view.hxx:672
void EnableMailMerge()
Definition: view2.cxx:2825
SAL_DLLPRIVATE bool PageDownCursor(bool bSelect)
Definition: viewport.cxx:657
void ExecuteStatusLine(SfxRequest &)
execute method for the status line
Definition: view2.cxx:2086
void AutoCaption(const sal_uInt16 nType, const SvGlobalName *pOleId=nullptr)
Definition: viewdlg2.cxx:183
tools::Long InsertDoc(sal_uInt16 nSlotId, const OUString &rFileName, const OUString &rFilterName, sal_Int16 nVersion=0)
Definition: view2.cxx:2645
void EditLinkDlg()
show "edit link" dialog
Definition: view2.cxx:2351
SwWrtShell & GetWrtShell() const
Definition: view.hxx:416
void SetCachedString(CachedStringID id, const OUString &sStr)
Definition: view.hxx:686
SfxShell * m_pShell
Definition: view.hxx:197
std::unique_ptr< SwView_Impl > m_pViewImpl
Definition: view.hxx:200
std::unique_ptr< SwWrtShell > m_pWrtShell
Definition: view.hxx:194
bool m_bTopCursor
Definition: view.hxx:240
void SetOldDrwCat(const OUString &sStr)
Definition: view2.cxx:3075
void SetOldFrameCat(const OUString &sStr)
Definition: view2.cxx:3065
tools::Rectangle m_aVisArea
Definition: view.hxx:191
void ExecuteInsertDoc(SfxRequest &rRequest, const SfxPoolItem *pItem)
Definition: view2.cxx:2617
void Execute(SfxRequest &)
Definition: view2.cxx:605
OUString GetPageStr(sal_uInt16 nPhyNum, sal_uInt16 nVirtNum, const OUString &rPgStr)
Create string for showing the page number in the statusbar.
Definition: view2.cxx:267
sal_uInt16 m_nPageCnt
Definition: view.hxx:222
void SetViewLayout(sal_uInt16 nColumns, bool bBookMode, bool bViewOnly=false)
Definition: viewmdi.cxx:224
const tools::Rectangle & GetVisArea() const
Definition: view.hxx:429
void UpdateDocStats()
Definition: view2.cxx:1612
bool JumpToSwMark(std::u16string_view rMark)
Definition: view2.cxx:2452
OUString m_sOldSectionName
Definition: view.hxx:185
const OUString & GetOldGrfCat()
Definition: view2.cxx:3040
SwPostItMgr * GetPostItMgr()
Definition: view.hxx:642
SelectCycle m_aSelectCycle
Definition: view.hxx:267
bool m_bCenterCursor
Definition: view.hxx:239
void ExecuteScan(SfxRequest &rReq)
Definition: view2.cxx:3034
SelectionType m_nSelectionType
Definition: view.hxx:221
void GenerateFormLetter(bool bUseCurrentDocument)
Definition: view2.cxx:2851
bool m_bMakeSelectionVisible
Definition: view.hxx:259
SAL_DLLPRIVATE bool PageUpCursor(bool bSelect)
Definition: viewport.cxx:631
SwWrtShell * GetWrtShellPtr() const
Definition: view.hxx:417
SwDrawBase * GetDrawFuncPtr() const
Definition: view.hxx:529
SwEditWin & GetEditWin()
Definition: view.hxx:419
void SetOldTabCat(const OUString &sStr)
Definition: view2.cxx:3055
const OUString & GetCachedString(CachedStringID id)
Definition: view.hxx:681
void SetOldGrfCat(const OUString &sStr)
Definition: view2.cxx:3045
const OUString & GetOldFrameCat()
Definition: view2.cxx:3060
void UpdatePageNums()
invalidate page numbering field
Definition: view2.cxx:1606
void SetCursorAtTop(bool bFlag, bool bCenter=false)
Definition: view.hxx:592
sal_uInt16 m_nOldPageNum
Definition: view.hxx:184
virtual bool IsConditionalFastCall(const SfxRequest &rReq) override
Definition: view2.cxx:1591
SwDocShell * GetDocShell()
Definition: view.cxx:1160
SwView_Impl * GetViewImpl()
Definition: view.hxx:351
void StateStatusLine(SfxItemSet &)
get status of the status line
Definition: view2.cxx:1620
SAL_DLLPRIVATE bool InsertGraphicDlg(SfxRequest &)
Definition: view2.cxx:366
bool m_bInMailMerge
Definition: view.hxx:255
const OUString & GetOldDrwCat()
Definition: view2.cxx:3070
void SetVisArea(const tools::Rectangle &, bool bUpdateScrollbar=true)
Definition: viewport.cxx:198
bool IsDrawMode() const
Definition: view.hxx:542
void InsFrameMode(sal_uInt16 nCols)
Definition: view2.cxx:2326
void InvalidateRulerPos()
Definition: viewport.cxx:107
void LeaveDrawCreate()
Definition: view.hxx:541
const OUString & GetOldTabCat()
Definition: view2.cxx:3050
SAL_DLLPRIVATE Point AlignToPixel(const Point &rPt) const
Definition: viewport.cxx:147
static void SetMoveType(sal_uInt16 nSet)
Definition: viewmdi.cxx:712
tools::Long InsertMedium(sal_uInt16 nSlotId, std::unique_ptr< SfxMedium > pMedium, sal_Int16 nVersion)
Definition: view2.cxx:2685
void SetZoom(SvxZoomType eZoomType, short nFactor=100, bool bViewOnly=false)
Definition: viewmdi.cxx:73
ErrCode InsertGraphic(const OUString &rPath, const OUString &rFilter, bool bLink, GraphicFilter *pFlt)
Definition: view2.cxx:298
void SetCounts(const SwDocStat &rCurrCnt, const SwDocStat &rDocStat)
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
void EnterBlockMode()
Definition: select.cxx:651
OUString const & GetCurPageStyle() const
Definition: wrtsh1.cxx:1871
bool IsStdMode() const
Definition: wrtsh.hxx:153
void ToggleBlockMode()
Definition: select.cxx:764
void EnterExtMode()
Definition: select.cxx:584
void ToggleInsMode()
Definition: wrtsh.hxx:171
void MakeOutlineLevelsVisible(const int nLevel)
Definition: wrtsh1.cxx:2366
bool GotoPage(sal_uInt16 nPage, bool bRecord)
Definition: move.cxx:573
void GotoMark(const ::sw::mark::IMark *const pMark)
Definition: wrtsh3.cxx:273
SelectionType GetSelectionType() const
Definition: wrtsh1.cxx:1706
void InsertGraphic(const OUString &rPath, const OUString &rFilter, const Graphic &, SwFlyFrameAttrMgr *=nullptr, RndStdIds nAnchorType=RndStdIds::FLY_AT_PARA)
Definition: wrtsh1.cxx:275
void EnterStdMode()
Definition: select.cxx:551
bool IsBlockMode() const
Definition: wrtsh.hxx:168
void SelAll()
Definition: select.cxx:123
bool HasSelection() const
Definition: wrtsh.hxx:147
bool IsInsMode() const
Definition: wrtsh.hxx:172
void ToggleAddMode()
Definition: select.cxx:758
bool IsAddMode() const
Definition: wrtsh.hxx:163
void ToggleExtMode()
Definition: select.cxx:770
void EnterAddMode()
Definition: select.cxx:626
bool Pop(SwCursorShell::PopMode, ::std::optional< SwCallLink > &roLink)
Definition: wrtsh1.cxx:2030
static rtl::Reference< SwXTextRange > CreateXTextRange(SwDoc &rDoc, const SwPosition &rPos, const SwPosition *const pMark)
Definition: unoobj2.cxx:1210
static bool IsModifyPasswordCorrect(std::u16string_view aPassword, const css::uno::Sequence< css::beans::PropertyValue > &aInfo)
static css::uno::Sequence< css::beans::PropertyValue > ConvertPasswordInfo(const css::uno::Sequence< css::beans::PropertyValue > &aInfo)
static void ShowPanel(std::u16string_view rsPanelId, const css::uno::Reference< css::frame::XFrame > &rxFrame, bool bFocus=false)
constexpr tools::Long Left() const
constexpr bool IsEmpty() const
T * get() const
bool is() const
Size GetOutputSizePixel() const
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
virtual short run()
virtual css::uno::Reference< css::awt::XWindow > GetXWindow()=0
virtual void present()=0
#define FN_SET_BLOCK_MODE
Definition: cmdid.h:724
#define FN_UPDATE_TOX
Definition: cmdid.h:519
#define FN_REDLINE_ACCEPT_DIRECT
Definition: cmdid.h:141
#define FN_ESCAPE
Definition: cmdid.h:693
#define FN_OUTLINE_LEVELS_SHOWN
Definition: cmdid.h:198
#define FN_EDIT_LINK_DLG
Definition: cmdid.h:78
#define FN_TO_PREV_PAGE
Definition: cmdid.h:748
#define FN_TO_NEXT_PAGE
Definition: cmdid.h:747
#define FN_NAV_ELEMENT
Definition: cmdid.h:183
#define FN_EDIT_REGION
Definition: cmdid.h:115
#define FN_STAT_TEMPLATE
Definition: cmdid.h:846
#define FN_FORMAT_FRAME_DLG
Definition: cmdid.h:335
#define FN_QRY_MERGE
Definition: cmdid.h:243
#define FN_STAT_PAGE
Definition: cmdid.h:845
#define FN_STAT_BOOKMARK
Definition: cmdid.h:849
#define FN_STAT_WORDCOUNT
Definition: cmdid.h:850
#define FN_EDIT_CURRENT_TOX
Definition: cmdid.h:136
#define FN_STAT_SELMODE
Definition: cmdid.h:848
#define FN_REDLINE_REJECT_DIRECT
Definition: cmdid.h:142
#define FN_FORMAT_TABLE_DLG
Definition: cmdid.h:337
#define FN_LINE_NUMBERING_DLG
Definition: cmdid.h:501
#define FN_SET_EXT_MODE
Definition: cmdid.h:692
#define FN_NUMBER_BULLETS
Definition: cmdid.h:80
#define FN_SELECTION_CYCLE
Definition: cmdid.h:749
#define FN_REDLINE_NEXT_CHANGE
Definition: cmdid.h:145
#define FN_REDLINE_PREV_CHANGE
Definition: cmdid.h:146
#define FN_REDLINE_ACCEPT_TONEXT
Definition: cmdid.h:149
#define FN_SYNC_LABELS
Definition: cmdid.h:478
#define FN_INSERT_FIELD
Definition: cmdid.h:205
#define FN_UPDATE_CUR_TOX
Definition: cmdid.h:520
#define FN_WORDCOUNT_DIALOG
Definition: cmdid.h:608
#define FN_STAT_ACCESSIBILITY_CHECK
Definition: cmdid.h:851
#define FN_INSERT_FIELD_DATA_ONLY
Definition: cmdid.h:217
#define FN_GOTO_PAGE
Definition: cmdid.h:523
#define FN_SPELL_GRAMMAR_DIALOG
Definition: cmdid.h:618
#define FN_PARAM_FTN_INFO
Definition: cmdid.h:789
#define FN_INSERT_MULTI_TOX
Definition: cmdid.h:296
#define FN_FORMAT_PAGE_DLG
Definition: cmdid.h:332
#define FN_MAILMERGE_SENDMAIL_CHILDWINDOW
Definition: cmdid.h:282
#define FN_PAGEUP
Definition: cmdid.h:689
#define FN_REDLINE_REJECT_TONEXT
Definition: cmdid.h:150
#define FN_REDLINE_ACCEPT
Definition: cmdid.h:134
#define FN_REDLINE_SHOW
Definition: cmdid.h:129
#define FN_PAGEDOWN
Definition: cmdid.h:690
#define FN_SET_ADD_MODE
Definition: cmdid.h:691
#define FN_SCROLL_NEXT
Definition: cmdid.h:185
#define FN_TOGGLE_OUTLINE_CONTENT_VISIBILITY
Definition: cmdid.h:192
#define FN_SCROLL_PREV
Definition: cmdid.h:184
IMPL_LINK_NOARG(SwContentControlButton, PopupModeEndHdl, weld::Popover &, void)
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Definition: dialoghelp.cxx:19
DECL_LINK(CheckNameHdl, SvxNameDialog &, bool)
virtual SfxBindings & GetBindings() override
virtual sal_uInt32 GetId() const override
int SwFindDocShell(SfxObjectShellRef &xDocSh, SfxObjectShellLock &xLockRef, std::u16string_view 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:1697
std::unique_ptr< SwReader, o3tl::default_delete< SwReader > > SwReaderPtr
Definition: docsh.hxx:44
float u
#define max(a, b)
#define ERRCODE_NONE
sal_Int16 nVersion
@ PageCalc
... page will be formatted if required.
@ PagesArea
Rect covering the pages area.
#define SW_LEAVE_FRAME
Definition: fesh.hxx:168
FlyCntType
Definition: flyenum.hxx:24
@ FLYCNTTYPE_GRF
Definition: flyenum.hxx:27
@ FLYCNTTYPE_OLE
Definition: flyenum.hxx:28
@ FLYCNTTYPE_FRM
Definition: flyenum.hxx:26
@ FLYCNTTYPE_ALL
Definition: flyenum.hxx:25
DocumentType eType
sal_Int16 nValue
#define ERRCODE_GRFILTER_OPENERROR
#define ERRCODE_GRFILTER_TOOBIG
#define ERRCODE_GRFILTER_FORMATERROR
#define ERRCODE_GRFILTER_FILTERERROR
#define ERRCODE_GRFILTER_IOERROR
#define ERRCODE_GRFILTER_VERSIONERROR
constexpr TypedWhichId< SwFormatHeader > RES_HEADER(96)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CTL_LANGUAGE(29)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
constexpr TypedWhichId< SvxTabStopItem > RES_PARATR_TABSTOP(68)
constexpr TypedWhichId< SwFormatFooter > RES_FOOTER(97)
constexpr TypedWhichId< SwNumRuleItem > RES_PARATR_NUMRULE(72)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(105)
HTMLMODE_ON
std::unique_ptr< weld::Button > m_xOKButton
OUString aName
sal_uInt16 nPos
#define SAL_WARN(area, stream)
FlyMode
Definition: mdiexp.hxx:41
@ FLY_DRAG
Definition: mdiexp.hxx:41
@ FLY_DRAG_START
Definition: mdiexp.hxx:41
@ FLY_DRAG_END
Definition: mdiexp.hxx:41
aStr
const char * sName
constexpr OUStringLiteral aData
Definition: ww8scan.hxx:48
SVL_DLLPUBLIC Link< OUString *, bool > const & GetMaybeFileHdl()
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)
sal_uInt16 zoomIn(sal_uInt16 nCurrent)
sal_uInt16 zoomOut(sal_uInt16 nCurrent)
@ Exception
const LanguageTag & getLocale()
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
int i
constexpr OUStringLiteral first
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
Dialog to specify the properties of date form field.
auto PrepareJumpToTOXMark(SwDoc const &rDoc, std::u16string_view aName) -> std::optional< std::pair< SwTOXMark, sal_Int32 > >
Definition: view2.cxx:2361
long Long
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
Definition: nodeoffset.hxx:35
sal_Int16 nId
const char GetValue[]
@ REF_SEQUENCEFLD
Definition: reffld.hxx:38
SFX2_DLLPUBLIC OUString SfxResId(TranslateId aId)
static SfxItemSet & rSet
sal_uIntPtr sal_uLong
sal_uLong nWord
Definition: docstat.hxx:35
sal_uLong nChar
Definition: docstat.hxx:37
SwNode & GetNode() const
Definition: pam.hxx:80
Point m_pInitialCursor
Definition: view.hxx:155
sal_uInt16 nStep
Definition: view.hxx:158
sal_uInt16 nLastVirt
Definition: viewsh.hxx:85
sal_uInt16 nLastPhy
Definition: viewsh.hxx:84
OUString sFirstCustomPhy
Definition: viewsh.hxx:86
OUString sLastCustomVirt
Definition: viewsh.hxx:87
sal_uInt16 nFirstPhy
Definition: viewsh.hxx:84
OUString sLastCustomPhy
Definition: viewsh.hxx:86
OUString sFirstCustomVirt
Definition: viewsh.hxx:87
sal_uInt16 nFirstVirt
Definition: viewsh.hxx:85
std::function< void(sal_Int32)> maEndDialogFn
#define ERR_SWG_READ_ERROR
Definition: swerror.h:25
#define STR_SW_EVENT_PAGE_COUNT
Definition: swevent.hxx:27
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:165
#define SW_MOD()
Definition: swmodule.hxx:256
tools::Long SwTwips
Definition: swtypes.hxx:51
sal_Unicode const toxMarkSeparator
separator for toxmarks: #<no>%19<text>%19<type><typename>|toxmark
Definition: swtypes.hxx:128
#define DB_DELIM
Definition: swtypes.hxx:130
const char cSequenceMarkSeparator
Definition: swtypes.hxx:126
const sal_Unicode cMarkSeparator
Definition: swtypes.hxx:124
constexpr sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:92
SwUndoId
Definition: swundo.hxx:30
@ REJECT_REDLINE
@ ACCEPT_REDLINE
@ TOX_USER
Definition: toxe.hxx:42
@ TOX_CONTENT
Definition: toxe.hxx:43
@ TOX_INDEX
Definition: toxe.hxx:41
@ TOX_SAME_NXT
Definition: toxe.hxx:26
unsigned char sal_uInt8
void ItemSetToPageDesc(const SfxItemSet &rSet, SwPageDesc &rPageDesc)
Definition: uitool.cxx:277
SW_DLLPUBLIC void MakeDefTabs(SwTwips nDefDist, SvxTabStopItem &rTabs)
Definition: uitool.cxx:637
const std::u16string_view aStringList[]
RET_OK
RET_CANCEL
IMPL_LINK(SwView, DialogClosedHdl, sfx2::FileDialogHelper *, _pFileDlg, void)
Definition: view2.cxx:2985
const char sStatusDelim[]
Definition: view2.cxx:160
static auto JumpToTOXMark(SwWrtShell &rSh, std::u16string_view aName) -> bool
Definition: view2.cxx:2427
static size_t lcl_PageDescWithHeader(const SwDoc &rDoc)
Definition: view2.cxx:2600
static void lcl_SetAllTextToDefaultLanguage(SwWrtShell &rWrtSh, sal_uInt16 nWhichId)
Definition: view2.cxx:234
#define MINZOOM
Definition: view.hxx:81
#define MAXZOOM
Definition: view.hxx:82
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)
Definition: viewopt.cxx:332
SvxZoomType