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{
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 {
432 rSh.EnterStdMode();
433 rSh.StartAction();
434 SearchLabel eSearchLabel = SearchLabel::Empty;
435 if (!rSh.MoveFieldType(nullptr, bNext, SwFieldIds::Unknown))
436 {
437 // no field found in the move direction
438 // wrap and try again
439 SwShellCursor* pCursor = rSh.GetCursor_();
440 SwCursorSaveState aSaveState(*pCursor);
441 rSh.SttEndDoc(bNext);
442 // document might have a field at the start of the document
443 SwField* pField = rSh.GetCurField();
444 if ((bNext && pField && pField->GetTypeId() != SwFieldTypesEnum::Postit) ||
445 rSh.MoveFieldType(nullptr, bNext, SwFieldIds::Unknown))
446 {
447 eSearchLabel = bNext ? SearchLabel::EndWrapped : SearchLabel::StartWrapped;
448 }
449 else
450 {
451 // no visible fields found
452 pCursor->RestoreSavePos();
453 eSearchLabel = SearchLabel::NavElementNotFound;
454 }
455 }
457 rSh.EndAction();
458 }
459 break;
460 case NID_FIELD_BYTYPE:
461 {
462 // see: SwFieldMgr::GoNextPrev
463 SwField* pCurField = rSh.GetCurField(true);
464 if (!pCurField)
465 break;
466 rSh.EnterStdMode();
467 SwFieldType* pTyp = nullptr;
468 const SwFieldTypesEnum nTypeId = pCurField->GetTypeId();
469 if (SwFieldTypesEnum::SetInput == nTypeId || SwFieldTypesEnum::UserInput == nTypeId)
470 pTyp = rSh.GetFieldType(0, SwFieldIds::Input);
471 else
472 pTyp = pCurField->GetTyp();
473 if (pTyp)
474 {
475 if (pTyp->Which() == SwFieldIds::Database)
476 rSh.MoveFieldType(nullptr, bNext, SwFieldIds::Database);
477 else
478 rSh.MoveFieldType(pTyp, bNext);
479 }
480 }
481 break;
482 case NID_OUTL:
483 rSh.EnterStdMode();
484 bNext ? rSh.GotoNextOutline() : rSh.GotoPrevOutline();
485 break;
486 case NID_SEL :
488 break;
489 case NID_FTN:
490 {
491 bool bFrameTypeFootnote(rSh.GetFrameType(nullptr, false) & FrameTypeFlags::FOOTNOTE);
492
493 if (bFrameTypeFootnote)
494 {
495 rSh.LockView(true);
496 rSh.GotoFootnoteAnchor();
497 }
498
499 rSh.EnterStdMode();
500 bNext ?
503
504 if (bFrameTypeFootnote)
505 {
506 rSh.LockView(false);
507 rSh.GotoFootnoteText();
508 }
509 }
510 break;
511 case NID_MARK:
512 {
513 // unselect
514 rSh.MoveCursor();
515 rSh.EnterStdMode();
516
517 // collect and sort navigator reminder names
518 IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
519 std::vector< OUString > vNavMarkNames;
521 ppMark != pMarkAccess->getAllMarksEnd();
522 ++ppMark)
523 {
525 vNavMarkNames.push_back((*ppMark)->GetName());
526 }
527 std::sort(vNavMarkNames.begin(), vNavMarkNames.end());
528
529 // move
530 if(!vNavMarkNames.empty())
531 {
532 SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
533
534 if(bNext)
535 {
536 s_nActMark++;
537 if (s_nActMark >= MAX_MARKS || s_nActMark >= static_cast<sal_Int32>(vNavMarkNames.size()))
538 {
539 s_nActMark = 0;
540 SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::ReminderEndWrapped );
541 }
542 }
543 else
544 {
545 s_nActMark--;
546 if (s_nActMark < 0 || o3tl::make_unsigned(s_nActMark) >= vNavMarkNames.size())
547 {
548 s_nActMark = vNavMarkNames.size()-1;
549 SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::ReminderStartWrapped );
550 }
551 }
552 rSh.GotoMark(vNavMarkNames[s_nActMark]);
553 }
554 else
555 SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound );
556 }
557 break;
558
559 case NID_POSTIT:
560 {
561 if (m_pPostItMgr->HasNotes())
562 {
563 rSh.EnterStdMode();
564 m_pPostItMgr->AssureStdModeAtShell();
565 m_pPostItMgr->SetActiveSidebarWin(nullptr);
566 GetEditWin().GrabFocus();
567 SwShellCursor* pCursor = rSh.GetCursor_();
568 SwCursorSaveState aSaveState(*pCursor);
569 SwFieldType* pFieldType = rSh.GetFieldType(0, SwFieldIds::Postit);
570 bool bWrapped = false;
571 bool bFound = false;
572 rSh.StartAction();
573 while (!bFound)
574 {
575 if (!rSh.MoveFieldType(pFieldType, bNext))
576 {
577 if (bWrapped)
578 break;
579 bWrapped = true;
580 rSh.SttEndDoc(bNext);
581 continue;
582 }
583 do
584 {
585 auto pAnnotationWin = m_pPostItMgr->GetAnnotationWin(
587 if (pAnnotationWin && pAnnotationWin->IsVisible())
588 bFound = true;
589 } while (!bFound && rSh.MoveFieldType(pFieldType, bNext));
590 }
591 if (!bFound)
592 {
593 pCursor->RestoreSavePos();
594 SvxSearchDialogWrapper::SetSearchLabel(SearchLabel::NavElementNotFound);
595 }
596 rSh.EndAction();
597 if (bFound)
598 {
599 GetViewFrame().GetDispatcher()->Execute(FN_POSTIT);
600 if (bWrapped)
601 SvxSearchDialogWrapper::SetSearchLabel(bNext ? SearchLabel::EndWrapped :
602 SearchLabel::StartWrapped);
603 else
604 SvxSearchDialogWrapper::SetSearchLabel(SearchLabel::Empty);
605 }
606 }
607 else
608 SvxSearchDialogWrapper::SetSearchLabel(SearchLabel::NavElementNotFound);
609 }
610 break;
611
612 case NID_SRCH_REP:
613 if(s_pSrchItem)
614 {
615 bool bBackward = s_pSrchItem->GetBackward();
616 if (rSh.HasSelection() && bNext != rSh.IsCursorPtAtEnd())
617 rSh.SwapPam();
618 s_pSrchItem->SetBackward(!bNext);
619 SfxRequest aReq(FN_REPEAT_SEARCH, SfxCallMode::SLOT, GetPool());
620 ExecSearch(aReq);
621 s_pSrchItem->SetBackward(bBackward);
622 }
623 break;
624 case NID_INDEX_ENTRY:
625 rSh.GotoNxtPrvTOXMark(bNext);
626 break;
627
629 rSh.GotoNxtPrvTableFormula( bNext );
630 break;
631
633 rSh.GotoNxtPrvTableFormula( bNext, true );
634 break;
635
636 case NID_RECENCY :
637 rSh.EnterStdMode();
638 bNext ? rSh.GetNavigationMgr().goForward() : rSh.GetNavigationMgr().goBack();
639 break;
640 }
641 if (NID_POSTIT != s_nMoveType)
642 m_pEditWin->GrabFocus();
643 delete pbNext;
644}
645
647{
648 m_pHRuler->SetActive(GetFrame() && IsActive());
649
650 m_pHRuler->Show();
652}
653
655{
656 m_pHRuler->Hide();
658}
659
661{
662 if(m_pHRuler->GetUnit() != eUnit )
663 {
664 m_pHRuler->SetUnit( eUnit );
665 m_pHRuler->Invalidate();
666 }
667}
668
670{
671 if(m_pVRuler->GetUnit() != eUnit)
672 {
673 m_pVRuler->SetUnit( eUnit );
674 m_pVRuler->Invalidate();
675 }
676}
677
679{
680 eToFill = m_pVRuler->GetUnit();
681}
682
684{
685 eToFill = m_pHRuler->GetUnit();
686}
687
689{
690 m_pHRuler->SetBorderPos( m_pVRuler->GetSizePixel().Width()-1 );
691
692 m_pVRuler->SetActive(GetFrame() && IsActive());
693 m_pVRuler->Show();
695}
696
698{
699 m_pVRuler->Hide();
700 m_pHRuler->SetBorderPos();
702}
703
704IMPL_LINK( SwView, ExecRulerClick, Ruler *, pRuler, void )
705{
706 OUString sDefPage;
707 sal_uInt16 nDefDlg = SID_PARA_DLG;
708 switch( pRuler->GetClickType() )
709 {
710 case RulerType::DontKnow:
711 case RulerType::Outside:
712 sDefPage="labelTP_BORDER";
713 break;
714 case RulerType::Indent:
715 sDefPage="labelTP_PARA_STD";
716 break;
717 case RulerType::Margin1:
718 case RulerType::Margin2:
719 nDefDlg= FN_FORMAT_PAGE_DLG;
720 sDefPage = "page";
721 break;
722 default:
723 sDefPage = "labelTP_TABULATOR";
724
725 }
726
727 SfxStringItem aDefPage(nDefDlg, sDefPage);
728 GetViewFrame().GetDispatcher()->ExecuteList(nDefDlg,
729 SfxCallMode::SYNCHRON|SfxCallMode::RECORD,
730 { &aDefPage });
731}
732
734{
735 return s_nMoveType;
736}
737
738void SwView::SetMoveType(sal_uInt16 nSet)
739{
740 s_nMoveType = nSet;
741}
742
743void SwView::SetActMark(sal_Int32 nSet)
744{
745 s_nActMark = nSet;
746}
747
749{
750 assert(m_pHScrollbar && "Scrollbar invalid");
751 m_pHScrollbar->ExtendedShow(bShow);
752}
753
755{
756 assert(m_pHScrollbar && "Scrollbar invalid");
757 return m_pHScrollbar->IsScrollbarVisible(false) || m_pHScrollbar->IsAuto();
758}
759
761{
762 assert(m_pVScrollbar && "Scrollbar invalid");
763 m_pVScrollbar->ExtendedShow(bShow);
764}
765
767{
768 assert(m_pVScrollbar && "Scrollbar invalid");
769 return m_pVScrollbar->IsScrollbarVisible(false);
770}
771
772void SwView::EnableHScrollbar(bool bEnable)
773{
774 if (m_bHScrollbarEnabled != bEnable)
775 {
776 m_bHScrollbarEnabled = bEnable;
778 }
779}
780
781void SwView::EnableVScrollbar(bool bEnable)
782{
783 if (m_bVScrollbarEnabled != bEnable)
784 {
785 m_bVScrollbarEnabled = bEnable;
787 }
788}
789
790/* 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:489
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:1187
bool GotoPrevOutline()
jump to previous node with outline num.
Definition: crstrvl.cxx:1252
void StartAction()
Definition: crsrsh.cxx:226
bool GotoNextFootnoteAnchor()
Definition: trvlfnfl.cxx:339
SwShellCursor * GetCursor_()
Definition: crsrsh.hxx:341
void SwapPam()
Definition: crsrsh.cxx:990
const SwPostItField * GetPostItFieldAtCursor() const
Definition: crstrvl.cxx:2075
void HideCursor()
Definition: crsrsh.cxx:2443
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:1068
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:1408
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:917
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:1305
void RestoreSavePos()
Restore cursor state to the one saved by SwCursorSaveState.
Definition: swcrsr.cxx:2341
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:244
SwFieldIds Which() const
Definition: fldbas.hxx:275
Base class of all fields.
Definition: fldbas.hxx:295
SwFieldTypesEnum GetTypeId() const
Definition: fldbas.cxx:261
SwFieldType * GetTyp() const
Definition: fldbas.hxx:401
const SvxLRSpaceItem & GetLRSpace(bool=true) const
Definition: frmatr.hxx:98
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:2128
bool ShowNotes() const
Definition: PostItMgr.cxx:2122
tools::ULong GetSidebarWidth(bool bPx=false) const
Definition: PostItMgr.cxx:2133
tools::ULong GetSidebarBorderWidth(bool bPx=false) const
Definition: PostItMgr.cxx:2159
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:629
bool IsViewLayoutBookMode() const
Definition: viewopt.hxx:645
SvxZoomType GetZoomType() const
Definition: viewopt.hxx:712
sal_uInt16 GetZoom() const
Definition: viewopt.hxx:671
void SetZoomType(SvxZoomType eZoom_)
Definition: viewopt.hxx:738
void SetZoom(sal_uInt16 n)
Definition: viewopt.hxx:672
sal_uInt16 GetViewLayoutColumns() const
Definition: viewopt.hxx:647
void SetReadonly(bool bSet)
Definition: viewopt.hxx:630
void SetViewLayoutColumns(sal_uInt16 nNew)
Definition: viewopt.hxx:648
void SetViewLayoutBookMode(bool bNew)
Definition: viewopt.hxx:646
const IDocumentMarkAccess * getIDocumentMarkAccess() const
Provides access to the document bookmark interface.
Definition: viewsh.cxx:2813
void LockView(bool b)
Definition: viewsh.hxx:473
Point GetPagePos(sal_uInt16 nPageNum) const
Definition: viewsh.cxx:687
void GetFirstLastVisPageNumbers(SwVisiblePageNumbers &rVisiblePageNumbers)
Definition: viewsh.cxx:2768
SdrView * GetDrawView()
Definition: vnew.cxx:373
Definition: view.hxx:146
void GetHRulerMetric(FieldUnit &rToFill) const
Definition: viewmdi.cxx:683
SAL_DLLPRIVATE bool UpdateScrollbars()
Definition: viewport.cxx:1149
VclPtr< SwScrollbar > m_pHScrollbar
Definition: view.hxx:202
bool m_bShowAtResize
Definition: view.hxx:252
void CreateVRuler()
Definition: viewmdi.cxx:688
static void SetActMark(sal_Int32 nSet)
Definition: viewmdi.cxx:743
static sal_uInt16 s_nMoveType
Definition: view.hxx:167
void EnableVScrollbar(bool bEnable)
Definition: viewmdi.cxx:781
std::unique_ptr< SwWrtShell > m_pWrtShell
Definition: view.hxx:194
void GetVRulerMetric(FieldUnit &rToFill) const
Definition: viewmdi.cxx:678
VclPtr< SwScrollbar > m_pVScrollbar
Definition: view.hxx:203
virtual FmFormShell * GetFormShell() override
Definition: view.hxx:587
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:646
void SetViewLayout(sal_uInt16 nColumns, bool bBookMode, bool bViewOnly=false)
Definition: viewmdi.cxx:224
void ShowHScrollbar(bool bShow)
Definition: viewmdi.cxx:748
void EnableHScrollbar(bool bEnable)
Definition: viewmdi.cxx:772
const tools::Rectangle & GetVisArea() const
Definition: view.hxx:434
bool IsHScrollbarVisible() const
Definition: viewmdi.cxx:754
SwPostItMgr * GetPostItMgr()
Definition: view.hxx:648
void ChangeVRulerMetric(FieldUnit eUnit)
Definition: viewmdi.cxx:669
static sal_Int32 s_nActMark
Definition: view.hxx:168
bool IsVScrollbarVisible() const
Definition: viewmdi.cxx:766
SwEditWin & GetEditWin()
Definition: view.hxx:424
void KillTab()
Definition: viewmdi.cxx:654
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:697
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:733
void ShowVScrollbar(bool bShow)
Definition: viewmdi.cxx:760
bool m_bHScrollbarEnabled
Definition: view.hxx:205
static void SetMoveType(sal_uInt16 nSet)
Definition: viewmdi.cxx:738
void SetZoom(SvxZoomType eZoomType, short nFactor=100, bool bViewOnly=false)
Definition: viewmdi.cxx:73
void ChangeTabMetric(FieldUnit eUnit)
Definition: viewmdi.cxx:660
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
void EnterSelFrameMode(const Point *pStartDrag=nullptr)
Definition: select.cxx:703
void addCurrentPosition()
Definition: wrtsh1.cxx:1863
void GotoMark(const ::sw::mark::IMark *const pMark)
Definition: wrtsh3.cxx:272
void EnterStdMode()
Definition: select.cxx:552
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:111
#define FN_POSTIT
Definition: cmdid.h:230
#define FN_PREV_BOOKMARK
Definition: cmdid.h:122
#define FN_FORMAT_PAGE_DLG
Definition: cmdid.h:347
#define FN_NEXT_BOOKMARK
Definition: cmdid.h:121
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:95
@ 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
SearchLabel
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