LibreOffice Module sw (master) 1
viewport.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 <vcl/commandevent.hxx>
21#include <vcl/help.hxx>
22#include <vcl/settings.hxx>
23#include <vcl/syswin.hxx>
24
25#include <svx/ruler.hxx>
26#include <sfx2/bindings.hxx>
27#include <sfx2/viewfrm.hxx>
28#include <view.hxx>
29#include <wrtsh.hxx>
30#include <viewopt.hxx>
31#include <docsh.hxx>
32#include <cmdid.h>
33#include <edtwin.hxx>
34#include <scroll.hxx>
35
36#include <PostItMgr.hxx>
37
39#include <comphelper/lok.hxx>
40#include <vcl/weld.hxx>
41#include <tools/svborder.hxx>
42#include <osl/diagnose.h>
43
44#include "viewfunc.hxx"
45
47
48// The SetVisArea of the DocShell must not be called from InnerResizePixel.
49// But our adjustments must take place.
50static bool bProtectDocShellVisArea = false;
51
52static sal_uInt16 nPgNum = 0;
53
55{
56 if (GetDocShell()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED)
57 return true;
58
59 if (!m_pWrtShell)
60 return false;
61
62 return m_pWrtShell->GetViewOptions()->getBrowseMode() ||
63 SvxZoomType::PAGEWIDTH_NOBORDER == m_pWrtShell->GetViewOptions()->GetZoomType();
64}
65
66static tools::Long GetLeftMargin( SwView const &rView )
67{
70 return eType == SvxZoomType::PERCENT ? lRet + DOCUMENTBORDER :
71 eType == SvxZoomType::PAGEWIDTH || eType == SvxZoomType::PAGEWIDTH_NOBORDER ? 0 :
73}
74
75static void lcl_GetPos(SwView const * pView,
76 Point& rPos,
77 const weld::Scrollbar& rScrollbar,
78 bool bHori,
79 bool bBorder)
80{
81 SwWrtShell &rSh = pView->GetWrtShell();
82 const Size aDocSz( rSh.GetDocSize() );
83
84 const tools::Long lBorder = bBorder ? DOCUMENTBORDER : DOCUMENTBORDER * 2;
85
86 const tools::Long lPos = rScrollbar.adjustment_get_value() + (bBorder ? DOCUMENTBORDER : 0);
87
88 tools::Long lDelta = lPos - (bHori ? rSh.VisArea().Pos().X() : rSh.VisArea().Pos().Y());
89
90 const tools::Long lSize = (bHori ? aDocSz.Width() : aDocSz.Height()) + lBorder;
91 // Should right or below are too much space,
92 // then they must be subtracted out of the VisArea!
93 tools::Long nTmp = pView->GetVisArea().Right()+lDelta;
94 if ( bHori && nTmp > lSize )
95 lDelta -= nTmp - lSize;
96 nTmp = pView->GetVisArea().Bottom()+lDelta;
97 if ( !bHori && nTmp > lSize )
98 lDelta -= nTmp - lSize;
99
100 bHori ? rPos.AdjustX(lDelta) : rPos.AdjustY(lDelta);
101 if ( bBorder && (bHori ? rPos.X() : rPos.Y()) < DOCUMENTBORDER )
102 bHori ? rPos.setX(DOCUMENTBORDER) : rPos.setY(DOCUMENTBORDER);
103}
104
105// Set zero ruler
106
108{
109 static sal_uInt16 aInval[] =
110 {
111 SID_ATTR_PARA_LRSPACE, SID_RULER_BORDERS, SID_RULER_PAGE_POS,
112 SID_RULER_LR_MIN_MAX, SID_ATTR_LONG_ULSPACE, SID_ATTR_LONG_LRSPACE,
113 SID_RULER_BORDER_DISTANCE,
114 SID_ATTR_PARA_LRSPACE_VERTICAL, SID_RULER_BORDERS_VERTICAL,
115 SID_RULER_TEXT_RIGHT_TO_LEFT,
116 SID_RULER_ROWS, SID_RULER_ROWS_VERTICAL, FN_STAT_PAGE,
117 0
118 };
119
121
122 assert(m_pHRuler && "Why is the ruler not there?");
123 m_pHRuler->ForceUpdate();
124 m_pVRuler->ForceUpdate();
125}
126
127// Limits the scrolling so far that only a quarter of the
128// screen can be scrolled up before the end of the document.
129
131{
133 const tools::Long lSize = GetDocSz().Width() + lBorder - m_aVisArea.GetWidth();
134
135 // At negative values the document is completely visible.
136 // In this case, no scrolling.
137 return std::clamp( lSize, tools::Long(0), lMax );
138}
139
141{
143 tools::Long lSize = GetDocSz().Height() + lBorder - m_aVisArea.GetHeight();
144 return std::clamp( lSize, tools::Long(0), lMax ); // see horizontal
145}
146
147Point SwView::AlignToPixel(const Point &rPt) const
148{
149 return GetEditWin().PixelToLogic( GetEditWin().LogicToPixel( rPt ) );
150}
151
152// Document size has changed.
153
154void SwView::DocSzChgd(const Size &rSz)
155{
156 m_aDocSz = rSz;
157
158 if( !m_pWrtShell || m_aVisArea.IsEmpty() ) // no shell -> no change
159 {
160 bDocSzUpdated = false;
161 return;
162 }
163
164 //If text has been deleted, it may be that the VisArea points behind the visible range.
165 tools::Rectangle aNewVisArea( m_aVisArea );
166 bool bModified = false;
167 SwTwips lGreenOffset = IsDocumentBorder() ? DOCUMENTBORDER : DOCUMENTBORDER * 2;
168 SwTwips lTmp = m_aDocSz.Width() + lGreenOffset;
169
170 if ( aNewVisArea.Right() >= lTmp )
171 {
172 lTmp = aNewVisArea.Right() - lTmp;
173 aNewVisArea.AdjustRight( -lTmp );
174 aNewVisArea.AdjustLeft( -lTmp );
175 bModified = true;
176 }
177
178 lTmp = m_aDocSz.Height() + lGreenOffset;
179 if ( aNewVisArea.Bottom() >= lTmp )
180 {
181 lTmp = aNewVisArea.Bottom() - lTmp;
182 aNewVisArea.AdjustBottom( -lTmp );
183 aNewVisArea.AdjustTop( -lTmp );
184 bModified = true;
185 }
186
187 if ( bModified )
188 SetVisArea( aNewVisArea, false );
189
191 !GetViewFrame()->GetFrame().IsInPlace())
193 GetViewFrame()->GetWindow().GetOutputSizePixel() );
194}
195
196// Set VisArea newly
197
198void SwView::SetVisArea( const tools::Rectangle &rRect, bool bUpdateScrollbar )
199{
200 Size aOldSz( m_aVisArea.GetSize() );
202 // If m_pWrtShell's visible area is the whole document, do the same here.
203 aOldSz = m_pWrtShell->VisArea().SSize();
204
205 if( rRect == m_aVisArea )
206 return;
207
208 const SwTwips lMin = IsDocumentBorder() ? DOCUMENTBORDER : 0;
209
210 // No negative position, no negative size
211 tools::Rectangle aLR = rRect;
212 if( aLR.Top() < lMin )
213 {
214 aLR.AdjustBottom(lMin - aLR.Top() );
215 aLR.SetTop( lMin );
216 }
217 if( aLR.Left() < lMin )
218 {
219 aLR.AdjustRight(lMin - aLR.Left() );
220 aLR.SetLeft( lMin );
221 }
222 if( aLR.Right() < 0 )
223 aLR.SetRight( 0 );
224 if( aLR.Bottom() < 0 )
225 aLR.SetBottom( 0 );
226
227 if( aLR == m_aVisArea )
228 return;
229
230 const Size aSize( aLR.GetSize() );
231 if( aSize.IsEmpty() )
232 return;
233
234 // Before the data can be changed, call an update if necessary. This
235 // ensures that adjacent Paints in document coordinates are converted
236 // correctly.
237 // As a precaution, we do this only when an action is running in the
238 // shell, because then it is not really drawn but the rectangles will
239 // be only marked (in document coordinates).
240 if ( m_pWrtShell && m_pWrtShell->ActionPend() )
241 m_pWrtShell->GetWin()->PaintImmediately();
242
243 m_aVisArea = aLR;
244
245 const bool bOuterResize = bUpdateScrollbar && UpdateScrollbars();
246
247 if ( m_pWrtShell )
248 {
249 m_pWrtShell->VisPortChgd( SwRect(m_aVisArea) );
250 if ( aOldSz != m_pWrtShell->VisArea().SSize() &&
251 ( std::abs(aOldSz.Width() - m_pWrtShell->VisArea().Width()) > 2 ||
252 std::abs(aOldSz.Height() - m_pWrtShell->VisArea().Height()) > 2 ) )
253 m_pWrtShell->InvalidateLayout( false );
254 }
255
257 {
258 // If the size of VisArea is unchanged, we extend the size of the VisArea
259 // InternalObject on. By that the transport of errors shall be avoided.
261 if ( aVis.GetSize() == aOldSz )
263 // TODO/LATER: why casting?!
264 //GetDocShell()->SfxInPlaceObject::GetVisArea().GetSize() );
265
266 // With embedded always with modify...
267 // TODO/LATER: why casting?!
268 GetDocShell()->SfxObjectShell::SetVisArea( aVis );
269 /*
270 if ( GetDocShell()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED )
271 GetDocShell()->SfxInPlaceObject::SetVisArea( aVis );
272 else
273 GetDocShell()->SvEmbeddedObject::SetVisArea( aVis );*/
274 }
275
277
279
280 if ( bOuterResize && !m_bInOuterResizePixel && !m_bInInnerResizePixel)
282 GetViewFrame()->GetWindow().GetOutputSizePixel() );
283}
284
285// Set Pos VisArea
286
287void SwView::SetVisArea( const Point &rPt, bool bUpdateScrollbar )
288{
289 // Align once, so brushes will be inserted correctly.
290 // This goes wrong in the BrowseView, because the entire document may
291 // not be visible. Since the content in frames is fitting exactly,
292 // align is not possible (better idea?!?!)
293 // (fix: Bild.de, 200%) It does not work completely without alignment
294 // Let's see how far we get with half BrushSize.
295 Point aPt = GetEditWin().LogicToPixel( rPt );
296#if HAVE_FEATURE_DESKTOP
297 const tools::Long nTmp = GetWrtShell().IsFrameView() ? 4 : 8;
298 aPt.AdjustX( -(aPt.X() % nTmp) );
299 aPt.AdjustY( -(aPt.Y() % nTmp) );
300#endif
301 aPt = GetEditWin().PixelToLogic( aPt );
302
303 if ( aPt == m_aVisArea.TopLeft() )
304 return;
305
306 if (GetWrtShell().GetViewOptions()->IsShowOutlineContentVisibilityButton())
308
309 const tools::Long lXDiff = m_aVisArea.Left() - aPt.X();
310 const tools::Long lYDiff = m_aVisArea.Top() - aPt.Y();
312 Point( m_aVisArea.Right() - lXDiff, m_aVisArea.Bottom() - lYDiff ) ),
313 bUpdateScrollbar);
314}
315
317{
318 m_pHScrollbar->SetAuto( m_pWrtShell->GetViewOptions()->getBrowseMode() &&
319 !GetViewFrame()->GetFrame().IsInPlace() );
320 if ( IsDocumentBorder() )
321 {
322 if ( m_aVisArea.Left() != DOCUMENTBORDER ||
324 {
325 tools::Rectangle aNewVisArea( m_aVisArea );
326 aNewVisArea.Move( DOCUMENTBORDER - m_aVisArea.Left(),
328 SetVisArea( aNewVisArea );
329 }
330 }
331}
332
334
335// OUT Point *pPt: new position of the visible area
336
337// IN Rectangle &rRect: Rectangle, which should be located
338// within the new visible area.
339// sal_uInt16 nRange optional accurate indication of the
340// range by which to scroll if necessary.
341
342void SwView::CalcPt( Point *pPt, const tools::Rectangle &rRect,
343 sal_uInt16 nRangeX, sal_uInt16 nRangeY)
344{
345
346 const SwTwips lMin = IsDocumentBorder() ? DOCUMENTBORDER : 0;
347
348 tools::Long nYScroll = GetYScroll();
349 tools::Long nDesHeight = rRect.GetHeight();
350 tools::Long nCurHeight = m_aVisArea.GetHeight();
351 nYScroll = std::min(nYScroll, nCurHeight - nDesHeight); // If it is scarce, then scroll not too much.
352 if(nDesHeight > nCurHeight) // the height is not sufficient, then nYScroll is no longer of interest
353 {
354 pPt->setY( rRect.Top() );
355 pPt->setY( std::max( lMin, SwTwips(pPt->Y()) ) );
356 }
357 else if ( rRect.Top() < m_aVisArea.Top() ) // Upward shift
358 {
359 pPt->setY( rRect.Top() - (nRangeY != USHRT_MAX ? nRangeY : nYScroll) );
360 pPt->setY( std::max( lMin, SwTwips(pPt->Y()) ) );
361 }
362 else if( rRect.Bottom() > m_aVisArea.Bottom() ) // Downward shift
363 {
364 pPt->setY( rRect.Bottom() -
365 (m_aVisArea.GetHeight()) + ( nRangeY != USHRT_MAX ?
366 nRangeY : nYScroll ) );
367 pPt->setY( SetVScrollMax( pPt->Y() ) );
368 }
369 tools::Long nXScroll = GetXScroll();
370 if ( rRect.Right() > m_aVisArea.Right() ) // Shift right
371 {
372 pPt->setX( rRect.Right() -
373 (m_aVisArea.GetWidth()) +
374 (nRangeX != USHRT_MAX ? nRangeX : nXScroll) );
375 pPt->setX( SetHScrollMax( pPt->X() ) );
376 }
377 else if ( rRect.Left() < m_aVisArea.Left() ) // Shift left
378 {
379 pPt->setX( rRect.Left() - (nRangeX != USHRT_MAX ? nRangeX : nXScroll) );
380 pPt->setX( std::max( ::GetLeftMargin( *this ) + nLeftOfst, pPt->X() ) );
381 pPt->setX( std::min( rRect.Left() - nScrollX, pPt->X() ) );
382 pPt->setX( std::max( tools::Long(0), pPt->X() ) );
383 }
384}
385
386// Scrolling
387
388bool SwView::IsScroll( const tools::Rectangle &rRect ) const
389{
390 return m_bCenterCursor || m_bTopCursor || !m_aVisArea.Contains(rRect);
391}
392
393void SwView::Scroll( const tools::Rectangle &rRect, sal_uInt16 nRangeX, sal_uInt16 nRangeY )
394{
395 if ( m_aVisArea.IsEmpty() )
396 return;
397
398 tools::Rectangle aOldVisArea( m_aVisArea );
399 tools::Long nDiffY = 0;
400
402 if (pCareDialog)
403 {
404 int x, y, width, height;
405 tools::Rectangle aDlgRect;
406 if (pCareDialog->get_extents_relative_to(*GetEditWin().GetFrameWeld(), x, y, width, height))
407 {
408 Point aTopLeft(GetEditWin().GetSystemWindow()->OutputToAbsoluteScreenPixel(Point(x, y)));
409 aTopLeft = GetEditWin().AbsoluteScreenToOutputPixel(aTopLeft);
410 aDlgRect = GetEditWin().PixelToLogic(tools::Rectangle(aTopLeft, Size(width, height)));
411 }
412
413 // Only if the dialogue is not the VisArea right or left:
414 if ( aDlgRect.Left() < m_aVisArea.Right() &&
415 aDlgRect.Right() > m_aVisArea.Left() )
416 {
417 // If we are not supposed to be centered, lying in the VisArea
418 // and are not covered by the dialogue ...
419 if ( !m_bCenterCursor && aOldVisArea.Contains( rRect )
420 && ( rRect.Left() > aDlgRect.Right()
421 || rRect.Right() < aDlgRect.Left()
422 || rRect.Top() > aDlgRect.Bottom()
423 || rRect.Bottom() < aDlgRect.Top() ) )
424 return;
425
426 // Is above or below the dialogue more space?
427 tools::Long nTopDiff = aDlgRect.Top() - m_aVisArea.Top();
428 tools::Long nBottomDiff = m_aVisArea.Bottom() - aDlgRect.Bottom();
429 if ( nTopDiff < nBottomDiff )
430 {
431 if ( nBottomDiff > 0 ) // Is there room below at all?
432 { // then we move the upper edge and we remember this
433 nDiffY = aDlgRect.Bottom() - m_aVisArea.Top();
434 m_aVisArea.AdjustTop(nDiffY );
435 }
436 }
437 else
438 {
439 if ( nTopDiff > 0 ) // Is there room below at all?
440 m_aVisArea.SetBottom( aDlgRect.Top() ); // Modify the lower edge
441 }
442 }
443 }
444
445 //s.o. !IsScroll()
446 if( !(m_bCenterCursor || m_bTopCursor) && m_aVisArea.Contains( rRect ) )
447 {
448 m_aVisArea = aOldVisArea;
449 return;
450 }
451 // If the rectangle is larger than the visible area -->
452 // upper left corner
453 Size aSize( rRect.GetSize() );
454 const Size aVisSize( m_aVisArea.GetSize() );
455 if( !m_aVisArea.IsEmpty() && (
456 aSize.Width() + GetXScroll() > aVisSize.Width() ||
457 aSize.Height()+ GetYScroll() > aVisSize.Height() ))
458 {
459 Point aPt( m_aVisArea.TopLeft() );
460 aSize.setWidth( std::min( aSize.Width(), aVisSize.Width() ) );
461 aSize.setHeight( std::min( aSize.Height(),aVisSize.Height()) );
462
463 CalcPt( &aPt, tools::Rectangle( rRect.TopLeft(), aSize ),
464 static_cast< sal_uInt16 >((aVisSize.Width() - aSize.Width()) / 2),
465 static_cast< sal_uInt16 >((aVisSize.Height()- aSize.Height())/ 2) );
466
467 if( m_bTopCursor )
468 {
470 aPt.setY( std::min( std::max( nBorder, rRect.Top() ),
472 m_aVisArea.GetHeight() ) );
473 }
474 aPt.AdjustY( -nDiffY );
475 m_aVisArea = aOldVisArea;
476 SetVisArea( aPt );
477 return;
478 }
479 if( !m_bCenterCursor )
480 {
481 Point aPt( m_aVisArea.TopLeft() );
482 CalcPt( &aPt, rRect, nRangeX, nRangeY );
483
484 if( m_bTopCursor )
485 {
487 aPt.setY( std::min( std::max( nBorder, rRect.Top() ),
489 m_aVisArea.GetHeight() ) );
490 }
491
492 aPt.AdjustY( -nDiffY );
493 m_aVisArea = aOldVisArea;
494 SetVisArea( aPt );
495 return;
496 }
497
498 //Center cursor
499 Point aPnt( m_aVisArea.TopLeft() );
500 // ... in Y-direction in any case
501 aPnt.AdjustY(( rRect.Top() + rRect.Bottom()
502 - m_aVisArea.Top() - m_aVisArea.Bottom() ) / 2 - nDiffY );
503 // ... in X-direction, only if the rectangle protrudes over the right or left of the VisArea.
504 if ( rRect.Right() > m_aVisArea.Right() || rRect.Left() < m_aVisArea.Left() )
505 {
506 aPnt.AdjustX(( rRect.Left() + rRect.Right()
507 - m_aVisArea.Left() - m_aVisArea.Right() ) / 2 );
508 aPnt.setX( SetHScrollMax( aPnt.X() ) );
509 const SwTwips lMin = IsDocumentBorder() ? DOCUMENTBORDER : 0;
510 aPnt.setX( std::max( (GetLeftMargin( *this ) - lMin) + nLeftOfst, aPnt.X() ) );
511 }
512 m_aVisArea = aOldVisArea;
513 if (pCareDialog)
514 {
515 // If we want to avoid only a dialogue, we do
516 // not want to go beyond the end of the document.
517 aPnt.setY( SetVScrollMax( aPnt.Y() ) );
518 }
519 SetVisArea( aPnt );
520}
521
523// Returns the value by which to be scrolled with PageUp / Down
524
526{
527 // in the LOK case, force the value set by the API
529 {
531 return true;
532 }
533
534 if ( !m_aVisArea.Top() || !m_aVisArea.GetHeight() )
535 return false;
536 tools::Long nYScrl = GetYScroll() / 2;
537 rOff = -(m_aVisArea.GetHeight() - nYScrl);
538 // Do not scroll before the beginning of the document.
539 if( m_aVisArea.Top() - rOff < 0 )
540 rOff = rOff - m_aVisArea.Top();
541 else if( GetWrtShell().GetCharRect().Top() < (m_aVisArea.Top() + nYScrl))
542 rOff += nYScrl;
543
544 return true;
545}
546
548{
549 // in the LOK case, force the value set by the API
551 {
553 return true;
554 }
555
556 if ( !m_aVisArea.GetHeight() ||
558 return false;
559 tools::Long nYScrl = GetYScroll() / 2;
560 rOff = m_aVisArea.GetHeight() - nYScrl;
561 // Do not scroll past the end of the document.
562 if ( m_aVisArea.Top() + rOff > m_aDocSz.Height() )
563 rOff = m_aDocSz.Height() - m_aVisArea.Bottom();
564 else if( GetWrtShell().GetCharRect().Bottom() >
565 ( m_aVisArea.Bottom() - nYScrl ))
566 rOff -= nYScrl;
567
568 return rOff > 0;
569}
570
571// Scroll page by page
573{
574 if (!m_aVisArea.GetHeight())
575 return false;
576
577 Point aPos(m_aVisArea.TopLeft());
578 aPos.AdjustY( -(m_aVisArea.GetHeight() - (GetYScroll() / 2)) );
579 aPos.setY( std::max(tools::Long(0), aPos.Y()) );
580 SetVisArea( aPos );
581 return true;
582}
583
585{
586 if ( !m_aVisArea.GetHeight() )
587 return false;
588 Point aPos( m_aVisArea.TopLeft() );
589 aPos.AdjustY(m_aVisArea.GetHeight() - (GetYScroll() / 2) );
590 aPos.setY( SetVScrollMax( aPos.Y() ) );
591 SetVisArea( aPos );
592 return true;
593}
594
596{
597 // Check for the currently visible page, do not format
598 sal_uInt16 nActPage = m_pWrtShell->GetNextPrevPageNum( false );
599
600 if( USHRT_MAX != nActPage )
601 {
602 const Point aPt( m_aVisArea.Left(),
603 m_pWrtShell->GetPagePos( nActPage ).Y() );
604 Point aAlPt( AlignToPixel( aPt ) );
605 // If there is a difference, has been truncated --> then add one pixel,
606 // so that no residue of the previous page is visible.
607 if( aPt.Y() != aAlPt.Y() )
608 aAlPt.AdjustY(3 * GetEditWin().PixelToLogic( Size( 0, 1 ) ).Height() );
609 SetVisArea( aAlPt );
610 }
611}
612
614{
615 // Check for the currently visible page, do not format
616 sal_uInt16 nActPage = m_pWrtShell->GetNextPrevPageNum();
617 // If the last page of the document is visible, do nothing.
618 if( USHRT_MAX != nActPage )
619 {
620 const Point aPt( m_aVisArea.Left(),
621 m_pWrtShell->GetPagePos( nActPage ).Y() );
622 Point aAlPt( AlignToPixel( aPt ) );
623 // If there is a difference, has been truncated --> then add one pixel,
624 // so that no residue of the previous page is visible.
625 if( aPt.Y() != aAlPt.Y() )
626 aAlPt.AdjustY(3 * GetEditWin().PixelToLogic( Size( 0, 1 ) ).Height() );
627 SetVisArea( aAlPt );
628 }
629}
630
631bool SwView::PageUpCursor( bool bSelect )
632{
633 if ( !bSelect )
634 {
635 const FrameTypeFlags eType = m_pWrtShell->GetFrameType(nullptr,true);
637 {
638 m_pWrtShell->MoveCursor();
639 m_pWrtShell->GotoFootnoteAnchor();
640 m_pWrtShell->Right(SwCursorSkipMode::Chars, false, 1, false );
641 return true;
642 }
643 }
644
645 SwTwips lOff = 0;
646 if ( GetPageScrollUpOffset( lOff ) &&
647 (m_pWrtShell->IsCursorReadonly() ||
648 !m_pWrtShell->PageCursor( lOff, bSelect )) &&
649 PageUp() )
650 {
651 m_pWrtShell->ResetCursorStack();
652 return true;
653 }
654 return false;
655}
656
657bool SwView::PageDownCursor(bool bSelect)
658{
659 SwTwips lOff = 0;
660 if ( GetPageScrollDownOffset( lOff ) &&
661 (m_pWrtShell->IsCursorReadonly() ||
662 !m_pWrtShell->PageCursor( lOff, bSelect )) &&
663 PageDown() )
664 {
665 m_pWrtShell->ResetCursorStack();
666 return true;
667 }
668 return false;
669}
670
671// Handler of the scrollbars
672IMPL_LINK(SwView, VertScrollHdl, weld::Scrollbar&, rScrollbar, void)
673{
674 if ( GetWrtShell().ActionPend() )
675 return;
676
677 if (rScrollbar.get_scroll_type() == ScrollType::Drag)
678 m_pWrtShell->EnableSmooth( false );
679
680 EndScrollHdl(rScrollbar, false);
681
682 if (!m_pWrtShell->GetViewOptions()->getBrowseMode() &&
683 rScrollbar.get_scroll_type() == ScrollType::Drag)
684 {
685 if ( !m_bWheelScrollInProgress && Help::IsQuickHelpEnabled() &&
686 m_pWrtShell->GetViewOptions()->IsShowScrollBarTips())
687 {
688
689 Point aPos( m_aVisArea.TopLeft() );
690 lcl_GetPos(this, aPos, rScrollbar, false, IsDocumentBorder());
691
692 sal_uInt16 nPhNum = 1;
693 sal_uInt16 nVirtNum = 1;
694
695 OUString sDisplay;
696 if(m_pWrtShell->GetPageNumber( aPos.Y(), false, nPhNum, nVirtNum, sDisplay ))
697 {
698 // The end scrollhandler invalidate the FN_STAT_PAGE,
699 // so we don't must do it again.
700 // if(!GetViewFrame()->GetFrame().IsInPlace())
701 // S F X_BINDINGS().Update(FN_STAT_PAGE);
702
703 //QuickHelp:
704 if( m_pWrtShell->GetPageCnt() > 1 )
705 {
706 if( !nPgNum || nPgNum != nPhNum )
707 {
708 tools::Rectangle aRect;
709 aRect.SetLeft( m_pVScrollbar->GetParent()->OutputToScreenPixel(
710 m_pVScrollbar->GetPosPixel() ).X() -8 );
711 aRect.SetTop( m_pVScrollbar->OutputToScreenPixel(
712 m_pVScrollbar->GetPointerPosPixel() ).Y() );
713 aRect.SetRight( aRect.Left() );
714 aRect.SetBottom( aRect.Top() );
715
716 OUString sPageStr( GetPageStr( nPhNum, nVirtNum, sDisplay ));
718 bool bSuccess = m_pWrtShell->GetContentAtPos(aPos, aCnt);
719 if (bSuccess && !aCnt.sStr.isEmpty())
720 {
721 sPageStr += " - ";
722 sal_Int32 nChunkLen = std::min<sal_Int32>(aCnt.sStr.getLength(), 80);
723 std::u16string_view sChunk = aCnt.sStr.subView(0, nChunkLen);
724 sPageStr = sChunk + sPageStr;
725 sPageStr = sPageStr.replace('\t', ' ');
726 sPageStr = sPageStr.replace(0x0a, ' ');
727 }
728
729 Help::ShowQuickHelp(m_pVScrollbar, aRect, sPageStr,
730 QuickHelpFlags::Right|QuickHelpFlags::VCenter);
731 }
732 nPgNum = nPhNum;
733 }
734 }
735 }
736 }
737
738 if (rScrollbar.get_scroll_type() == ScrollType::Drag)
739 m_pWrtShell->EnableSmooth( true );
740}
741
742// Handler of the scrollbars
743void SwView::EndScrollHdl(weld::Scrollbar& rScrollbar, bool bHorizontal)
744{
745 if ( GetWrtShell().ActionPend() )
746 return;
747
748 if(nPgNum)
749 {
750 nPgNum = 0;
751 Help::ShowQuickHelp(bHorizontal ? m_pHScrollbar : m_pVScrollbar, tools::Rectangle(), OUString());
752 }
753 Point aPos( m_aVisArea.TopLeft() );
754 bool bBorder = IsDocumentBorder();
755 lcl_GetPos(this, aPos, rScrollbar, bHorizontal, bBorder);
756 if ( bBorder && aPos == m_aVisArea.TopLeft() )
758 else
759 SetVisArea( aPos, false );
760
762}
763
764IMPL_LINK(SwView, HoriScrollHdl, weld::Scrollbar&, rScrollBar, void)
765{
766 EndScrollHdl(rScrollBar, true);
767}
768
769// Calculates the size of the m_aVisArea in dependency of the size of
770// EditWin on the screen.
771
772void SwView::CalcVisArea( const Size &rOutPixel )
773{
774 Point aTopLeft;
775 tools::Rectangle aRect( aTopLeft, rOutPixel );
776 aRect = GetEditWin().PixelToLogic(aRect);
777
778 // The shifts to the right and/or below can now be incorrect
779 // (e.g. change zoom level, change view size).
781 if ( aRect.Left() )
782 {
783 const tools::Long lWidth = GetWrtShell().GetDocSize().Width() + lBorder;
784 if ( aRect.Right() > lWidth )
785 {
786 tools::Long lDelta = aRect.Right() - lWidth;
787 aRect.AdjustLeft( -lDelta );
788 aRect.AdjustRight( -lDelta );
789 }
790 }
791 if ( aRect.Top() )
792 {
793 const tools::Long lHeight = GetWrtShell().GetDocSize().Height() + lBorder;
794 if ( aRect.Bottom() > lHeight )
795 {
796 tools::Long lDelta = aRect.Bottom() - lHeight;
797 aRect.AdjustTop( -lDelta );
798 aRect.AdjustBottom( -lDelta );
799 }
800 }
801 SetVisArea( aRect );
802 GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM );
803 GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER ); // for snapping points
804}
805
806// Rearrange control elements
807
809{
810 bool bRightVRuler = m_pWrtShell->GetViewOptions()->IsVRulerRight();
811 if ( m_pVRuler->IsVisible() )
812 {
813 tools::Long nWidth = m_pVRuler->GetSizePixel().Width();
814 if(bRightVRuler)
815 rToFill.Right() = nWidth;
816 else
817 rToFill.Left() = nWidth;
818 }
819
820 OSL_ENSURE(m_pHRuler, "Why is the ruler not present?");
821 if ( m_pHRuler->IsVisible() )
822 rToFill.Top() = m_pHRuler->GetSizePixel().Height();
823
825 const tools::Long nTmp = rSet.GetScrollBarSize();
826 if( m_pVScrollbar->IsScrollbarVisible(true) )
827 {
828 if(bRightVRuler)
829 rToFill.Left() = nTmp;
830 else
831 rToFill.Right() = nTmp;
832 }
833 if ( m_pHScrollbar->IsScrollbarVisible(true) )
834 rToFill.Bottom() = nTmp;
835
836 SetBorderPixel( rToFill );
837}
838
840 const Point &rOfst,
841 const Size &rSize,
842 const Size &rEditSz,
843 SwScrollbar& rVScrollbar,
844 SwScrollbar& rHScrollbar,
845 SvxRuler* pVRuler,
846 SvxRuler* pHRuler,
847 bool bVRulerRight )
848{
849// ViewResizePixel is also used by Preview!!!
850
851 const bool bHRuler = pHRuler && pHRuler->IsVisible();
852 const tools::Long nHLinSzHeight = bHRuler ?
853 pHRuler->GetSizePixel().Height() : 0;
854 const bool bVRuler = pVRuler && pVRuler->IsVisible();
855 const tools::Long nVLinSzWidth = bVRuler ?
856 pVRuler->GetSizePixel().Width() : 0;
857
858 const tools::Long nScrollBarSize = rRef.GetSettings().GetStyleSettings().GetScrollBarSize();
859 const tools::Long nHBSzHeight = rHScrollbar.IsScrollbarVisible(true) ? nScrollBarSize : 0;
860 const tools::Long nVBSzWidth = rVScrollbar.IsScrollbarVisible(true) ? nScrollBarSize : 0;
861
862 if(pVRuler)
863 {
864 WinBits nStyle = pVRuler->GetStyle()&~WB_RIGHT_ALIGNED;
865 Point aPos( rOfst.X(), rOfst.Y()+nHLinSzHeight );
866 if(bVRulerRight)
867 {
868 aPos.AdjustX(rSize.Width() - nVLinSzWidth );
869 nStyle |= WB_RIGHT_ALIGNED;
870 }
871 Size aSize( nVLinSzWidth, rEditSz.Height() );
872 if(!aSize.Width())
873 aSize.setWidth( pVRuler->GetSizePixel().Width() );
874 pVRuler->SetStyle(nStyle);
875 pVRuler->SetPosSizePixel( aPos, aSize );
876 if(!pVRuler->IsVisible())
877 pVRuler->Resize();
878 }
879 // Ruler needs a resize, otherwise it will not work in the invisible condition
880 if(pHRuler)
881 {
882 Size aSize( rSize.Width(), nHLinSzHeight );
883 if ( nVBSzWidth && !bVRulerRight)
884 aSize.AdjustWidth( -nVBSzWidth );
885 if(!aSize.Height())
886 aSize.setHeight( pHRuler->GetSizePixel().Height() );
887 pHRuler->SetPosSizePixel( rOfst, aSize );
888 // VCL calls no resize on invisible windows
889 // but that is not a good idea for the ruler
890 if(!pHRuler->IsVisible())
891 pHRuler->Resize();
892 }
893
894 // Arrange scrollbars and SizeBox
895 Point aScrollFillPos;
896 {
897 Point aPos( rOfst.X(),
898 rOfst.Y()+rSize.Height()-nHBSzHeight );
899 if(bVRulerRight)
900 {
901 aPos.AdjustX(nVBSzWidth );
902 }
903
904 Size aSize( rSize.Width(), nHBSzHeight );
905 if ( nVBSzWidth )
906 aSize.AdjustWidth( -nVBSzWidth );
907 rHScrollbar.SetPosSizePixel( aPos, aSize );
908 aScrollFillPos.setY( aPos.Y() );
909 }
910 {
911 Point aPos( rOfst.X()+rSize.Width()-nVBSzWidth,
912 rOfst.Y() );
913 Size aSize( nVBSzWidth, rSize.Height() );
914 if(bVRulerRight)
915 {
916 aPos.setX( rOfst.X() );
917 if(bHRuler)
918 {
919 aPos.AdjustY(nHLinSzHeight );
920 aSize.AdjustHeight( -nHLinSzHeight );
921 }
922 }
923
924 if ( nHBSzHeight )
925 aSize.AdjustHeight( -nHBSzHeight );
926 rVScrollbar.SetPosSizePixel( aPos, aSize );
927
928 aPos.AdjustY(aSize.Height() );
929
930 aScrollFillPos.setX( aPos.X() );
931 }
932}
933
935{
936 m_bShowAtResize = false;
937 if ( m_pWrtShell->GetViewOptions()->IsViewHRuler() )
938 m_pHRuler->Show();
939}
940
941void SwView::InnerResizePixel( const Point &rOfst, const Size &rSize, bool )
942{
943 Size aObjSize = GetObjectShell()->GetVisArea().GetSize();
944 if ( !aObjSize.IsEmpty() )
945 {
946 SvBorder aBorder( GetBorderPixel() );
947 Size aSize( rSize );
948 aSize.AdjustWidth( -(aBorder.Left() + aBorder.Right()) );
949 aSize.AdjustHeight( -(aBorder.Top() + aBorder.Bottom()) );
950 Size aObjSizePixel = GetWindow()->LogicToPixel(aObjSize, MapMode(MapUnit::MapTwip));
951 SfxViewShell::SetZoomFactor( Fraction( aSize.Width(), aObjSizePixel.Width() ),
952 Fraction( aSize.Height(), aObjSizePixel.Height() ) );
953 }
954
956 const bool bHScrollVisible = m_pHScrollbar->IsScrollbarVisible(true);
957 const bool bVScrollVisible = m_pVScrollbar->IsScrollbarVisible(true);
958 bool bRepeat = false;
959 do
960 {
961 Size aSz( rSize );
962 SvBorder aBorder;
963 CalcAndSetBorderPixel( aBorder );
964 if ( GetViewFrame()->GetFrame().IsInPlace() )
965 {
966 Size aViewSize( aSz );
967 Point aViewPos( rOfst );
968 aViewSize.AdjustHeight( -(aBorder.Top() + aBorder.Bottom()) );
969 aViewSize.AdjustWidth( -(aBorder.Left() + aBorder.Right()) );
970 aViewPos.AdjustX(aBorder.Left() );
971 aViewPos.AdjustY(aBorder.Top() );
972 GetEditWin().SetPosSizePixel( aViewPos, aViewSize );
973 }
974 else
975 {
976 aSz.AdjustHeight(aBorder.Top() + aBorder.Bottom() );
977 aSz.AdjustWidth(aBorder.Left() + aBorder.Right() );
978 }
979
980 Size aEditSz( GetEditWin().GetOutputSizePixel() );
981 ViewResizePixel( *GetEditWin().GetOutDev(), rOfst, aSz, aEditSz, *m_pVScrollbar,
983 m_pWrtShell->GetViewOptions()->IsVRulerRight());
984 if ( m_bShowAtResize )
985 ShowAtResize();
986
987 if( m_pHRuler->IsVisible() || m_pVRuler->IsVisible() )
988 {
989 const Fraction& rFrac = GetEditWin().GetMapMode().GetScaleX();
990 tools::Long nZoom = 100;
991 if (rFrac.IsValid())
992 nZoom = tools::Long(rFrac * 100);
993
994 const Fraction aFrac( nZoom, 100 );
995 m_pVRuler->SetZoom( aFrac );
996 m_pHRuler->SetZoom( aFrac );
997 InvalidateRulerPos(); // Invalidate content.
998 }
999 // Reset the cursor stack because the cursor positions for PageUp/Down
1000 // no longer fit the currently visible area.
1001 m_pWrtShell->ResetCursorStack();
1002
1003 // EditWin never set!
1004
1005 // Set VisArea, but do not call the SetVisArea of the Docshell there!
1007 CalcVisArea( aEditSz );
1008 // Visibility changes of the automatic horizontal scrollbar
1009 // require to repeat the ViewResizePixel() call - but only once!
1010 if(bRepeat)
1011 bRepeat = false;
1012 else if(bHScrollVisible != m_pHScrollbar->IsScrollbarVisible(true) ||
1013 bVScrollVisible != m_pVScrollbar->IsScrollbarVisible(true))
1014 bRepeat = true;
1015 }while( bRepeat );
1017 m_bInInnerResizePixel = false;
1018}
1019
1020void SwView::OuterResizePixel( const Point &rOfst, const Size &rSize )
1021{
1022 // #i16909# return, if no size (caused by minimize window).
1023 if ( m_bInOuterResizePixel || ( !rSize.Width() && !rSize.Height() ) )
1024 return;
1025 m_bInOuterResizePixel = true;
1026
1027 // Determine whether scroll bars may be displayed.
1028 bool bShowH = true,
1029 bShowV = true,
1030 bAuto = true,
1031 bHAuto = true;
1032
1033 const SwViewOption *pVOpt = m_pWrtShell->GetViewOptions();
1034 if ( !pVOpt->IsReadonly() || pVOpt->IsStarOneSetting() )
1035 {
1036 bShowH = pVOpt->IsViewHScrollBar();
1037 bShowV = pVOpt->IsViewVScrollBar();
1038 }
1039
1041 {
1042 bHAuto = bShowH = false;
1043 }
1045 {
1046 bAuto = bShowV = false;
1047 }
1048
1049 SwDocShell* pDocSh = GetDocShell();
1050 bool bIsPreview = pDocSh->IsPreview();
1051 if( bIsPreview )
1052 {
1053 bShowH = bShowV = bHAuto = bAuto = false;
1054 }
1055 if(m_pHScrollbar->IsScrollbarVisible(false) != bShowH && !bHAuto)
1056 ShowHScrollbar(bShowH);
1057 m_pHScrollbar->SetAuto( bHAuto );
1058 if(m_pVScrollbar->IsScrollbarVisible(false) != bShowV && !bAuto)
1059 ShowVScrollbar(bShowV);
1060 m_pVScrollbar->SetAuto(bAuto);
1061
1062 CurrShell aCurr( m_pWrtShell.get() );
1063 bool bRepeat = false;
1064 tools::Long nCnt = 0;
1065
1066 bool bUnLockView = !m_pWrtShell->IsViewLocked();
1067 m_pWrtShell->LockView( true );
1068 m_pWrtShell->LockPaint();
1069
1070 do {
1071 ++nCnt;
1072 const bool bScroll1 = m_pVScrollbar->IsScrollbarVisible(true);
1073 const bool bScroll2 = m_pHScrollbar->IsScrollbarVisible(true);
1074 SvBorder aBorder;
1075 CalcAndSetBorderPixel( aBorder );
1076 const Size aEditSz( GetEditWin().GetOutputSizePixel() );
1077 ViewResizePixel( *GetEditWin().GetOutDev(), rOfst, rSize, aEditSz, *m_pVScrollbar,
1079 m_pWrtShell->GetViewOptions()->IsVRulerRight() );
1080 if ( m_bShowAtResize )
1081 ShowAtResize();
1082
1083 if( m_pHRuler->IsVisible() || m_pVRuler->IsVisible() )
1084 InvalidateRulerPos(); // Invalidate content.
1085
1086 // Reset the cursor stack because the cursor positions for PageUp/Down
1087 // no longer fit the currently visible area.
1088 m_pWrtShell->ResetCursorStack();
1089
1090 OSL_ENSURE( !GetEditWin().IsVisible() ||
1091 !aEditSz.IsEmpty() || !m_aVisArea.IsEmpty(), "Small world, isn't it?" );
1092
1093 // Never set EditWin!
1094
1095 // Of course the VisArea must also be set.
1096 // Now is the right time to re-calculate the zoom if it is not a simple factor.
1097 m_pWrtShell->StartAction();
1098 CalcVisArea( aEditSz );
1099
1100 //Thus also in the outplace editing the page width will be adjusted immediately.
1101 //TODO/LATER: is that still necessary?!
1102 /*
1103 if ( pDocSh->GetCreateMode() == SfxObjectCreateMode::EMBEDDED )
1104 pDocSh->SetVisArea(
1105 pDocSh->SfxInPlaceObject::GetVisArea() );*/
1106 if ( m_pWrtShell->GetViewOptions()->GetZoomType() != SvxZoomType::PERCENT &&
1107 !m_pWrtShell->GetViewOptions()->getBrowseMode() )
1108 SetZoom_( aEditSz, m_pWrtShell->GetViewOptions()->GetZoomType(), 100, true );
1109 m_pWrtShell->EndAction();
1110
1111 bRepeat = bScroll1 != m_pVScrollbar->IsScrollbarVisible(true);
1112 if ( !bRepeat )
1113 bRepeat = bScroll2 != m_pHScrollbar->IsScrollbarVisible(true);
1114
1115 // Do no infinite loops.
1116 // If possible stop when the (auto-) scroll bars are visible.
1117 if ( bRepeat &&
1118 ( nCnt > 10 || ( nCnt > 3 && bHAuto && bAuto ) )
1119 )
1120 {
1121 bRepeat = false;
1122 }
1123
1124 } while ( bRepeat );
1125
1126 m_pWrtShell->UnlockPaint();
1127 if( bUnLockView )
1128 m_pWrtShell->LockView( false );
1129
1130 m_bInOuterResizePixel = false;
1131
1132 if ( m_pPostItMgr )
1133 {
1134 m_pPostItMgr->CalcRects();
1135 m_pPostItMgr->LayoutPostIts();
1136 }
1137}
1138
1139void SwView::SetZoomFactor( const Fraction &rX, const Fraction &rY )
1140{
1141 const Fraction &rFrac = rX < rY ? rX : rY;
1142 SetZoom( SvxZoomType::PERCENT, static_cast<short>(tools::Long(rFrac * Fraction( 100, 1 ))) );
1143
1144 // To minimize rounding errors we also adjust the odd values
1145 // of the base class if necessary.
1147}
1148
1150{
1151 bool bRet = false;
1152 if ( !m_aVisArea.IsEmpty() )
1153 {
1154 const bool bBorder = IsDocumentBorder();
1155 tools::Rectangle aTmpRect( m_aVisArea );
1156 if ( bBorder )
1157 {
1159 aPt = AlignToPixel( aPt );
1160 aTmpRect.Move( -aPt.X(), -aPt.Y() );
1161 }
1162
1163 Size aTmpSz( m_aDocSz );
1164 const tools::Long lOfst = bBorder ? 0 : DOCUMENTBORDER * 2;
1165 aTmpSz.AdjustWidth(lOfst ); aTmpSz.AdjustHeight(lOfst );
1166
1167 {
1168 const bool bVScrollVisible = m_pVScrollbar->IsScrollbarVisible(true);
1169 m_pVScrollbar->DocSzChgd( aTmpSz );
1170 m_pVScrollbar->ViewPortChgd( aTmpRect );
1171 if ( bVScrollVisible != m_pVScrollbar->IsScrollbarVisible(true) )
1172 bRet = true;
1173 }
1174 {
1175 const bool bHScrollVisible = m_pHScrollbar->IsScrollbarVisible(true);
1176 m_pHScrollbar->DocSzChgd( aTmpSz );
1177 m_pHScrollbar->ViewPortChgd( aTmpRect );
1178 if ( bHScrollVisible != m_pHScrollbar->IsScrollbarVisible(true) )
1179 bRet = true;
1180 }
1181 }
1182 return bRet;
1183}
1184
1186{
1187 if ( GetWrtShell().IsInSelect() )
1190}
1191
1193{
1194 bool bOk = false;
1195 const CommandWheelData* pWData = rCEvt.GetWheelData();
1196 if (pWData && CommandWheelMode::ZOOM == pWData->GetMode())
1197 {
1198 sal_uInt16 nFact = m_pWrtShell->GetViewOptions()->GetZoom();
1199 if( 0L > pWData->GetDelta() )
1200 nFact = std::max( static_cast<sal_uInt16>(20), basegfx::zoomtools::zoomOut( nFact ));
1201 else
1202 nFact = std::min( static_cast<sal_uInt16>(600), basegfx::zoomtools::zoomIn( nFact ));
1203
1204 SetZoom( SvxZoomType::PERCENT, nFact );
1205 bOk = true;
1206 }
1207 else
1208 {
1209 if (pWData && pWData->GetMode()==CommandWheelMode::SCROLL)
1210 {
1211 // This influences whether quick help is shown
1213 }
1214
1215 if (pWData && (CommandWheelMode::SCROLL==pWData->GetMode()) &&
1217 {
1218 if (pWData->GetDelta()<0)
1219 PhyPageDown();
1220 else
1221 PhyPageUp();
1222 bOk = true;
1223 }
1224 else
1225 bOk = m_pEditWin->HandleScrollCommand(rCEvt, m_pHScrollbar, m_pVScrollbar);
1226
1227 // Restore default state for case when scroll command comes from dragging scrollbar handle
1229 }
1230 return bOk;
1231}
1232
1233/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const StyleSettings & GetStyleSettings() const
const CommandWheelData * GetWheelData() const
tools::Long GetDelta() const
double GetScrollLines() const
CommandWheelMode GetMode() const
bool IsValid() const
static bool IsQuickHelpEnabled()
static void ShowQuickHelp(vcl::Window *pParent, const tools::Rectangle &rScreenRect, const OUString &rHelpText, QuickHelpFlags nStyle=QuickHelpFlags::NONE)
const Fraction & GetScaleX() const
const AllSettings & GetSettings() const
void Update(sal_uInt16 nId)
void Invalidate(sal_uInt16 nId)
virtual tools::Rectangle GetVisArea(sal_uInt16 nAspect) const
const tools::Rectangle & GetVisArea() const
bool IsPreview() const
SfxViewFrame * GetFrame() const
SfxBindings & GetBindings()
weld::Window * GetFrameWeld() const
virtual void Move()
void SetBorderPixel(const SvBorder &rBorder)
virtual void SetZoomFactor(const Fraction &rZoomX, const Fraction &rZoomY)
void VisAreaChanged()
const SvBorder & GetBorderPixel() const
SfxViewFrame * GetViewFrame() const
virtual SfxObjectShell * GetObjectShell() override
vcl::Window * GetWindow() const
bool IsEmpty() const
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
void setWidth(tools::Long nWidth)
tools::Long AdjustWidth(tools::Long n)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
sal_Int32 GetScrollBarSize() const
tools::Long & Left()
tools::Long & Top()
tools::Long & Right()
tools::Long & Bottom()
const SwRect & GetCharRect() const
Definition: crsrsh.hxx:525
SwFrameControlsManager & GetFrameControlsManager()
Definition: edtwin.cxx:6799
const SwRect & GetAnyCurRect(CurRectType eType, const Point *pPt=nullptr, const css::uno::Reference< css::embed::XEmbeddedObject > &=css::uno::Reference< css::embed::XEmbeddedObject >()) const
Definition: fews.cxx:90
void HideControls(FrameControlType eType)
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
void Top(const tools::Long nTop)
Definition: swrect.hxx:206
void Pos(const Point &rNew)
Definition: swrect.hxx:171
void Left(const tools::Long nLeft)
Definition: swrect.hxx:197
void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize) override
Definition: scroll.cxx:79
bool IsScrollbarVisible(bool bReal) const
Definition: scroll.hxx:35
bool IsReadonly() const
Definition: viewopt.hxx:463
SvxZoomType GetZoomType() const
Definition: viewopt.hxx:546
bool IsViewHScrollBar() const
Definition: viewopt.hxx:527
bool IsViewVScrollBar() const
Definition: viewopt.hxx:519
bool IsStarOneSetting() const
Definition: viewopt.hxx:632
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:436
bool IsFrameView() const
Definition: viewsh.hxx:503
Size GetDocSize() const
Definition: viewsh.cxx:2199
const SwRect & VisArea() const
Definition: viewsh.cxx:630
static weld::Window * GetCareDialog(SwViewShell const &rVSh)
Definition: viewsh.hxx:451
Definition: view.hxx:146
SAL_DLLPRIVATE bool UpdateScrollbars()
Definition: viewport.cxx:1149
VclPtr< SwScrollbar > m_pHScrollbar
Definition: view.hxx:202
SAL_DLLPRIVATE void ShowAtResize()
Definition: viewport.cxx:934
bool m_bWheelScrollInProgress
Definition: view.hxx:237
bool m_bShowAtResize
Definition: view.hxx:250
SAL_DLLPRIVATE bool PageDownCursor(bool bSelect)
Definition: viewport.cxx:657
SAL_DLLPRIVATE bool GetPageScrollUpOffset(SwTwips &rOff) const
Scroll page by page.
Definition: viewport.cxx:525
virtual void OuterResizePixel(const Point &rOfs, const Size &rSize) override
Definition: viewport.cxx:1020
SwWrtShell & GetWrtShell() const
Definition: view.hxx:413
void Scroll(const tools::Rectangle &rRect, sal_uInt16 nRangeX=USHRT_MAX, sal_uInt16 nRangeY=USHRT_MAX)
Definition: viewport.cxx:393
virtual SAL_DLLPRIVATE void Move() override
Definition: viewport.cxx:1185
SAL_DLLPRIVATE bool PageDown()
Definition: viewport.cxx:584
bool HandleWheelCommands(const CommandEvent &)
Definition: viewport.cxx:1192
std::unique_ptr< SwWrtShell > m_pWrtShell
Definition: view.hxx:194
bool m_bTopCursor
Definition: view.hxx:240
std::unique_ptr< SwPostItMgr > m_pPostItMgr
Definition: view.hxx:219
VclPtr< SwScrollbar > m_pVScrollbar
Definition: view.hxx:203
SAL_DLLPRIVATE void CalcPt(Point *pPt, const tools::Rectangle &rRect, sal_uInt16 nRangeX, sal_uInt16 nRangeY)
Calculate the visible range.
Definition: viewport.cxx:342
tools::Rectangle m_aVisArea
Definition: view.hxx:191
tools::Long SetHScrollMax(tools::Long lMax)
Definition: viewport.cxx:130
bool m_bInOuterResizePixel
Definition: view.hxx:251
bool m_bVScrollbarEnabled
Definition: view.hxx:206
VclPtr< SvxRuler > m_pHRuler
Definition: view.hxx:208
bool IsDocumentBorder()
Definition: viewport.cxx:54
VclPtr< SvxRuler > m_pVRuler
Definition: view.hxx:209
tools::Long GetXScroll() const
Definition: view.hxx:699
VclPtr< SwEditWin > m_pEditWin
Definition: view.hxx:193
void ShowHScrollbar(bool bShow)
Definition: viewmdi.cxx:722
const tools::Rectangle & GetVisArea() const
Definition: view.hxx:426
bool m_bInInnerResizePixel
Definition: view.hxx:252
virtual void InnerResizePixel(const Point &rOfs, const Size &rSize, bool inplaceEditModeChange) override
Definition: viewport.cxx:941
SAL_DLLPRIVATE bool PageUp()
Definition: viewport.cxx:572
const Size & GetDocSz() const
Definition: view.hxx:453
tools::Long SetVScrollMax(tools::Long lMax)
Definition: viewport.cxx:140
virtual void SetZoomFactor(const Fraction &rX, const Fraction &) override
Definition: viewport.cxx:1139
bool m_bCenterCursor
Definition: view.hxx:239
SAL_DLLPRIVATE void PhyPageUp()
Definition: viewport.cxx:595
Size m_aDocSz
Definition: view.hxx:190
SAL_DLLPRIVATE bool PageUpCursor(bool bSelect)
Definition: viewport.cxx:631
SwTwips m_nLOKPageUpDownOffset
LibreOfficeKit has to force the page size for PgUp/PgDown functionality based on the user's view,...
Definition: view.hxx:265
SwEditWin & GetEditWin()
Definition: view.hxx:416
void CheckVisArea()
Definition: viewport.cxx:316
bool IsScroll(const tools::Rectangle &rRect) const
Definition: viewport.cxx:388
SwDocShell * GetDocShell()
Definition: view.cxx:1159
void DocSzChgd(const Size &rNewSize)
Definition: viewport.cxx:154
SAL_DLLPRIVATE void CalcAndSetBorderPixel(SvBorder &rToFill)
Definition: viewport.cxx:808
tools::Long GetYScroll() const
Definition: view.hxx:704
void SetVisArea(const tools::Rectangle &, bool bUpdateScrollbar=true)
Definition: viewport.cxx:198
SAL_DLLPRIVATE void EndScrollHdl(weld::Scrollbar &rScrollbar, bool bHorizontal)
Definition: viewport.cxx:743
void InvalidateRulerPos()
Definition: viewport.cxx:107
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
SAL_DLLPRIVATE bool GetPageScrollDownOffset(SwTwips &rOff) const
Definition: viewport.cxx:547
void ShowVScrollbar(bool bShow)
Definition: viewmdi.cxx:734
SAL_DLLPRIVATE Point AlignToPixel(const Point &rPt) const
Definition: viewport.cxx:147
bool m_bHScrollbarEnabled
Definition: view.hxx:205
SAL_DLLPRIVATE void PhyPageDown()
Definition: viewport.cxx:613
void SetZoom(SvxZoomType eZoomType, short nFactor=100, bool bViewOnly=false)
Definition: viewmdi.cxx:73
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
void EndSelect()
Definition: select.cxx:425
constexpr tools::Long GetWidth() const
bool Contains(const Point &rPOINT) const
constexpr void SetLeft(tools::Long v)
constexpr void SetTop(tools::Long v)
constexpr tools::Long Top() const
void SetSize(const Size &)
constexpr Point TopLeft() const
constexpr void SetRight(tools::Long v)
constexpr Size GetSize() const
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
constexpr tools::Long Right() const
tools::Long AdjustTop(tools::Long nVertMoveDelta)
tools::Long AdjustRight(tools::Long nHorzMoveDelta)
constexpr void SetBottom(tools::Long v)
constexpr tools::Long GetHeight() const
tools::Long AdjustBottom(tools::Long nVertMoveDelta)
tools::Long AdjustLeft(tools::Long nHorzMoveDelta)
constexpr tools::Long Left() const
constexpr tools::Long Bottom() const
constexpr bool IsEmpty() const
Point AbsoluteScreenToOutputPixel(const Point &rPos) const
Point LogicToPixel(const Point &rLogicPt) const
const AllSettings & GetSettings() const
const MapMode & GetMapMode() const
Point PixelToLogic(const Point &rDevicePt) const
virtual void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize)
virtual int adjustment_get_value() const=0
virtual bool get_extents_relative_to(const Widget &rRelative, int &x, int &y, int &width, int &height) const=0
#define FN_STAT_PAGE
Definition: cmdid.h:843
#define COMMAND_WHEEL_PAGESCROLL
float y
float x
@ PagePrt
Rect of current PrtArea of page.
FrameTypeFlags
values can be combined via logical or
Definition: fesh.hxx:63
DocumentType eType
const char sDisplay[]
tools::Long const nBorder
sal_uInt16 zoomIn(sal_uInt16 nCurrent)
sal_uInt16 zoomOut(sal_uInt16 nCurrent)
long Long
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
Definition: nodeoffset.hxx:35
SwNodeOffset abs(const SwNodeOffset &a)
Definition: nodeoffset.hxx:34
#define ASPECT_CONTENT
constexpr WinBits WB_RIGHT_ALIGNED
static SfxItemSet & rSet
OUString sStr
Definition: crsrsh.hxx:112
tools::Long SwTwips
Definition: swtypes.hxx:51
constexpr SwTwips DOCUMENTBORDER
Definition: swtypes.hxx:79
bool bDocSzUpdated
Definition: view.cxx:124
const tools::Long nScrollX
Definition: view.hxx:78
const tools::Long nLeftOfst
Definition: view.hxx:77
static tools::Long GetLeftMargin(SwView const &rView)
Definition: viewport.cxx:66
static void lcl_GetPos(SwView const *pView, Point &rPos, const weld::Scrollbar &rScrollbar, bool bHori, bool bBorder)
Definition: viewport.cxx:75
IMPL_LINK(SwView, VertScrollHdl, weld::Scrollbar &, rScrollbar, void)
Definition: viewport.cxx:672
static bool bProtectDocShellVisArea
Definition: viewport.cxx:50
static sal_uInt16 nPgNum
Definition: viewport.cxx:52
void ViewResizePixel(const vcl::RenderContext &rRef, const Point &rOfst, const Size &rSize, const Size &rEditSz, SwScrollbar &rVScrollbar, SwScrollbar &rHScrollbar, SvxRuler *pVRuler, SvxRuler *pHRuler, bool bVRulerRight)
Definition: viewport.cxx:839
sal_Int64 WinBits
SvxZoomType