LibreOffice Module sw (master)  1
viewmdi.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 <string>
21 
22 #include <hintids.hxx>
23 #include <vcl/svapp.hxx>
24 #include <sfx2/dispatch.hxx>
25 #include <sfx2/viewfrm.hxx>
26 #include <svx/ruler.hxx>
27 #include <editeng/lrspitem.hxx>
28 #include <svl/srchitem.hxx>
29 #include <svl/stritem.hxx>
30 #include <sfx2/request.hxx>
31 #include <swmodule.hxx>
32 #include <view.hxx>
33 #include <wrtsh.hxx>
34 #include <docsh.hxx>
35 #include <viewopt.hxx>
36 #include <frmatr.hxx>
37 #include <wdocsh.hxx>
38 #include <uitool.hxx>
39 #include <edtwin.hxx>
40 #include <pagedesc.hxx>
41 #include <IMark.hxx>
42 #include <fldbas.hxx>
43 #include <workctrl.hxx>
44 #include <usrpref.hxx>
45 #include <scroll.hxx>
46 #include <wview.hxx>
47 
48 #include <cmdid.h>
49 #include <globals.hrc>
50 
52 #include <PostItMgr.hxx>
53 #include <AnnotationWin.hxx>
54 
55 #include <svx/srchdlg.hxx>
56 #include <svx/svdview.hxx>
57 #include <svx/svxids.hrc>
58 
59 #include <vcl/uitest/logger.hxx>
61 
62 sal_uInt16 SwView::m_nMoveType = NID_PGE;
63 sal_Int32 SwView::m_nActMark = 0;
64 
65 using namespace ::com::sun::star::uno;
66 
67 namespace {
68 
69 void collectUIInformation(const OUString& aFactor)
70 {
71  EventDescription aDescription;
72  aDescription.aID = "writer_edit";
73  aDescription.aParameters = {{"ZOOM", aFactor}};
74  aDescription.aAction = "SET";
75  aDescription.aKeyWord = "SwEditWinUIObject";
76  aDescription.aParent = "MainWindow";
77  UITestLogger::getInstance().logEvent(aDescription);
78 }
79 
80 }
81 
82 void SwView::SetZoom( SvxZoomType eZoomType, short nFactor, bool bViewOnly )
83 {
84  bool const bCursorIsVisible(m_pWrtShell->IsCursorVisible());
85  SetZoom_( GetEditWin().GetOutputSizePixel(), eZoomType, nFactor, bViewOnly );
86  // fdo#40465 force the cursor to stay in view whilst zooming
87  if (bCursorIsVisible)
88  m_pWrtShell->ShowCursor();
89 
90  collectUIInformation(OUString::number(nFactor));
91 }
92 
93 void SwView::SetZoom_( const Size &rEditSize, SvxZoomType eZoomType,
94  short nFactor, bool bViewOnly )
95 {
96  bool bUnLockView = !m_pWrtShell->IsViewLocked();
97  m_pWrtShell->LockView( true );
98  m_pWrtShell->LockPaint();
99 
100  { // start of SwActContext scope
101  SwActContext aActContext(m_pWrtShell.get());
102 
103  long nFac = nFactor;
104 
105  const bool bWeb = dynamic_cast< const SwWebView *>( this ) != nullptr;
106  SwMasterUsrPref *pUsrPref = const_cast<SwMasterUsrPref*>(SW_MOD()->GetUsrPref(bWeb));
107 
108  const SwPageDesc &rDesc = m_pWrtShell->GetPageDesc( m_pWrtShell->GetCurPageDesc() );
109  const SvxLRSpaceItem &rLRSpace = rDesc.GetMaster().GetLRSpace();
110  const SwViewOption *pOpt = m_pWrtShell->GetViewOptions();
111  long lLeftMargin = 0;
112 
113  if( eZoomType != SvxZoomType::PERCENT )
114  {
115  const bool bAutomaticViewLayout = 0 == pOpt->GetViewLayoutColumns();
116 
117  const SwRect aPageRect( m_pWrtShell->GetAnyCurRect( CurRectType::PageCalc ) );
118  const SwRect aRootRect( m_pWrtShell->GetAnyCurRect( CurRectType::PagesArea ) );
119  Size aPageSize( aPageRect.SSize() );
120  Size aRootSize( aRootRect.SSize() );
121 
122  //mod #i6193# added sidebar width
123  SwPostItMgr* pPostItMgr = GetPostItMgr();
124  if (pPostItMgr->HasNotes() && pPostItMgr->ShowNotes())
125  aPageSize.AdjustWidth(pPostItMgr->GetSidebarWidth() + pPostItMgr->GetSidebarBorderWidth() );
126 
127  const MapMode aTmpMap( MapUnit::MapTwip );
128  const Size aWindowSize( GetEditWin().PixelToLogic( rEditSize, aTmpMap ) );
129 
130  if( UseOnPage::Mirror == rDesc.GetUseOn() ) // mirrored pages
131  {
132  const SvxLRSpaceItem &rLeftLRSpace = rDesc.GetLeft().GetLRSpace();
133  aPageSize.AdjustWidth(std::abs( rLeftLRSpace.GetLeft() - rLRSpace.GetLeft() ) );
134  }
135 
136  if( SvxZoomType::OPTIMAL == eZoomType )
137  {
138  if (!pPostItMgr->HasNotes() || !pPostItMgr->ShowNotes())
139  aPageSize.AdjustWidth( -( rLRSpace.GetLeft() + rLRSpace.GetRight() + nLeftOfst * 2 ) );
140  lLeftMargin = rLRSpace.GetLeft() + DOCUMENTBORDER + nLeftOfst;
141  nFac = aWindowSize.Width() * 100 / aPageSize.Width();
142  }
143  else if(SvxZoomType::WHOLEPAGE == eZoomType || SvxZoomType::PAGEWIDTH == eZoomType )
144  {
145  const long nOf = DOCUMENTBORDER * 2;
146  long nTmpWidth = bAutomaticViewLayout ? aPageSize.Width() : aRootSize.Width();
147  nTmpWidth += nOf;
148  aPageSize.AdjustHeight(nOf );
149  nFac = aWindowSize.Width() * 100 / nTmpWidth;
150 
151  if ( SvxZoomType::WHOLEPAGE == eZoomType )
152  {
153  long nVisPercent = aWindowSize.Height() * 100 / aPageSize.Height();
154  nFac = std::min( nFac, nVisPercent );
155  }
156  }
157  else
158  {
159  const long nTmpWidth = bAutomaticViewLayout ? aPageSize.Width() : aRootSize.Width();
160  nFac = aWindowSize.Width() * 100 / nTmpWidth;
161  }
162  }
163 
164  nFac = std::max( long( MINZOOM ), nFac );
165  const sal_uInt16 nZoomFac = static_cast<sal_uInt16>(nFac);
166 
167  SwViewOption aOpt( *pOpt );
168  if ( !GetViewFrame()->GetFrame().IsInPlace() )
169  {
170  //Update MasterUsrPrefs and after that update the ViewOptions of the current View.
171  if ( !bViewOnly &&
172  (nZoomFac != pUsrPref->GetZoom() ||
173  eZoomType != pUsrPref->GetZoomType()) )
174  {
175  pUsrPref->SetZoom(nZoomFac);
176  pUsrPref->SetZoomType(eZoomType);
177  SW_MOD()->ApplyUsrPref(*pUsrPref, nullptr);
178  pUsrPref->SetModified();
179  }
180  if ( pOpt->GetZoom() != nZoomFac )
181  {
182  aOpt.SetZoom(nZoomFac);
183  aOpt.SetReadonly(pOpt->IsReadonly());
184  m_pWrtShell->ApplyViewOptions( aOpt );
185  }
186  if ( eZoomType != SvxZoomType::PERCENT )
187  {
188  Point aPos;
189 
190  if ( eZoomType == SvxZoomType::WHOLEPAGE )
191  aPos.setY( m_pWrtShell->GetAnyCurRect(CurRectType::Page).Top() - DOCUMENTBORDER );
192  else
193  {
194  // Make sure that the cursor is in the visible range, so that
195  // the scrolling will be performed only once.
196  aPos.setX( lLeftMargin );
197  const SwRect &rCharRect = m_pWrtShell->GetCharRect();
198  if ( rCharRect.Top() > GetVisArea().Bottom() ||
199  rCharRect.Bottom() < aPos.Y() )
200  aPos.setY( rCharRect.Top() - rCharRect.Height() );
201  else
202  aPos.setY( GetVisArea().Top() );
203  }
204  SetVisArea( aPos );
205  }
206  // Compromise solution - Under certain circumstances SetZoom is called
207  // in CalcVisAreas again and thus be set wrong values.
208  const_cast<SwViewOption*>(m_pWrtShell->GetViewOptions())->SetZoomType( eZoomType );
209  CalcVisArea( rEditSize ); // for the recalculation of the viewable area
210  }
211  else if ( nZoomFac != pOpt->GetZoom() )
212  {
213  aOpt.SetZoom( nZoomFac );
214  m_pWrtShell->ApplyViewOptions( aOpt );
215  }
216 
217  const Fraction aFrac( nFac, 100 );
218  m_pVRuler->SetZoom( aFrac );
220  m_pHRuler->SetZoom( aFrac );
222  const_cast<SwViewOption*>(m_pWrtShell->GetViewOptions())->SetZoomType( eZoomType );
223  } // end of SwActContext scope
224 
225  m_pWrtShell->UnlockPaint();
226  if( bUnLockView )
227  m_pWrtShell->LockView( false );
228 }
229 
230 void SwView::SetViewLayout( sal_uInt16 nColumns, bool bBookMode, bool bViewOnly )
231 {
232  const bool bUnLockView = !m_pWrtShell->IsViewLocked();
233  m_pWrtShell->LockView( true );
234  m_pWrtShell->LockPaint();
235 
236  {
237 
238  SwActContext aActContext(m_pWrtShell.get());
239 
240  if ( !GetViewFrame()->GetFrame().IsInPlace() && !bViewOnly )
241  {
242  const bool bWeb = dynamic_cast< const SwWebView *>( this ) != nullptr;
243  SwMasterUsrPref *pUsrPref = const_cast<SwMasterUsrPref*>(SW_MOD()->GetUsrPref(bWeb));
244 
245  // Update MasterUsrPrefs and after that update the ViewOptions of the current View.
246  if ( nColumns != pUsrPref->GetViewLayoutColumns() ||
247  bBookMode != pUsrPref->IsViewLayoutBookMode() )
248  {
249  pUsrPref->SetViewLayoutColumns(nColumns);
250  pUsrPref->SetViewLayoutBookMode(bBookMode);
251  SW_MOD()->ApplyUsrPref(*pUsrPref, nullptr);
252  pUsrPref->SetModified();
253  }
254  }
255 
256  const SwViewOption *pOpt = m_pWrtShell->GetViewOptions();
257 
258  if ( nColumns != pOpt->GetViewLayoutColumns() ||
259  bBookMode != pOpt->IsViewLayoutBookMode() )
260  {
261  SwViewOption aOpt( *pOpt );
262  aOpt.SetViewLayoutColumns( nColumns );
263  aOpt.SetViewLayoutBookMode( bBookMode );
264  m_pWrtShell->ApplyViewOptions( aOpt );
265  }
266 
269 
270  }
271 
272  m_pWrtShell->UnlockPaint();
273  if( bUnLockView )
274  m_pWrtShell->LockView( false );
275 
276  SfxBindings& rBnd = GetViewFrame()->GetBindings();
277  rBnd.Invalidate( SID_ATTR_VIEWLAYOUT );
278  rBnd.Invalidate( SID_ATTR_ZOOMSLIDER);
279 }
280 
281 // Scrollbar - Handler
282 
283 IMPL_LINK( SwView, WindowChildEventListener, VclWindowEvent&, rEvent, void )
284 {
285  OSL_ENSURE( rEvent.GetWindow(), "Window???" );
286  vcl::Window* pChildWin = static_cast< vcl::Window* >( rEvent.GetData() );
287 
288  switch ( rEvent.GetId() )
289  {
290  case VclEventId::WindowHide:
291  if( pChildWin == m_pHScrollbar )
292  ShowHScrollbar( false );
293  else if( pChildWin == m_pVScrollbar )
294  ShowVScrollbar( false );
295  break;
296  case VclEventId::WindowShow:
297  if( pChildWin == m_pHScrollbar )
298  ShowHScrollbar( true );
299  else if( pChildWin == m_pVScrollbar )
300  ShowVScrollbar( true );
301  break;
302  default: break;
303  }
304 }
305 
306 void SwView::CreateScrollbar( bool bHori )
307 {
308  vcl::Window *pMDI = &GetViewFrame()->GetWindow();
309  VclPtr<SwScrollbar>& ppScrollbar = bHori ? m_pHScrollbar : m_pVScrollbar;
310 
311  assert(!ppScrollbar.get()); //check beforehand!
312 
313  ppScrollbar = VclPtr<SwScrollbar>::Create( pMDI, bHori );
315  if(bHori)
316  ppScrollbar->SetScrollHdl( LINK( this, SwView, EndScrollHdl ));
317  else
318  ppScrollbar->SetScrollHdl( LINK( this, SwView, ScrollHdl ));
319  ppScrollbar->SetEndScrollHdl( LINK( this, SwView, EndScrollHdl ));
320 
321  ppScrollbar->EnableDrag();
322 
323  if(GetWindow())
325 
326  if (!m_bShowAtResize)
327  ppScrollbar->ExtendedShow();
328 }
329 
330 IMPL_LINK( SwView, MoveNavigationHdl, void*, p, void )
331 {
332  bool* pbNext = static_cast<bool*>(p);
333  if ( !pbNext )
334  return;
335  const bool bNext = *pbNext;
336  SwWrtShell& rSh = GetWrtShell();
337  if ( NID_SRCH_REP != m_nMoveType)
338  {
339  if ( rSh.GetDrawView()->IsTextEdit() )
340  rSh.EndTextEdit();
341  if ( IsDrawMode() )
342  LeaveDrawCreate();
343  }
344  if ( NID_POSTIT != m_nMoveType && m_pPostItMgr )
345  {
346  sw::annotation::SwAnnotationWin* pActiveSidebarWin = m_pPostItMgr->GetActiveSidebarWin();
347  if (pActiveSidebarWin)
348  pActiveSidebarWin->SwitchToFieldPos();
349  }
350  switch( m_nMoveType )
351  {
352  case NID_PGE:
353  if ( bNext )
354  {
355  if ( USHRT_MAX == rSh.GetNextPrevPageNum( true ) )
356  {
357  rSh.GotoPage( 1, true );
358  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::EndWrapped );
359  }
360  else
361  {
362  PhyPageDown();
363  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
364  }
365  }
366  else
367  {
368  if ( USHRT_MAX == rSh.GetNextPrevPageNum( false ) )
369  {
370  rSh.GotoPage( rSh.GetPageCnt(), true );
371  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::StartWrapped );
372  }
373  else
374  {
375  PhyPageUp();
376  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
377  }
378  }
379  break;
380  case NID_TBL :
381  rSh.EnterStdMode();
382  if(bNext)
384  else
386  break;
387  case NID_FRM :
388  case NID_GRF:
389  case NID_OLE:
390  {
392  if(m_nMoveType == NID_GRF)
393  eType = GotoObjFlags::FlyGrf;
394  else if(m_nMoveType == NID_OLE)
395  eType = GotoObjFlags::FlyOLE;
396  bool bSuccess = bNext ?
397  rSh.GotoNextFly(eType) :
398  rSh.GotoPrevFly(eType);
399  if(bSuccess)
400  {
401  rSh.HideCursor();
402  rSh.EnterSelFrameMode();
403  }
404  }
405  break;
406  case NID_CTRL:
407  if (!rSh.GetView().IsDesignMode())
408  rSh.GetView().GetFormShell()->SetDesignMode(true);
409  [[fallthrough]];
410  case NID_DRW:
411  {
412  bool bSuccess = rSh.GotoObj(bNext,
413  m_nMoveType == NID_DRW ?
416  if(bSuccess)
417  {
418  rSh.HideCursor();
419  rSh.EnterSelFrameMode();
420  }
421  }
422  break;
423  case NID_REG :
424  rSh.EnterStdMode();
425  if(bNext)
427  else
429 
430  break;
431  case NID_BKM :
432  rSh.EnterStdMode();
433  GetViewFrame()->GetDispatcher()->Execute(bNext ?
436  break;
437  case NID_OUTL:
438  rSh.EnterStdMode();
439  bNext ? rSh.GotoNextOutline() : rSh.GotoPrevOutline();
440  break;
441  case NID_SEL :
443  break;
444  case NID_FTN:
445  {
446  bool bFrameTypeFootnote(rSh.GetFrameType(nullptr, false) & FrameTypeFlags::FOOTNOTE);
447 
448  if (bFrameTypeFootnote)
449  {
450  rSh.LockView(true);
451  rSh.GotoFootnoteAnchor();
452  }
453 
454  rSh.EnterStdMode();
455  bNext ?
456  rSh.GotoNextFootnoteAnchor() :
458 
459  if (bFrameTypeFootnote)
460  {
461  rSh.LockView(false);
462  rSh.GotoFootnoteText();
463  }
464  }
465  break;
466  case NID_MARK:
467  {
468  // unselect
469  rSh.MoveCursor();
470  rSh.EnterStdMode();
471 
472  // collect navigator reminders
473  IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
474  std::vector< const ::sw::mark::IMark* > vNavMarks;
475  for( IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getAllMarksBegin();
476  ppMark != pMarkAccess->getAllMarksEnd();
477  ++ppMark)
478  {
480  vNavMarks.push_back(*ppMark);
481  }
482 
483  // move
484  if(!vNavMarks.empty())
485  {
486  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
487 
488  if(bNext)
489  {
490  m_nActMark++;
491  if (m_nActMark >= MAX_MARKS || m_nActMark >= static_cast<sal_Int32>(vNavMarks.size()))
492  {
493  m_nActMark = 0;
494  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::EndWrapped );
495  }
496  }
497  else
498  {
499  m_nActMark--;
500  if (m_nActMark < 0 || m_nActMark >= static_cast<sal_Int32>(vNavMarks.size()))
501  {
502  m_nActMark = vNavMarks.size()-1;
503  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::StartWrapped );
504  }
505  }
506  rSh.GotoMark(vNavMarks[m_nActMark]);
507  }
508  else
509  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound );
510  }
511  break;
512 
513  case NID_POSTIT:
514  {
515  if ( m_pPostItMgr->HasNotes() )
516  {
517  rSh.EnterStdMode();
518  sw::annotation::SwAnnotationWin* pPostIt = GetPostItMgr()->GetActiveSidebarWin();
519  if (pPostIt)
520  GetPostItMgr()->SetActiveSidebarWin(nullptr);
521  SwFieldType* pFieldType = rSh.GetFieldType(0, SwFieldIds::Postit);
522  if ( !rSh.MoveFieldType( pFieldType, bNext ) )
523  {
524  bNext ? (*(m_pPostItMgr->begin()))->pPostIt->GotoPos() :
525  (*(m_pPostItMgr->end()-1))->pPostIt->GotoPos();
526  SvxSearchDialogWrapper::SetSearchLabel( bNext ? SearchLabel::EndWrapped : SearchLabel::StartWrapped );
527  }
528  else
529  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
530  GetViewFrame()->GetDispatcher()->Execute(FN_POSTIT);
531  }
532  else
533  SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound );
534  }
535  break;
536 
537  case NID_SRCH_REP:
538  if(s_pSrchItem)
539  {
540  bool bBackward = s_pSrchItem->GetBackward();
541  if (rSh.HasSelection() && bNext != rSh.IsCursorPtAtEnd())
542  rSh.SwapPam();
543  s_pSrchItem->SetBackward(!bNext);
544  SfxRequest aReq(FN_REPEAT_SEARCH, SfxCallMode::SLOT, GetPool());
545  ExecSearch(aReq);
546  s_pSrchItem->SetBackward(bBackward);
547  }
548  break;
549  case NID_INDEX_ENTRY:
550  rSh.GotoNxtPrvTOXMark(bNext);
551  break;
552 
553  case NID_TABLE_FORMULA:
554  rSh.GotoNxtPrvTableFormula( bNext );
555  break;
556 
558  rSh.GotoNxtPrvTableFormula( bNext, true );
559  break;
560  }
561  m_pEditWin->GrabFocus();
562  delete pbNext;
563 }
564 
566 {
568 
569  m_pHRuler->Show();
571 }
572 
574 {
575  m_pHRuler->Hide();
577 }
578 
580 {
581  if(m_pHRuler->GetUnit() != eUnit )
582  {
583  m_pHRuler->SetUnit( eUnit );
584  m_pHRuler->Invalidate();
585  }
586 }
587 
589 {
590  if(m_pVRuler->GetUnit() != eUnit)
591  {
592  m_pVRuler->SetUnit( eUnit );
593  m_pVRuler->Invalidate();
594  }
595 }
596 
597 void SwView::GetVRulerMetric(FieldUnit& eToFill) const
598 {
599  eToFill = m_pVRuler->GetUnit();
600 }
601 
602 void SwView::GetHRulerMetric(FieldUnit& eToFill) const
603 {
604  eToFill = m_pHRuler->GetUnit();
605 }
606 
608 {
609  m_pHRuler->SetBorderPos( m_pVRuler->GetSizePixel().Width()-1 );
610 
612  m_pVRuler->Show();
614 }
615 
617 {
618  m_pVRuler->Hide();
619  m_pHRuler->SetBorderPos();
621 }
622 
623 IMPL_LINK( SwView, ExecRulerClick, Ruler *, pRuler, void )
624 {
625  OUString sDefPage;
626  sal_uInt16 nDefDlg = SID_PARA_DLG;
627  switch( pRuler->GetClickType() )
628  {
629  case RulerType::DontKnow:
630  case RulerType::Outside:
631  sDefPage="labelTP_BORDER";
632  break;
633  case RulerType::Indent:
634  sDefPage="labelTP_PARA_STD";
635  break;
636  case RulerType::Margin1:
637  case RulerType::Margin2:
638  nDefDlg= FN_FORMAT_PAGE_DLG;
639  sDefPage = "page";
640  break;
641  default:
642  sDefPage = "labelTP_TABULATOR";
643 
644  }
645 
646  SfxStringItem aDefPage(nDefDlg, sDefPage);
647  GetViewFrame()->GetDispatcher()->ExecuteList(nDefDlg,
648  SfxCallMode::SYNCHRON|SfxCallMode::RECORD,
649  { &aDefPage });
650 }
651 
653 {
654  return m_nMoveType;
655 }
656 
657 void SwView::SetMoveType(sal_uInt16 nSet)
658 {
659  m_nMoveType = nSet;
660 }
661 
662 void SwView::SetActMark(sal_Int32 nSet)
663 {
664  m_nActMark = nSet;
665 }
666 
667 void SwView::ShowHScrollbar(bool bShow)
668 {
669  assert(m_pHScrollbar && "Scrollbar invalid");
670  m_pHScrollbar->ExtendedShow(bShow);
671 }
672 
674 {
675  assert(m_pHScrollbar && "Scrollbar invalid");
676  return m_pHScrollbar->IsVisible( false ) || m_pHScrollbar->IsAuto();
677 }
678 
679 void SwView::ShowVScrollbar(bool bShow)
680 {
681  assert(m_pVScrollbar && "Scrollbar invalid");
682  m_pVScrollbar->ExtendedShow(bShow);
683 }
684 
686 {
687  assert(m_pVScrollbar && "Scrollbar invalid");
688  return m_pVScrollbar->IsVisible( false );
689 }
690 
691 void SwView::EnableHScrollbar(bool bEnable)
692 {
693  if (m_bHScrollbarEnabled != bEnable)
694  {
695  m_bHScrollbarEnabled = bEnable;
697  }
698 }
699 
700 void SwView::EnableVScrollbar(bool bEnable)
701 {
702  if (m_bVScrollbarEnabled != bEnable)
703  {
704  m_bVScrollbarEnabled = bEnable;
706  }
707 }
708 
709 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwFieldType * GetFieldType(size_t nField, SwFieldIds nResId=SwFieldIds::Unknown) const
get field types with a ResId, if 0 get all
Definition: edfld.cxx:68
long GetLeft() const
SfxViewFrame * GetViewFrame() const
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:233
long Width() const
#define MINZOOM
Definition: view.hxx:82
FieldUnit
#define NID_GRF
Definition: workctrl.hxx:41
void SetActive(bool bOn=true)
void GetHRulerMetric(FieldUnit &rToFill) const
Definition: viewmdi.cxx:602
void SetReadonly(bool bSet)
Definition: viewopt.hxx:418
#define NID_POSTIT
Definition: workctrl.hxx:47
static sal_uInt16 GetMoveType()
Definition: viewmdi.cxx:652
SdrView * GetDrawView()
Definition: vnew.cxx:376
SwFrameFormat & GetLeft()
Definition: pagedesc.hxx:217
SfxViewFrame * GetFrame() const
void SetZoom(sal_uInt16 n)
Definition: viewopt.hxx:460
#define NID_BKM
Definition: workctrl.hxx:40
bool GotoPrevTable(SwPaM &rCurrentCursor, SwMoveFnCollection const &fnPosTable, bool bInReadOnly)
Definition: trvltbl.cxx:484
sal_uInt16 GetNextPrevPageNum(bool bNext=true)
Definition: crsrsh.cxx:1241
bool GotoNextFootnoteAnchor()
Definition: trvlfnfl.cxx:332
#define NID_MARK
Definition: workctrl.hxx:46
std::unique_ptr< SwWrtShell > m_pWrtShell
Definition: view.hxx:183
void SetViewLayout(sal_uInt16 nColumns, bool bBookMode, bool bViewOnly=false)
Definition: viewmdi.cxx:230
long Height() const
void ChangeTabMetric(FieldUnit eUnit)
Definition: viewmdi.cxx:579
bool MoveFieldType(const SwFieldType *pFieldType, const bool bNext, const SwFieldIds nResType=SwFieldIds::Unknown, const bool bAddSetExpressionFieldsToInputFields=true)
Definition: crstrvl.cxx:714
#define NID_SEL
Definition: workctrl.hxx:44
VclPtr< SvxRuler > m_pHRuler
Definition: view.hxx:200
wrapper iterator: wraps iterator of implementation while hiding MarkBase class; only IMark instances ...
static SW_DLLPUBLIC MarkType GetType(const ::sw::mark::IMark &rMark)
Returns the MarkType used to create the mark.
Definition: docbm.cxx:483
Provides access to the marks of a document.
void SetViewLayoutColumns(sal_uInt16 nNew)
Definition: viewopt.hxx:436
#define NID_TABLE_FORMULA
Definition: workctrl.hxx:50
void Height(long nNew)
Definition: swrect.hxx:189
#define NID_OUTL
Definition: workctrl.hxx:43
bool GotoFootnoteAnchor()
jump from footnote to anchor
Definition: trvlfnfl.cxx:161
void EnterStdMode()
Definition: select.cxx:552
SwEditWin & GetEditWin()
Definition: view.hxx:403
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
void Invalidate(sal_uInt16 nId)
bool GotoNxtPrvTableFormula(bool bNext=true, bool bOnlyErrors=false)
Jump to next/previous table formula Optionally it is possible to also jump to broken formulas...
Definition: crstrvl.cxx:416
bool GotoNextFly(GotoObjFlags eType=GotoObjFlags::FlyAny)
Independent selecting of flys.
Definition: fesh.hxx:409
UseOnPage GetUseOn() const
Definition: pagedesc.hxx:329
void SetVisArea(const tools::Rectangle &, bool bUpdateScrollbar=true)
Definition: viewport.cxx:209
#define NID_SRCH_REP
Definition: workctrl.hxx:48
SvxZoomType GetZoomType() const
Definition: viewopt.hxx:500
void SwapPam()
Definition: crsrsh.cxx:964
Used by the UI to modify the document model.
Definition: wrtsh.hxx:88
static UITestLogger & getInstance()
void logEvent(const EventDescription &rDescription)
vcl::Window & GetWindow() const
bool IsReadonly() const
Definition: viewopt.hxx:417
const SwView & GetView() const
Definition: wrtsh.hxx:426
void InvalidateBorder()
void Top(const long nTop)
Definition: swrect.hxx:202
bool m_bVScrollbarEnabled
Definition: view.hxx:195
bool IsVisible(bool bReal) const
Definition: scroll.hxx:39
void setX(long nX)
bool GotoFootnoteText()
jump from content to footnote
Definition: trvlfnfl.cxx:88
SfxFrame & GetFrame() const
const IDocumentMarkAccess * getIDocumentMarkAccess() const
Provides access to the document bookmark interface.
Definition: viewsh.cxx:2592
SAL_DLLPRIVATE void SetZoom_(const Size &rEditSz, SvxZoomType eZoomType, short nFactor, bool bViewOnly)
Definition: viewmdi.cxx:93
void setY(long nY)
void CreateVRuler()
Definition: viewmdi.cxx:607
void KillVRuler()
Definition: viewmdi.cxx:616
#define FN_NEXT_BOOKMARK
Definition: cmdid.h:112
GotoObjFlags
values can be combined via logical or
Definition: fesh.hxx:86
virtual const_iterator_t getAllMarksBegin() const =0
returns a STL-like random access iterator to the begin of the sequence of marks.
virtual bool IsDesignMode() const
Class for automated call of Start- and EndAction().
Definition: editsh.hxx:1016
virtual FmFormShell * GetFormShell() override
Definition: view.hxx:564
void SetZoomType(SvxZoomType eZoom_)
Definition: viewopt.hxx:526
bool HasSelection() const
Definition: wrtsh.hxx:139
#define SW_MOD()
Definition: swmodule.hxx:255
virtual const_iterator_t getAllMarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of marks.
#define NID_INDEX_ENTRY
Definition: workctrl.hxx:49
sal_uInt16 GetPageCnt()
Definition: crsrsh.cxx:1279
bool IsViewLayoutBookMode() const
Definition: viewopt.hxx:433
static sal_Int32 m_nActMark
Definition: view.hxx:157
const long nLeftOfst
Definition: view.hxx:78
bool GoNextPrevCursorSetSearchLabel(const bool bNext)
Definition: crsrsh.cxx:1382
SfxBindings & GetBindings()
long Bottom() const
#define NID_REG
Definition: workctrl.hxx:39
#define NID_TABLE_FORMULA_ERROR
Definition: workctrl.hxx:51
void ShowVScrollbar(bool bShow)
Definition: viewmdi.cxx:679
bool GotoPrevOutline()
jump to previous node with outline num.
Definition: crstrvl.cxx:1092
bool IsHScrollbarVisible() const
Definition: viewmdi.cxx:673
#define NID_FTN
Definition: workctrl.hxx:45
static void SetMoveType(sal_uInt16 nSet)
Definition: viewmdi.cxx:657
IMPL_LINK(SwView, WindowChildEventListener, VclWindowEvent &, rEvent, void)
Definition: viewmdi.cxx:283
DocumentType const eType
void EnableHScrollbar(bool bEnable)
Definition: viewmdi.cxx:691
void CreateTab()
Definition: viewmdi.cxx:565
VclPtr< SvxRuler > m_pVRuler
Definition: view.hxx:200
static void SetSearchLabel(const SearchLabel &rSL)
SAL_DLLPRIVATE void CalcVisArea(const Size &rPixelSz)
Definition: viewport.cxx:778
#define NID_DRW
Definition: workctrl.hxx:37
void ShowHScrollbar(bool bShow)
Definition: viewmdi.cxx:667
bool GotoPrevFootnoteAnchor()
Definition: trvlfnfl.cxx:337
Rect of current page.
bool GotoObj(bool bNext, GotoObjFlags eType=GotoObjFlags::DrawAny)
Definition: feshview.cxx:1667
void EnableVScrollbar(bool bEnable)
Definition: viewmdi.cxx:700
void SetDesignMode(bool _bDesignMode)
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:216
#define NID_OLE
Definition: workctrl.hxx:42
void GotoMark(const ::sw::mark::IMark *const pMark)
Definition: wrtsh3.cxx:138
bool GotoNextRegion(SwPaM &rCurrentCursor, SwMoveFnCollection const &fnPosRegion, bool bInReadOnly)
Definition: trvlreg.cxx:104
void SetZoom(SvxZoomType eZoomType, short nFactor=100, bool bViewOnly=false)
Definition: viewmdi.cxx:82
void Bottom(const long nBottom)
Definition: swrect.hxx:207
#define NID_PGE
Definition: workctrl.hxx:36
bool MoveRegion(SwWhichRegion, SwMoveFnCollection const &)
Definition: trvlreg.cxx:232
void SetViewLayoutBookMode(bool bNew)
Definition: viewopt.hxx:434
#define NID_CTRL
Definition: workctrl.hxx:38
VclPtr< SwScrollbar > m_pVScrollbar
Definition: view.hxx:191
virtual bool IsTextEdit() const final override
bool GotoPrevFly(GotoObjFlags eType=GotoObjFlags::FlyAny)
Definition: fesh.hxx:411
#define NID_TBL
Definition: workctrl.hxx:34
Rect covering the pages area.
SwMoveFnCollection const & fnTableStart
Definition: paminit.cxx:52
void MoveCursor(bool bWithSelect=false)
Definition: move.cxx:66
bool IsInPlace() const
bool m_bShowAtResize
Definition: view.hxx:229
bool IsVScrollbarVisible() const
Definition: viewmdi.cxx:685
void LockView(bool b)
Definition: viewsh.hxx:465
bool MoveTable(SwWhichTable, SwMoveFnCollection const &)
Definition: trvltbl.cxx:685
bool IsCursorPtAtEnd() const
Definition: crsrsh.hxx:892
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:261
... page will be formatted if required.
static VclPtr< reference_type > Create(Arg &&...arg)
void ChangeVRulerMetric(FieldUnit eUnit)
Definition: viewmdi.cxx:588
VclPtr< SwScrollbar > m_pHScrollbar
Definition: view.hxx:191
SwPostItMgr * GetPostItMgr()
Definition: view.hxx:621
sal_uInt16 GetZoom() const
Definition: viewopt.hxx:459
void EndTextEdit()
Deletes object if required.
Definition: feshview.cxx:1235
static sal_uInt16 m_nMoveType
Definition: view.hxx:156
#define FN_FORMAT_PAGE_DLG
Definition: cmdid.h:299
vcl::Window * GetWindow() const
void GetVRulerMetric(FieldUnit &rToFill) const
Definition: viewmdi.cxx:597
long GetRight() const
const tools::Rectangle & GetVisArea() const
Definition: view.hxx:413
bool IsAuto()
Definition: scroll.hxx:49
bool GotoPrevRegion(SwPaM &rCurrentCursor, SwMoveFnCollection const &fnPosRegion, bool bInReadOnly)
Definition: trvlreg.cxx:31
bool IsActive() const
#define FN_REPEAT_SEARCH
Definition: cmdid.h:102
bool GotoPage(sal_uInt16 nPage, bool bRecord)
Definition: move.cxx:565
reference_type * get() const
bool GotoNxtPrvTOXMark(bool bNext=true)
jump to next/previous index marker
Definition: crstrvl.cxx:531
SAL_DLLPRIVATE bool UpdateScrollbars()
Definition: viewport.cxx:1165
bool GotoNextTable(SwPaM &rCurrentCursor, SwMoveFnCollection const &fnPosTable, bool bInReadOnly)
Definition: trvltbl.cxx:564
void SetModified()
Definition: usrpref.hxx:157
void EnterSelFrameMode(const Point *pStartDrag=nullptr)
Definition: select.cxx:703
SvxZoomType
void ForceUpdate()
void KillTab()
Definition: viewmdi.cxx:573
std::map< OUString, OUString > aParameters
void ExtendedShow(bool bVisible=true)
Definition: scroll.cxx:76
#define DOCUMENTBORDER
Definition: swtypes.hxx:82
#define FN_PREV_BOOKMARK
Definition: cmdid.h:113
SAL_DLLPRIVATE void CreateScrollbar(bool bHori)
Definition: viewmdi.cxx:306
bool m_bHScrollbarEnabled
Definition: view.hxx:194
#define MAX_MARKS
Definition: view.hxx:85
#define NID_FRM
Definition: workctrl.hxx:35
FrameTypeFlags GetFrameType(const Point *pPt, bool bStopAtFly) const
For return values see above FrameType.
Definition: fews.cxx:238
sal_uInt16 GetViewLayoutColumns() const
Definition: viewopt.hxx:435
#define FN_POSTIT
Definition: cmdid.h:206
void HideCursor()
Definition: crsrsh.cxx:2313
Definition: view.hxx:146
long Y() const
static void SetActMark(sal_Int32 nSet)
Definition: viewmdi.cxx:662
bool GotoNextOutline()
jump to next node with outline num.
Definition: crstrvl.cxx:1026
const SvxLRSpaceItem & GetLRSpace(bool=true) const
Definition: frmatr.hxx:74
SwMoveFnCollection const & fnRegionStart
Definition: paminit.cxx:55