42#include <osl/diagnose.h>
56 if (
GetDocShell()->GetCreateMode() == SfxObjectCreateMode::EMBEDDED)
62 return m_pWrtShell->GetViewOptions()->getBrowseMode() ||
63 SvxZoomType::PAGEWIDTH_NOBORDER ==
m_pWrtShell->GetViewOptions()->GetZoomType();
71 eType == SvxZoomType::PAGEWIDTH ||
eType == SvxZoomType::PAGEWIDTH_NOBORDER ? 0 :
94 if ( bHori && nTmp > lSize )
95 lDelta -= nTmp - lSize;
97 if ( !bHori && nTmp > lSize )
98 lDelta -= nTmp - lSize;
109 static sal_uInt16 aInval[] =
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,
122 assert(
m_pHRuler &&
"Why is the ruler not there?");
166 bool bModified =
false;
170 if ( aNewVisArea.
Right() >= lTmp )
172 lTmp = aNewVisArea.
Right() - lTmp;
179 if ( aNewVisArea.
Bottom() >= lTmp )
181 lTmp = aNewVisArea.
Bottom() - lTmp;
212 if( aLR.
Top() < lMin )
217 if( aLR.
Left() < lMin )
222 if( aLR.
Right() < 0 )
261 if ( aVis.
GetSize() == aOldSz )
296#if HAVE_FEATURE_DESKTOP
306 if (
GetWrtShell().GetViewOptions()->IsShowOutlineContentVisibilityButton())
343 sal_uInt16 nRangeX, sal_uInt16 nRangeY)
351 nYScroll =
std::min(nYScroll, nCurHeight - nDesHeight);
352 if(nDesHeight > nCurHeight)
359 pPt->
setY( rRect.
Top() - (nRangeY != USHRT_MAX ? nRangeY : nYScroll) );
366 nRangeY : nYScroll ) );
374 (nRangeX != USHRT_MAX ? nRangeX : nXScroll) );
379 pPt->
setX( rRect.
Left() - (nRangeX != USHRT_MAX ? nRangeX : nXScroll) );
404 int x,
y, width, height;
429 if ( nTopDiff < nBottomDiff )
431 if ( nBottomDiff > 0 )
464 static_cast< sal_uInt16
>((aVisSize.
Width() - aSize.
Width()) / 2),
465 static_cast< sal_uInt16
>((aVisSize.
Height()- aSize.
Height())/ 2) );
482 CalcPt( &aPt, rRect, nRangeX, nRangeY );
598 sal_uInt16 nActPage =
m_pWrtShell->GetNextPrevPageNum(
false );
600 if( USHRT_MAX != nActPage )
607 if( aPt.
Y() != aAlPt.
Y() )
616 sal_uInt16 nActPage =
m_pWrtShell->GetNextPrevPageNum();
618 if( USHRT_MAX != nActPage )
625 if( aPt.
Y() != aAlPt.
Y() )
676 if ( GetWrtShell().ActionPend() )
679 if (rScrollbar.get_scroll_type() == ScrollType::Drag)
680 m_pWrtShell->EnableSmooth(
false );
682 bool bHidePending =
nPgNum != 0;
684 EndScrollHdl(rScrollbar,
false);
686 if (!m_pWrtShell->GetViewOptions()->getBrowseMode() &&
687 rScrollbar.get_scroll_type() == ScrollType::Drag)
690 m_pWrtShell->GetViewOptions()->IsShowScrollBarTips())
693 Point aPos( m_aVisArea.TopLeft() );
694 lcl_GetPos(
this, aPos, rScrollbar,
false, IsDocumentBorder());
696 sal_uInt16 nPhNum = 1;
697 sal_uInt16 nVirtNum = 1;
700 if(m_pWrtShell->GetPageNumber( aPos.
Y(),
false, nPhNum, nVirtNum,
sDisplay ))
703 if( m_pWrtShell->GetPageCnt() > 1 )
706 aRect.
SetLeft( m_pVScrollbar->GetParent()->OutputToScreenPixel(
707 m_pVScrollbar->GetPosPixel() ).X() -8 );
708 aRect.
SetTop( m_pVScrollbar->OutputToScreenPixel(
709 m_pVScrollbar->GetPointerPosPixel() ).Y() );
713 OUString sPageStr( GetPageStr( nPhNum, nVirtNum,
sDisplay ));
715 bool bSuccess = m_pWrtShell->GetContentAtPos(aPos, aCnt);
716 if (bSuccess && !aCnt.
sStr.isEmpty())
718 sal_Int32 nChunkLen = std::min<sal_Int32>(aCnt.
sStr.getLength(), 80);
719 std::u16string_view sChunk = aCnt.
sStr.subView(0, nChunkLen);
720 sPageStr = sPageStr +
" - " + sChunk;
721 sPageStr = sPageStr.replace(
'\t',
' ').replace(0x0a,
' ');
725 QuickHelpFlags::Right|QuickHelpFlags::VCenter);
726 bHidePending =
false;
736 if (rScrollbar.get_scroll_type() == ScrollType::Drag)
737 m_pWrtShell->EnableSmooth(
true );
753 lcl_GetPos(
this, aPos, rScrollbar, bHorizontal, bBorder);
764 EndScrollHdl(rScrollBar,
true);
782 if ( aRect.
Right() > lWidth )
792 if ( aRect.
Bottom() > lHeight )
808 bool bRightVRuler =
m_pWrtShell->GetViewOptions()->IsVRulerRight();
813 rToFill.
Right() = nWidth;
815 rToFill.
Left() = nWidth;
818 OSL_ENSURE(
m_pHRuler,
"Why is the ruler not present?");
827 rToFill.
Left() = nTmp;
829 rToFill.
Right() = nTmp;
849 const bool bHRuler = pHRuler && pHRuler->IsVisible();
851 pHRuler->GetSizePixel().Height() : 0;
852 const bool bVRuler = pVRuler && pVRuler->IsVisible();
854 pVRuler->GetSizePixel().Width() : 0;
862 WinBits nStyle = pVRuler->GetStyle()&~WB_RIGHT_ALIGNED;
863 Point aPos( rOfst.
X(), rOfst.
Y()+nHLinSzHeight );
871 aSize.
setWidth( pVRuler->GetSizePixel().Width() );
872 pVRuler->SetStyle(nStyle);
873 pVRuler->SetPosSizePixel( aPos, aSize );
874 if(!pVRuler->IsVisible())
880 Size aSize( rSize.
Width(), nHLinSzHeight );
881 if ( nVBSzWidth && !bVRulerRight)
884 aSize.
setHeight( pHRuler->GetSizePixel().Height() );
885 pHRuler->SetPosSizePixel( rOfst, aSize );
888 if(!pHRuler->IsVisible())
893 Point aScrollFillPos;
896 rOfst.
Y()+rSize.
Height()-nHBSzHeight );
902 Size aSize( rSize.
Width(), nHBSzHeight );
906 aScrollFillPos.
setY( aPos.
Y() );
914 aPos.
setX( rOfst.
X() );
928 aScrollFillPos.
setX( aPos.
X() );
935 if (
m_pWrtShell->GetViewOptions()->IsViewHRuler() )
954 const bool bHScrollVisible =
m_pHScrollbar->IsScrollbarVisible(
true);
955 const bool bVScrollVisible =
m_pVScrollbar->IsScrollbarVisible(
true);
956 bool bRepeat =
false;
964 Size aViewSize( aSz );
965 Point aViewPos( rOfst );
1010 else if(bHScrollVisible !=
m_pHScrollbar->IsScrollbarVisible(
true) ||
1040 bHAuto = bShowH =
false;
1044 bAuto = bShowV =
false;
1051 bShowH = bShowV = bHAuto = bAuto =
false;
1053 if(
m_pHScrollbar->IsScrollbarVisible(
false) != bShowH && !bHAuto)
1056 if(
m_pVScrollbar->IsScrollbarVisible(
false) != bShowV && !bAuto)
1061 bool bRepeat =
false;
1070 const bool bScroll1 =
m_pVScrollbar->IsScrollbarVisible(
true);
1071 const bool bScroll2 =
m_pHScrollbar->IsScrollbarVisible(
true);
1104 if (
m_pWrtShell->GetViewOptions()->GetZoomType() != SvxZoomType::PERCENT &&
1109 bRepeat = bScroll1 !=
m_pVScrollbar->IsScrollbarVisible(
true);
1111 bRepeat = bScroll2 !=
m_pHScrollbar->IsScrollbarVisible(
true);
1116 ( nCnt > 10 || ( nCnt > 3 && bHAuto && bAuto ) )
1122 }
while ( bRepeat );
1139 const Fraction &rFrac = rX < rY ? rX : rY;
1158 aTmpRect.
Move( -aPt.
X(), -aPt.
Y() );
1166 const bool bVScrollVisible =
m_pVScrollbar->IsScrollbarVisible(
true);
1169 if ( bVScrollVisible !=
m_pVScrollbar->IsScrollbarVisible(
true) )
1173 const bool bHScrollVisible =
m_pHScrollbar->IsScrollbarVisible(
true);
1176 if ( bHScrollVisible !=
m_pHScrollbar->IsScrollbarVisible(
true) )
1194 if (pWData && CommandWheelMode::ZOOM == pWData->
GetMode())
1196 sal_uInt16 nFact =
m_pWrtShell->GetViewOptions()->GetZoom();
1202 SetZoom( SvxZoomType::PERCENT, nFact );
1207 if (pWData && pWData->
GetMode()==CommandWheelMode::SCROLL)
1213 if (pWData && (CommandWheelMode::SCROLL==pWData->
GetMode()) &&
1235 if (
pData->meEventType == GestureEventZoomType::Begin)
1241 if (
pData->meEventType == GestureEventZoomType::Update)
1251 sal_uInt16 nFact =
m_pWrtShell->GetViewOptions()->GetZoom();
1252 nFact += nZoomChangePercent;
1254 SetZoom(SvxZoomType::PERCENT, nFact);
const StyleSettings & GetStyleSettings() const
const CommandGestureZoomData * GetGestureZoomData() const
const CommandWheelData * GetWheelData() const
tools::Long GetDelta() const
double GetScrollLines() const
CommandWheelMode GetMode() 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
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
void Update(sal_uInt16 nId)
void Invalidate(sal_uInt16 nId)
virtual tools::Rectangle GetVisArea(sal_uInt16 nAspect) const
const tools::Rectangle & GetVisArea() const
SfxViewFrame * GetFrame() const
SfxBindings & GetBindings()
weld::Window * GetFrameWeld() const
void SetBorderPixel(const SvBorder &rBorder)
virtual void SetZoomFactor(const Fraction &rZoomX, const Fraction &rZoomY)
SfxViewFrame & GetViewFrame() const
const SvBorder & GetBorderPixel() const
virtual SfxObjectShell * GetObjectShell() override
vcl::Window * GetWindow() 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
const SwRect & GetCharRect() const
SwFrameControlsManager & GetFrameControlsManager()
const SwRect & GetAnyCurRect(CurRectType eType, const Point *pPt=nullptr, const css::uno::Reference< css::embed::XEmbeddedObject > &=css::uno::Reference< css::embed::XEmbeddedObject >()) const
void HideControls(FrameControlType eType)
Of course Writer needs its own rectangles.
void Top(const tools::Long nTop)
void Pos(const Point &rNew)
void Left(const tools::Long nLeft)
SvxZoomType GetZoomType() const
bool IsViewHScrollBar() const
bool IsViewVScrollBar() const
bool IsStarOneSetting() const
const SwViewOption * GetViewOptions() const
const SwRect & VisArea() const
static weld::Window * GetCareDialog(SwViewShell const &rVSh)
SAL_DLLPRIVATE bool UpdateScrollbars()
VclPtr< SwScrollbar > m_pHScrollbar
SAL_DLLPRIVATE void ShowAtResize()
bool m_bWheelScrollInProgress
SAL_DLLPRIVATE bool PageDownCursor(bool bSelect)
SAL_DLLPRIVATE bool GetPageScrollUpOffset(SwTwips &rOff) const
Scroll page by page.
double m_fAccumulatedZoom
virtual void OuterResizePixel(const Point &rOfs, const Size &rSize) override
SwWrtShell & GetWrtShell() const
static constexpr sal_uInt16 MIN_ZOOM_PERCENT
void Scroll(const tools::Rectangle &rRect, sal_uInt16 nRangeX=USHRT_MAX, sal_uInt16 nRangeY=USHRT_MAX)
virtual SAL_DLLPRIVATE void Move() override
SAL_DLLPRIVATE bool PageDown()
bool HandleWheelCommands(const CommandEvent &)
std::unique_ptr< SwWrtShell > m_pWrtShell
std::unique_ptr< SwPostItMgr > m_pPostItMgr
VclPtr< SwScrollbar > m_pVScrollbar
static constexpr sal_uInt16 MAX_ZOOM_PERCENT
SAL_DLLPRIVATE void CalcPt(Point *pPt, const tools::Rectangle &rRect, sal_uInt16 nRangeX, sal_uInt16 nRangeY)
Calculate the visible range.
tools::Rectangle m_aVisArea
tools::Long SetHScrollMax(tools::Long lMax)
bool m_bInOuterResizePixel
bool m_bVScrollbarEnabled
VclPtr< SvxRuler > m_pHRuler
bool HandleGestureZoomCommand(const CommandEvent &)
VclPtr< SvxRuler > m_pVRuler
tools::Long GetXScroll() const
VclPtr< SwEditWin > m_pEditWin
void ShowHScrollbar(bool bShow)
const tools::Rectangle & GetVisArea() const
bool m_bInInnerResizePixel
virtual void InnerResizePixel(const Point &rOfs, const Size &rSize, bool inplaceEditModeChange) override
SAL_DLLPRIVATE bool PageUp()
const Size & GetDocSz() const
tools::Long SetVScrollMax(tools::Long lMax)
virtual void SetZoomFactor(const Fraction &rX, const Fraction &) override
SAL_DLLPRIVATE void PhyPageUp()
SAL_DLLPRIVATE bool PageUpCursor(bool bSelect)
SwTwips m_nLOKPageUpDownOffset
LibreOfficeKit has to force the page size for PgUp/PgDown functionality based on the user's view,...
bool IsScroll(const tools::Rectangle &rRect) const
SwDocShell * GetDocShell()
void DocSzChgd(const Size &rNewSize)
SAL_DLLPRIVATE void CalcAndSetBorderPixel(SvBorder &rToFill)
tools::Long GetYScroll() const
void SetVisArea(const tools::Rectangle &, bool bUpdateScrollbar=true)
SAL_DLLPRIVATE void EndScrollHdl(weld::Scrollbar &rScrollbar, bool bHorizontal)
void InvalidateRulerPos()
SAL_DLLPRIVATE void CalcVisArea(const Size &rPixelSz)
SAL_DLLPRIVATE void SetZoom_(const Size &rEditSz, SvxZoomType eZoomType, short nFactor, bool bViewOnly)
SAL_DLLPRIVATE bool GetPageScrollDownOffset(SwTwips &rOff) const
void ShowVScrollbar(bool bShow)
SAL_DLLPRIVATE Point AlignToPixel(const Point &rPt) const
bool m_bHScrollbarEnabled
SAL_DLLPRIVATE void PhyPageDown()
void SetZoom(SvxZoomType eZoomType, short nFactor=100, bool bViewOnly=false)
Used by the UI to modify the document model.
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)
#define COMMAND_WHEEL_PAGESCROLL
@ PagePrt
Rect of current PrtArea of page.
FrameTypeFlags
values can be combined via logical or
std::unique_ptr< sal_Int32[]> pData
tools::Long const nBorder
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
SwNodeOffset abs(const SwNodeOffset &a)
constexpr WinBits WB_RIGHT_ALIGNED
constexpr SwTwips DOCUMENTBORDER
const tools::Long nScrollX
const tools::Long nLeftOfst
static tools::Long GetLeftMargin(SwView const &rView)
static void lcl_GetPos(SwView const *pView, Point &rPos, const weld::Scrollbar &rScrollbar, bool bHori, bool bBorder)
IMPL_LINK(SwView, VertScrollHdl, weld::Scrollbar &, rScrollbar, void)
static bool bProtectDocShellVisArea
static void HideQuickHelp(vcl::Window *pParent)
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)