Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / source / uibase / uiview / view0.cxx
blobecc718fa8aadd1de726248708bf739c208d3b582
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <config_features.h>
21 #include <config_wasm_strip.h>
23 #include <SwSpellDialogChildWindow.hxx>
24 #include <svl/eitem.hxx>
25 #include <unotools/configmgr.hxx>
26 #include <unotools/linguprops.hxx>
27 #include <unotools/lingucfg.hxx>
28 #include <officecfg/Office/Common.hxx>
29 #include <viewopt.hxx>
30 #include <globals.h>
31 #include <sfx2/infobar.hxx>
32 #include <sfx2/request.hxx>
33 #include <svl/whiter.hxx>
34 #include <svx/srchdlg.hxx>
35 #include <sfx2/viewfrm.hxx>
36 #include <sfx2/bindings.hxx>
37 #include <sfx2/dispatch.hxx>
38 #include <sfx2/sidebar/SidebarChildWindow.hxx>
39 #include <uivwimp.hxx>
40 #include <avmedia/mediaplayer.hxx>
41 #include <swmodule.hxx>
42 #include <com/sun/star/linguistic2/XLinguProperties.hpp>
43 #include <osl/diagnose.h>
45 #include <sfx2/objface.hxx>
46 #include <wrtsh.hxx>
47 #include <edtwin.hxx>
48 #include <view.hxx>
49 #include <docsh.hxx>
50 #include <doc.hxx>
51 #include <globals.hrc>
52 #include <cmdid.h>
53 #include <globdoc.hxx>
54 #include <wview.hxx>
55 #include <OnlineAccessibilityCheck.hxx>
57 #define ShellClass_SwView
58 #define ShellClass_Text
59 #define ShellClass_TextDrawText
61 #include <sfx2/msg.hxx>
62 #include <swslots.hxx>
63 #include <PostItMgr.hxx>
65 using namespace ::com::sun::star;
67 #include <unotools/moduleoptions.hxx>
68 #include <sfx2/viewfac.hxx>
70 #include <memory>
71 #include <swabstdlg.hxx>
73 SFX_IMPL_NAMED_VIEWFACTORY(SwView, "Default")
75 if (utl::ConfigManager::IsFuzzing() || SvtModuleOptions().IsWriter())
77 SFX_VIEW_REGISTRATION(SwDocShell);
78 SFX_VIEW_REGISTRATION(SwGlobalDocShell);
82 SFX_IMPL_INTERFACE(SwView, SfxViewShell)
84 void SwView::InitInterface_Impl()
86 GetStaticInterface()->RegisterChildWindow(SID_NAVIGATOR, true);
88 GetStaticInterface()->RegisterChildWindow(::sfx2::sidebar::SidebarChildWindow::GetChildWindowId());
90 GetStaticInterface()->RegisterChildWindow(SfxInfoBarContainerChild::GetChildWindowId());
91 GetStaticInterface()->RegisterChildWindow(SvxSearchDialogWrapper::GetChildWindowId());
92 GetStaticInterface()->RegisterChildWindow(SwSpellDialogChildWindow::GetChildWindowId());
93 GetStaticInterface()->RegisterChildWindow(FN_REDLINE_ACCEPT);
94 GetStaticInterface()->RegisterChildWindow(SID_HYPERLINK_DIALOG);
95 GetStaticInterface()->RegisterChildWindow(FN_WORDCOUNT_DIALOG);
96 #if HAVE_FEATURE_AVMEDIA
97 GetStaticInterface()->RegisterChildWindow(::avmedia::MediaPlayer::GetChildWindowId());
98 #endif
99 GetStaticInterface()->RegisterChildWindow(FN_INSERT_FIELD_DATA_ONLY);
101 GetStaticInterface()->RegisterChildWindow(FN_SYNC_LABELS, false, SfxShellFeature::SwChildWindowLabel);
103 GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_TOOLS, SfxVisibilityFlags::Standard|SfxVisibilityFlags::Server,
104 ToolbarId::Tools_Toolbox);
108 ShellMode SwView::GetShellMode() const
110 return m_pViewImpl->GetShellMode();
113 view::XSelectionSupplier* SwView::GetUNOObject()
115 return m_pViewImpl->GetUNOObject();
118 void SwView::ApplyAccessibilityOptions()
120 #if ENABLE_WASM_STRIP_ACCESSIBILITY
121 #else
122 m_pWrtShell->ApplyAccessibilityOptions();
123 //to enable the right state of the selection cursor in readonly documents
124 if(GetDocShell()->IsReadOnly())
125 m_pWrtShell->ShowCursor();
126 #endif
129 void SwView::SetMailMergeConfigItem(std::shared_ptr<SwMailMergeConfigItem> const & rConfigItem)
131 m_pViewImpl->SetMailMergeConfigItem(rConfigItem);
132 UIFeatureChanged();
135 std::shared_ptr<SwMailMergeConfigItem> const & SwView::GetMailMergeConfigItem() const
137 return m_pViewImpl->GetMailMergeConfigItem();
140 static bool lcl_IsViewMarks( const SwViewOption& rVOpt )
142 return rVOpt.IsHardBlank() &&
143 rVOpt.IsSoftHyph() &&
144 rVOpt.IsFieldShadings();
146 static void lcl_SetViewMarks(SwViewOption& rVOpt, bool bOn )
148 rVOpt.SetHardBlank(bOn);
149 rVOpt.SetSoftHyph(bOn);
150 rVOpt.SetAppearanceFlag(
151 ViewOptFlags::FieldShadings, bOn, true);
154 static void lcl_SetViewMetaChars( SwViewOption& rVOpt, bool bOn)
156 rVOpt.SetViewMetaChars( bOn );
157 if(bOn && !(rVOpt.IsParagraph() ||
158 rVOpt.IsTab() ||
159 rVOpt.IsLineBreak() ||
160 rVOpt.IsShowHiddenChar() ||
161 rVOpt.IsShowBookmarks() ||
162 rVOpt.IsBlank()))
164 rVOpt.SetParagraph(bOn);
165 rVOpt.SetTab(bOn);
166 rVOpt.SetLineBreak(bOn);
167 rVOpt.SetBlank(bOn);
168 rVOpt.SetShowHiddenChar(bOn);
169 rVOpt.SetShowBookmarks(bOn);
173 void SwView::RecheckBrowseMode()
175 // OS: pay attention to numerical order!
176 static sal_uInt16 const aInva[] =
178 //SID_NEWWINDOW,/*5620*/
179 SID_BROWSER_MODE, /*6313*/
180 SID_RULER_BORDERS, SID_RULER_PAGE_POS,
181 //SID_ATTR_LONG_LRSPACE,
182 SID_HTML_MODE,
183 SID_RULER_PROTECT, /* 10915 */
184 //SID_AUTOSPELL_CHECK,
185 //SID_AUTOSPELL_MARKOFF,
186 SID_TOGGLE_RESOLVED_NOTES, /* 11672*/
187 FN_RULER, /*20211*/
188 FN_VIEW_GRAPHIC, /*20213*/
189 FN_VIEW_BOUNDS, /**/
190 FN_VIEW_FIELDS, /*20215*/
191 FN_VLINEAL, /*20216*/
192 FN_VSCROLLBAR, /*20217*/
193 FN_HSCROLLBAR, /*20218*/
194 FN_VIEW_SECTION_BOUNDARIES, /*20219*/
195 FN_VIEW_META_CHARS, /**/
196 FN_VIEW_MARKS, /**/
197 //FN_VIEW_FIELDNAME, /**/
198 FN_VIEW_TABLEGRID, /*20227*/
199 FN_PRINT_LAYOUT, /*20237*/
200 FN_QRY_MERGE, /*20364*/
201 FN_SHADOWCURSOR, /**/
204 // the view must not exist!
205 GetViewFrame().GetBindings().Invalidate(aInva);
206 CheckVisArea();
208 SvxZoomType eType;
209 if( GetWrtShell().GetViewOptions()->getBrowseMode() && SvxZoomType::PERCENT != (eType =
210 GetWrtShell().GetViewOptions()->GetZoomType()) )
211 SetZoom( eType );
212 InvalidateBorder();
215 // State of view options
217 void SwView::StateViewOptions(SfxItemSet &rSet)
219 SfxWhichIter aIter(rSet);
220 sal_uInt16 nWhich = aIter.FirstWhich();
221 SfxBoolItem aBool;
222 const SwViewOption* pOpt = GetWrtShell().GetViewOptions();
224 while(nWhich)
226 bool bReadonly = GetDocShell()->IsReadOnly();
227 if (bReadonly && nWhich != FN_VIEW_GRAPHIC && nWhich != FN_HIGHLIGHT_CHAR_DF)
229 rSet.DisableItem(nWhich);
230 nWhich = 0;
232 switch(nWhich)
234 case FN_RULER:
236 if(!pOpt->IsViewHRuler(true) && !pOpt->IsViewVRuler(true))
238 rSet.DisableItem(nWhich);
239 nWhich = 0;
241 else
242 aBool.SetValue( pOpt->IsViewAnyRuler());
244 break;
245 case SID_BROWSER_MODE:
246 case FN_PRINT_LAYOUT:
248 bool bState = pOpt->getBrowseMode();
249 if(FN_PRINT_LAYOUT == nWhich)
250 bState = !bState;
251 aBool.SetValue( bState );
253 break;
254 case FN_VIEW_BOUNDS:
255 aBool.SetValue( pOpt->IsDocBoundaries()); break;
256 case FN_VIEW_SECTION_BOUNDARIES:
257 aBool.SetValue(pOpt->IsSectionBoundaries()); break;
258 case FN_VIEW_GRAPHIC:
259 aBool.SetValue( pOpt->IsGraphic() ); break;
260 case FN_VIEW_FIELDS:
261 aBool.SetValue( pOpt->IsFieldShadings() ); break;
262 case FN_VIEW_FIELDNAME:
263 aBool.SetValue( pOpt->IsFieldName() ); break;
264 case FN_VIEW_MARKS:
265 aBool.SetValue( lcl_IsViewMarks(*pOpt) ); break;
266 case FN_VIEW_META_CHARS:
267 aBool.SetValue( pOpt->IsViewMetaChars() ); break;
268 case FN_VIEW_TABLEGRID:
269 aBool.SetValue( pOpt->IsTableBoundaries() ); break;
270 case SID_TOGGLE_NOTES:
272 if (!GetPostItMgr()->HasNotes())
274 rSet.DisableItem(nWhich);
275 nWhich = 0;
277 else
278 aBool.SetValue( pOpt->IsPostIts());
279 break;
281 case SID_TOGGLE_RESOLVED_NOTES:
283 if (!GetPostItMgr()->HasNotes())
285 rSet.DisableItem(nWhich);
286 nWhich = 0;
288 else
289 aBool.SetValue( pOpt->IsResolvedPostIts());
290 break;
292 case FN_VIEW_HIDDEN_PARA:
293 aBool.SetValue( pOpt->IsShowHiddenPara()); break;
294 case FN_VIEW_HIDE_WHITESPACE:
296 if (pOpt->getBrowseMode() || !pOpt->CanHideWhitespace())
298 rSet.DisableItem(nWhich);
299 nWhich = 0;
301 else
302 aBool.SetValue(pOpt->IsHideWhitespaceMode());
303 break;
305 case FN_VIEW_SHOW_WHITESPACE:
307 aBool.SetValue(!pOpt->IsHideWhitespaceMode());
308 break;
310 case SID_GRID_VISIBLE:
311 aBool.SetValue( pOpt->IsGridVisible() ); break;
312 case SID_GRID_USE:
313 aBool.SetValue( pOpt->IsSnap() ); break;
314 case SID_HELPLINES_MOVE:
315 aBool.SetValue( pOpt->IsCrossHair() ); break;
316 case FN_VIEW_SMOOTH_SCROLL:
317 aBool.SetValue( pOpt->IsSmoothScroll()); break;
318 case FN_VLINEAL:
319 aBool.SetValue( StatVRuler() ); break;
320 case FN_HSCROLLBAR:
321 if( pOpt->getBrowseMode() )
323 rSet.DisableItem(nWhich);
324 nWhich = 0;
326 else
327 aBool.SetValue( IsHScrollbarVisible() );
328 break;
329 case FN_VSCROLLBAR:
330 aBool.SetValue( IsVScrollbarVisible() ); break;
331 case SID_AUTOSPELL_CHECK:
332 aBool.SetValue( pOpt->IsOnlineSpell() );
333 break;
334 case SID_ACCESSIBILITY_CHECK_ONLINE:
336 bool bOnlineAccessibilityCheck = officecfg::Office::Common::Accessibility::OnlineAccessibilityCheck::get();
337 aBool.SetValue(bOnlineAccessibilityCheck);
339 break;
340 case FN_SHADOWCURSOR:
341 if ( pOpt->getBrowseMode() )
343 rSet.DisableItem( nWhich );
344 nWhich = 0;
346 else
347 aBool.SetValue( pOpt->IsShadowCursor() );
348 break;
349 case FN_SHOW_INLINETOOLTIPS:
350 aBool.SetValue( pOpt->IsShowInlineTooltips() );
351 break;
352 case FN_USE_HEADERFOOTERMENU:
353 aBool.SetValue( pOpt->IsUseHeaderFooterMenu() );
354 break;
355 case FN_SHOW_OUTLINECONTENTVISIBILITYBUTTON:
356 aBool.SetValue( pOpt->IsShowOutlineContentVisibilityButton() );
357 break;
358 case FN_SHOW_CHANGES_IN_MARGIN:
359 aBool.SetValue( pOpt->IsShowChangesInMargin() );
360 break;
361 case FN_HIGHLIGHT_CHAR_DF:
362 aBool.SetValue(m_bIsHighlightCharDF);
363 break;
366 if( nWhich )
368 aBool.SetWhich( nWhich );
369 rSet.Put( aBool );
371 nWhich = aIter.NextWhich();
375 // execute view options
377 void SwView::ExecViewOptions(SfxRequest &rReq)
379 std::optional<SwViewOption> pOpt( *GetWrtShell().GetViewOptions() );
380 bool bModified = GetWrtShell().IsModified();
382 int eState = STATE_TOGGLE;
383 bool bSet = false;
384 bool bBrowseModeChanged = false;
386 const SfxItemSet *pArgs = rReq.GetArgs();
387 sal_uInt16 nSlot = rReq.GetSlot();
388 const SfxPoolItem* pAttr=nullptr;
390 if( pArgs && SfxItemState::SET == pArgs->GetItemState( nSlot , false, &pAttr ))
392 bSet = static_cast<const SfxBoolItem*>(pAttr)->GetValue();
393 eState = bSet ? STATE_ON : STATE_OFF;
396 bool bFlag = STATE_ON == eState;
397 uno::Reference< linguistic2::XLinguProperties > xLngProp( ::GetLinguPropertySet() );
399 switch ( nSlot )
401 case FN_VIEW_GRAPHIC:
402 if( STATE_TOGGLE == eState )
403 bFlag = !pOpt->IsGraphic();
404 pOpt->SetGraphic( bFlag );
405 break;
407 case FN_VIEW_FIELDS:
408 if( STATE_TOGGLE == eState )
409 bFlag = !pOpt->IsFieldShadings() ;
410 pOpt->SetAppearanceFlag(ViewOptFlags::FieldShadings, bFlag, true );
411 break;
413 case FN_VIEW_BOUNDS:
414 if( STATE_TOGGLE == eState )
415 bFlag = !pOpt->IsDocBoundaries();
416 pOpt->SetAppearanceFlag(ViewOptFlags::DocBoundaries, bFlag, true );
417 break;
419 case FN_VIEW_SECTION_BOUNDARIES:
420 if( STATE_TOGGLE == eState )
421 bFlag = !pOpt->IsSectionBoundaries();
422 pOpt->SetAppearanceFlag(ViewOptFlags::SectionBoundaries, bFlag, true );
423 break;
425 case SID_GRID_VISIBLE:
426 if( STATE_TOGGLE == eState )
427 bFlag = !pOpt->IsGridVisible();
429 pOpt->SetGridVisible( bFlag );
430 break;
432 case SID_GRID_USE:
433 if( STATE_TOGGLE == eState )
434 bFlag = !pOpt->IsSnap();
436 pOpt->SetSnap( bFlag );
437 break;
439 case SID_HELPLINES_MOVE:
440 if( STATE_TOGGLE == eState )
441 bFlag = !pOpt->IsCrossHair();
443 pOpt->SetCrossHair( bFlag );
444 break;
446 case SID_BROWSER_MODE:
447 bBrowseModeChanged = !pOpt->getBrowseMode();
448 pOpt->setBrowseMode(true );
449 break;
451 case FN_PRINT_LAYOUT:
452 bBrowseModeChanged = pOpt->getBrowseMode();
453 pOpt->setBrowseMode( false );
454 break;
456 case SID_TOGGLE_NOTES:
457 if ( STATE_TOGGLE == eState )
458 bFlag = !pOpt->IsPostIts();
460 GetPostItMgr()->SetLayout();
461 pOpt->SetPostIts( bFlag );
462 if (pOpt->IsPostIts())
463 GetPostItMgr()->CheckMetaText();
464 break;
466 case SID_TOGGLE_RESOLVED_NOTES:
467 if ( STATE_TOGGLE == eState )
468 bFlag = pOpt->IsResolvedPostIts();
470 GetPostItMgr()->ShowHideResolvedNotes(!bFlag);
472 GetPostItMgr()->SetLayout();
473 pOpt->SetResolvedPostIts( !bFlag );
475 break;
477 case FN_VIEW_HIDDEN_PARA:
478 if ( STATE_TOGGLE == eState )
479 bFlag = !pOpt->IsShowHiddenPara();
481 pOpt->SetShowHiddenPara( bFlag );
482 break;
484 case FN_VIEW_HIDE_WHITESPACE:
485 if ( STATE_TOGGLE == eState )
486 bFlag = !pOpt->IsHideWhitespaceMode();
488 pOpt->SetHideWhitespaceMode(bFlag);
489 break;
491 case FN_VIEW_SHOW_WHITESPACE:
492 if ( STATE_TOGGLE == eState )
493 bFlag = pOpt->IsHideWhitespaceMode();
495 pOpt->SetHideWhitespaceMode(!bFlag);
496 break;
498 case FN_VIEW_SMOOTH_SCROLL:
500 if ( STATE_TOGGLE == eState )
501 bFlag = !pOpt->IsSmoothScroll();
503 pOpt->SetSmoothScroll( bFlag );
504 break;
506 case FN_VLINEAL:
507 if( STATE_TOGGLE == eState )
508 bFlag = !pOpt->IsViewVRuler();
510 pOpt->SetViewVRuler( bFlag );
511 break;
513 case FN_VSCROLLBAR:
514 if( STATE_TOGGLE == eState )
515 bFlag = !pOpt->IsViewVScrollBar();
517 pOpt->SetViewVScrollBar( bFlag );
518 break;
520 case FN_HSCROLLBAR:
521 if( STATE_TOGGLE == eState )
522 bFlag = !pOpt->IsViewHScrollBar();
524 pOpt->SetViewHScrollBar( bFlag );
525 break;
527 case FN_RULER:
528 if( STATE_TOGGLE == eState )
529 bFlag = !pOpt->IsViewAnyRuler();
531 pOpt->SetViewAnyRuler( bFlag );
532 break;
534 case FN_VIEW_TABLEGRID:
535 if( STATE_TOGGLE == eState )
536 bFlag = !pOpt->IsTableBoundaries();
537 pOpt->SetAppearanceFlag(ViewOptFlags::TableBoundaries, bFlag, true );
538 break;
540 case FN_VIEW_FIELDNAME:
541 if( STATE_TOGGLE == eState )
542 bFlag = !pOpt->IsFieldName() ;
544 pOpt->SetFieldName( bFlag );
545 break;
547 case FN_VIEW_MARKS:
548 if( STATE_TOGGLE == eState )
549 bFlag = !lcl_IsViewMarks(*pOpt) ;
551 lcl_SetViewMarks( *pOpt, bFlag );
552 break;
554 case FN_HIGHLIGHT_CHAR_DF:
555 if (STATE_TOGGLE == eState)
556 bFlag = !m_bIsHighlightCharDF;
557 m_bIsHighlightCharDF = bFlag;
558 break;
560 case FN_VIEW_META_CHARS:
561 if( STATE_TOGGLE == eState )
562 bFlag = !pOpt->IsViewMetaChars();
564 lcl_SetViewMetaChars( *pOpt, bFlag );
565 break;
567 case SID_AUTOSPELL_CHECK:
568 const SfxPoolItem* pItem;
570 if (pArgs && pArgs->HasItem(FN_PARAM_1, &pItem))
571 bSet = static_cast<const SfxBoolItem*>(pItem)->GetValue();
572 else if( STATE_TOGGLE == eState )
574 bFlag = !pOpt->IsOnlineSpell();
575 bSet = bFlag;
578 pOpt->SetOnlineSpell(bSet);
580 SvtLinguConfig aCfg;
581 aCfg.SetProperty( UPN_IS_SPELL_AUTO, uno::Any( bSet ) );
583 if (xLngProp.is())
584 xLngProp->setIsSpellAuto( bSet );
586 // for the time being we do not have a specific option for grammarchecking.
587 // thus we'll use the one for spell checking...
588 if (bSet)
590 SwDocShell *pDocSh = GetDocShell();
591 SwDoc *pDoc = pDocSh? pDocSh->GetDoc() : nullptr;
593 // right now we don't have view options for automatic grammar checking. Thus...
594 bool bIsAutoGrammar = false;
595 aCfg.GetProperty( UPN_IS_GRAMMAR_AUTO ) >>= bIsAutoGrammar;
597 if (pDoc && bIsAutoGrammar)
598 pDoc->StartGrammarChecking();
601 break;
603 case SID_ACCESSIBILITY_CHECK_ONLINE:
605 if (pArgs && pArgs->HasItem(FN_PARAM_1, &pItem))
607 bSet = static_cast<const SfxBoolItem*>(pItem)->GetValue();
609 else if (STATE_TOGGLE == eState)
611 bool bOnlineCheck = officecfg::Office::Common::Accessibility::OnlineAccessibilityCheck::get();
612 bSet = !bOnlineCheck;
614 std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
615 officecfg::Office::Common::Accessibility::OnlineAccessibilityCheck::set(bSet, batch);
616 batch->commit();
618 SwDocShell *pDocSh = GetDocShell();
619 SwDoc* pDocument = pDocSh? pDocSh->GetDoc() : nullptr;
620 if (pDocument)
621 pDocument->getOnlineAccessibilityCheck()->updateCheckerActivity();
623 break;
625 case FN_SHADOWCURSOR:
626 if( STATE_TOGGLE == eState )
628 bFlag = !pOpt->IsShadowCursor();
629 bSet = bFlag;
632 pOpt->SetShadowCursor(bSet);
633 break;
635 case FN_SHOW_INLINETOOLTIPS:
636 if( STATE_TOGGLE == eState )
637 bFlag = !pOpt->IsShowInlineTooltips();
639 pOpt->SetShowInlineTooltips( bFlag );
640 break;
642 case FN_USE_HEADERFOOTERMENU:
643 if( STATE_TOGGLE == eState )
644 bFlag = !pOpt->IsUseHeaderFooterMenu();
646 pOpt->SetUseHeaderFooterMenu( bFlag );
647 break;
649 case FN_SHOW_OUTLINECONTENTVISIBILITYBUTTON:
651 if( STATE_TOGGLE == eState )
652 bFlag = !pOpt->IsShowOutlineContentVisibilityButton();
654 SwWrtShell &rSh = GetWrtShell();
656 if (!bFlag) // Outline folding is being turned ON!
657 rSh.MakeAllFoldedOutlineContentVisible();
659 pOpt->SetShowOutlineContentVisibilityButton(bFlag);
661 // Apply option change here so if toggling the outline folding feature ON
662 // the invalidate function will see this.
663 rSh.StartAction();
664 rSh.ApplyViewOptions(*pOpt);
665 rSh.EndAction();
667 if (bFlag) // Outline folding is being turned OFF!
668 rSh.MakeAllFoldedOutlineContentVisible(false);
670 break;
673 case FN_SHOW_CHANGES_IN_MARGIN:
674 if( STATE_TOGGLE == eState )
675 bFlag = !pOpt->IsShowChangesInMargin();
677 pOpt->SetShowChangesInMargin( bFlag );
678 break;
680 default:
681 OSL_FAIL("wrong request method");
682 return;
685 // Set UserPrefs, mark request as modified
686 bool bWebView = dynamic_cast<const SwWebView*>(this) != nullptr;
687 SwWrtShell &rSh = GetWrtShell();
688 rSh.StartAction();
689 SwModule* pModule = SW_MOD();
690 if( *rSh.GetViewOptions() != *pOpt )
692 rSh.ApplyViewOptions( *pOpt );
693 if( bBrowseModeChanged )
695 GetDocShell()->ToggleLayoutMode(this);
698 // The UsrPref must be marked as modified.
699 // call for initialization
700 pModule->GetUsrPref(bWebView);
701 SwModule::CheckSpellChanges( pOpt->IsOnlineSpell(), false, false, false );
703 //OS: Set back modified again, because view/fields sets the Doc modified.
704 if( !bModified )
705 rSh.ResetModified();
707 pModule->ApplyUsrPref( *pOpt, this, bWebView ? SvViewOpt::DestWeb : SvViewOpt::DestText );
709 // #i6193# let postits know about new spellcheck setting
710 if ( nSlot == SID_AUTOSPELL_CHECK )
711 GetPostItMgr()->SetSpellChecking();
713 const bool bLockedView = rSh.IsViewLocked();
714 rSh.LockView( true ); //lock visible section
715 GetWrtShell().EndAction();
716 if( bBrowseModeChanged && !bFlag )
717 CalcVisArea( GetEditWin().GetOutputSizePixel() );
718 rSh.LockView( bLockedView );
720 pOpt.reset();
721 Invalidate(rReq.GetSlot());
722 if(!pArgs)
723 rReq.AppendItem(SfxBoolItem(nSlot, bFlag));
724 rReq.Done();
727 void SwView::ExecFormatFootnote()
729 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
730 ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateSwFootNoteOptionDlg(GetFrameWeld(), GetWrtShell()));
731 pDlg->Execute();
734 void SwView::ExecNumberingOutline(SfxItemPool & rPool)
736 SfxItemSetFixed<FN_PARAM_1, FN_PARAM_1> aTmp(rPool);
737 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
738 ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateOutlineTabDialog(GetFrameWeld(), &aTmp, GetWrtShell()));
739 pDlg->Execute();
742 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */