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