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