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