LibreOffice Module sw (master) 1
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
SwPagePreviewLayout Class Reference

page preview functionality in the writer More...

#include <pagepreviewlayout.hxx>

Collaboration diagram for SwPagePreviewLayout:
[legend]

Public Member Functions

 SwPagePreviewLayout (SwViewShell &_rParentViewShell, const SwRootFrame &_rLayoutRootFrame)
 constructor of <SwPagePreviewLayout> More...
 
 ~SwPagePreviewLayout ()
 destructor of <SwPagePreviewLayout> More...
 
void Init (const sal_uInt16 _nCols, const sal_uInt16 _nRows, const Size &_rPxWinSize)
 init page preview layout More...
 
void ReInit ()
 method to adjust page preview layout to document changes More...
 
bool Prepare (const sal_uInt16 _nProposedStartPageNum, const Point &rProposedStartPos, const Size &_rPxWinSize, sal_uInt16 &_onStartPageNum, tools::Rectangle &_orDocPreviewPaintRect, const bool _bStartWithPageAtFirstCol=true)
 prepare paint of page preview More...
 
sal_uInt16 SelectedPage ()
 get selected page number More...
 
void SetSelectedPage (sal_uInt16 _nSelectedPageNum)
 set selected page number More...
 
bool Paint (vcl::RenderContext &rRenderContext, const tools::Rectangle &rOutRect) const
 paint prepared preview More...
 
void Repaint (const tools::Rectangle &rInvalidCoreRect) const
 repaint pages on page preview More...
 
void MarkNewSelectedPage (const sal_uInt16 _nSelectedPage)
 paint to mark new selected page More...
 
Point GetPreviewStartPosForNewScale (const Fraction &_aNewScale, const Fraction &_aOldScale, const Size &_aNewWinSize) const
 calculate start position for new scale More...
 
bool IsPageVisible (const sal_uInt16 _nPageNum) const
 determines, if page with given page number is visible in preview More...
 
void CalcStartValuesForSelectedPageMove (const sal_Int16 _nHoriMove, const sal_Int16 _nVertMove, sal_uInt16 &_orNewSelectedPage, sal_uInt16 &_orNewStartPage, Point &_orNewStartPos) const
 calculate data to bring new selected page into view. More...
 
bool IsPreviewPosInDocPreviewPage (const Point &rPreviewPos, Point &_orDocPos, bool &_obPosInEmptyPage, sal_uInt16 &_onPageNum) const
 checks, if given position is inside a shown document page More...
 
bool DoesPreviewLayoutRowsFitIntoWindow () const
 
bool DoesPreviewLayoutColsFitIntoWindow () const
 
bool PreviewLayoutValid () const
 
SwTwips GetWinPagesScrollAmount (const sal_Int16 _nWinPagesToScroll) const
 determine preview window page scroll amount More...
 
sal_uInt16 GetRowOfPage (sal_uInt16 _nPageNum) const
 determine row the page with the given number is in More...
 
sal_uInt16 GetColOfPage (sal_uInt16 _nPageNum) const
 determine column the page with the given number is in More...
 
Size GetPreviewDocSize () const
 
Size GetPreviewPageSizeByPageNum (sal_uInt16 _nPageNum) const
 get size of a preview page by its physical page number More...
 
sal_uInt16 GetVirtPageNumByPageNum (sal_uInt16 _nPageNum) const
 get virtual page number by its physical page number More...
 
bool SetBookPreviewMode (const bool _bEnableBookPreview, sal_uInt16 &_onStartPageNum, tools::Rectangle &_orDocPreviewPaintRect)
 enable/disable book preview More...
 
sal_uInt16 ConvertRelativeToAbsolutePageNum (sal_uInt16 _nRelPageNum) const
 Convert relative to absolute page numbers (see PrintEmptyPages) More...
 
sal_uInt16 ConvertAbsoluteToRelativePageNum (sal_uInt16 _nAbsPageNum) const
 Convert absolute to relative page numbers (see PrintEmptyPages) More...
 
SwViewShellGetParentViewShell ()
 

Private Member Functions

void Clear_ ()
 clear internal data about current page preview More...
 
void ClearPreviewLayoutSizes ()
 helper method to clear preview page layout sizes More...
 
void ClearPreviewPageData ()
 helper method to clear data in preview page vectors More...
 
void CalcPreviewLayoutSizes ()
 calculate page preview layout sizes More...
 
void ApplyNewZoomAtViewShell (sal_uInt8 _aNewZoom)
 apply new zoom at given view shell More...
 
void CalcAdditionalPaintOffset ()
 calculate additional paint offset More...
 
void CalcDocPreviewPaintRect ()
 calculate painted preview document rectangle More...
 
void CalcPreviewDataForPage (const SwPageFrame &_rPage, const Point &_rPreviewOffset, PreviewPage *_opPreviewPage)
 determines preview data for a given page and a given preview offset More...
 
void CalcPreviewPages ()
 calculate preview pages More...
 
const PreviewPageGetPreviewPageByPageNum (const sal_uInt16 _nPageNum) const
 get preview page by physical page number More...
 
void PaintSelectMarkAtPage (vcl::RenderContext &rRenderContext, const PreviewPage *_aSelectedPreviewPage) const
 paint selection mark at page More...
 

Private Attributes

SwViewShellmrParentViewShell
 view shell the print preview is generated for. More...
 
const SwRootFramemrLayoutRootFrame
 top layout frame of the layout for accessing the pages More...
 
bool mbLayoutInfoValid
 boolean indicating, if the layout information (number of columns and rows) are valid. More...
 
bool mbLayoutSizesValid
 boolean indicating, if the calculated print preview layout sizes ( windows size in twips, maximal page size, column width, row height, width and height of a print preview page, size of the print preview document ) are valid More...
 
bool mbPaintInfoValid
 boolean indicating, if the paint information ( physical number of start page, start column and row, paint offsets, rectangle visible of the print preview document. More...
 
Size maWinSize
 
sal_uInt16 mnCols
 
sal_uInt16 mnRows
 
sal_uInt16 mnPages
 
bool mbBookPreview
 
bool mbBookPreviewModeToggled
 
Size maMaxPageSize
 
tools::Rectangle maPreviewDocRect
 
SwTwips mnColWidth
 
SwTwips mnRowHeight
 
SwTwips mnPreviewLayoutWidth
 
SwTwips mnPreviewLayoutHeight
 
bool mbDoesLayoutColsFitIntoWindow
 
bool mbDoesLayoutRowsFitIntoWindow
 
sal_uInt16 mnPaintPhyStartPageNum
 
sal_uInt16 mnPaintStartCol
 
sal_uInt16 mnPaintStartRow
 
bool mbNoPageVisible
 
Point maPaintStartPageOffset
 
Point maPaintPreviewDocOffset
 
Point maAdditionalPaintOffset
 
tools::Rectangle maPaintedPreviewDocRect
 
sal_uInt16 mnSelectedPageNum
 
std::vector< std::unique_ptr< PreviewPage > > maPreviewPages
 
bool mbInPaint
 #i22014# - internal booleans to indicate, that a new print preview layout has been created during a paint. More...
 
bool mbNewLayoutDuringPaint
 
bool mbPrintEmptyPages
 

Static Private Attributes

static constexpr SwTwips gnXFree = 4 * 142
 number of horizontal and vertical twips for spacing between the pages. More...
 
static constexpr SwTwips gnYFree = 4 * 142
 

Friends

class SwViewShell
 

Detailed Description

page preview functionality in the writer

Definition at line 42 of file pagepreviewlayout.hxx.

Constructor & Destructor Documentation

◆ SwPagePreviewLayout()

SwPagePreviewLayout::SwPagePreviewLayout ( SwViewShell _rParentViewShell,
const SwRootFrame _rLayoutRootFrame 
)

constructor of <SwPagePreviewLayout>

Parameters
_rParentViewShellinput parameter - reference to the view shell the page preview layout belongs to. Reference will be hold as member <mrParentViewShell>. Adjustments/Changes at this view shell: (1) Adjustment of the mapping mode at the output device. (2) Change of the zoom at the view options. (3) Preparations for paint of the page preview.
_rLayoutRootFrameinput parameter - constant reference to the root frame of the layout. Reference will be hold as member <mrLayoutRootFrame> in order to get access to the page frames.

Definition at line 46 of file pagepreviewlayout.cxx.

References Clear_(), SwViewShell::getIDocumentDeviceAccess(), IDocumentDeviceAccess::getPrintData(), SwPrintData::IsPrintEmptyPages(), mbBookPreview, mbBookPreviewModeToggled, mbPrintEmptyPages, and mrParentViewShell.

◆ ~SwPagePreviewLayout()

SwPagePreviewLayout::~SwPagePreviewLayout ( )
inline

destructor of <SwPagePreviewLayout>

Definition at line 211 of file pagepreviewlayout.hxx.

References ClearPreviewPageData().

Member Function Documentation

◆ ApplyNewZoomAtViewShell()

void SwPagePreviewLayout::ApplyNewZoomAtViewShell ( sal_uInt8  _aNewZoom)
private

apply new zoom at given view shell

Parameters
_aNewZoominput parameter - new zoom percentage

Definition at line 236 of file pagepreviewlayout.cxx.

References SwViewShell::ApplyViewOptions(), SwViewShell::GetViewOptions(), SwViewOption::GetZoom(), mrParentViewShell, SwViewOption::SetZoom(), and SwViewOption::SetZoomType().

Referenced by Init().

◆ CalcAdditionalPaintOffset()

void SwPagePreviewLayout::CalcAdditionalPaintOffset ( )
private

calculate additional paint offset

helper method called by <Prepare> in order to calculate an additional paint offset to center output in given window size. The booleans <mbDoesLayoutRowsFitIntoWindow> and <mbDoesLayoutColsFitIntoWindow> are also determined. preconditions: (1) preview layout is given (number of rows and columns). (2) window size is given. (3) height of row and width of column are calculated. (4) paint offset of start page is calculated.

Definition at line 472 of file pagepreviewlayout.cxx.

References Size::Height(), maAdditionalPaintOffset, maPaintStartPageOffset, maWinSize, mbDoesLayoutColsFitIntoWindow, mbDoesLayoutRowsFitIntoWindow, mnPreviewLayoutHeight, mnPreviewLayoutWidth, Point::setX(), Point::setY(), Size::Width(), Point::X(), and Point::Y().

Referenced by Prepare().

◆ CalcDocPreviewPaintRect()

void SwPagePreviewLayout::CalcDocPreviewPaintRect ( )
private

calculate painted preview document rectangle

helper method called by <Prepare> in order to calculate the rectangle, which will be painted for the document arranged by the given preview layout. preconditions: (1) paint offset of document preview is calculated. (2) size of document preview is calculated. (3) additional paint offset is calculated - see <CalcAdditionalPaintOffset>.

Definition at line 502 of file pagepreviewlayout.cxx.

References tools::Rectangle::GetHeight(), tools::Rectangle::GetWidth(), Size::Height(), maAdditionalPaintOffset, maPaintedPreviewDocRect, maPaintPreviewDocOffset, maPreviewDocRect, maWinSize, mbDoesLayoutColsFitIntoWindow, mbDoesLayoutRowsFitIntoWindow, min(), mnPreviewLayoutHeight, mnPreviewLayoutWidth, Size::setHeight(), tools::Rectangle::SetPos(), tools::Rectangle::SetSize(), Size::setWidth(), Size::Width(), Point::X(), and Point::Y().

Referenced by Prepare().

◆ CalcPreviewDataForPage()

void SwPagePreviewLayout::CalcPreviewDataForPage ( const SwPageFrame _rPage,
const Point _rPreviewOffset,
PreviewPage _opPreviewPage 
)
private

determines preview data for a given page and a given preview offset

Parameters
_rPageinput parameter - constant reference to page frame, for which the preview data will be calculated.
_rPreviewOffsetinput parameter - constant reference to the offset the given page has in the current preview window. Note: Offset can be negative.
_opPreviewPageoutput parameter - calculated preview data.

OD 13.12.2002 #103492#

Definition at line 642 of file pagepreviewlayout.cxx.

References Point::AdjustX(), Point::AdjustY(), PreviewPage::aLogicPos, PreviewPage::aMapOffset, PreviewPage::aPageSize, PreviewPage::aPreviewWinPos, SwFrameAreaDefinition::getFrameArea(), SwFrame::GetNext(), SwPageFrame::GetPhyPageNum(), SwFrame::GetPrev(), Size::Height(), SwPageFrame::IsEmptyPage(), maMaxPageSize, SwRect::Pos(), PreviewPage::pPage, SwRect::SSize(), and Size::Width().

Referenced by CalcPreviewPages().

◆ CalcPreviewLayoutSizes()

void SwPagePreviewLayout::CalcPreviewLayoutSizes ( )
private

◆ CalcPreviewPages()

void SwPagePreviewLayout::CalcPreviewPages ( )
private

calculate preview pages

helper method called by <Prepare> in order to determine which pages will be visible in the current preview and calculate the data needed to paint these pages. Also the accessible pages with its needed data are determined.

check whether RTL interface or not

check whether RTL interface or not

check whether RTL interface or not

Definition at line 526 of file pagepreviewlayout.cxx.

References Point::AdjustX(), Point::AdjustY(), SwFrame::Calc(), CalcPreviewDataForPage(), ClearPreviewPageData(), AllSettings::GetLayoutRTL(), SwFrame::GetNext(), SwViewShell::GetOut(), SwRootFrame::GetPageByPageNum(), SwPageFrame::GetPhyPageNum(), gnXFree, gnYFree, Size::Height(), SwPageFrame::IsEmptyPage(), maAdditionalPaintOffset, maPaintStartPageOffset, maPreviewPages, maWinSize, mbBookPreview, mbDoesLayoutRowsFitIntoWindow, mbNoPageVisible, mbPrintEmptyPages, mnCols, mnColWidth, mnPaintPhyStartPageNum, mnPaintStartCol, mnRowHeight, mnRows, mrLayoutRootFrame, mrParentViewShell, Point::setX(), Size::Width(), Point::X(), and Point::Y().

Referenced by Prepare().

◆ CalcStartValuesForSelectedPageMove()

void SwPagePreviewLayout::CalcStartValuesForSelectedPageMove ( const sal_Int16  _nHoriMove,
const sal_Int16  _nVertMove,
sal_uInt16 &  _orNewSelectedPage,
sal_uInt16 &  _orNewStartPage,
Point _orNewStartPos 
) const

calculate data to bring new selected page into view.

Parameters
_nHoriMoveinput parameter - positive/negative number of columns the current selected page have to be moved.
_nVertMoveinput parameter - positive/negative number of rows the current selected page have to be moved.
_orNewSelectedPageoutput parameter - number of new selected page
_orNewStartPageoutput parameter - number of new start page
_orNewStartPosoutput parameter - new start position in document preview
Note
IN/OUT parameters are absolute page numbers!!!

Definition at line 790 of file pagepreviewlayout.cxx.

References ConvertAbsoluteToRelativePageNum(), ConvertRelativeToAbsolutePageNum(), GetRowOfPage(), IsPageVisible(), mbBookPreview, mbDoesLayoutColsFitIntoWindow, mbDoesLayoutRowsFitIntoWindow, mnCols, mnPages, mnPaintPhyStartPageNum, mnRows, and mnSelectedPageNum.

Referenced by SwPagePreview::Execute().

◆ Clear_()

void SwPagePreviewLayout::Clear_ ( )
private

◆ ClearPreviewLayoutSizes()

void SwPagePreviewLayout::ClearPreviewLayoutSizes ( )
private

◆ ClearPreviewPageData()

void SwPagePreviewLayout::ClearPreviewPageData ( )
private

helper method to clear data in preview page vectors

Definition at line 106 of file pagepreviewlayout.cxx.

References maPreviewPages.

Referenced by CalcPreviewPages(), Clear_(), and ~SwPagePreviewLayout().

◆ ConvertAbsoluteToRelativePageNum()

sal_uInt16 SwPagePreviewLayout::ConvertAbsoluteToRelativePageNum ( sal_uInt16  _nAbsPageNum) const

◆ ConvertRelativeToAbsolutePageNum()

sal_uInt16 SwPagePreviewLayout::ConvertRelativeToAbsolutePageNum ( sal_uInt16  _nRelPageNum) const

◆ DoesPreviewLayoutColsFitIntoWindow()

bool SwPagePreviewLayout::DoesPreviewLayoutColsFitIntoWindow ( ) const
inline

◆ DoesPreviewLayoutRowsFitIntoWindow()

bool SwPagePreviewLayout::DoesPreviewLayoutRowsFitIntoWindow ( ) const
inline

◆ GetColOfPage()

sal_uInt16 SwPagePreviewLayout::GetColOfPage ( sal_uInt16  _nPageNum) const

determine column the page with the given number is in

Parameters
_nPageNuminput parameter - physical page number of page, for which the column in preview layout has to be calculated.
Returns
number of column the page with the given physical page number is in

OD 17.01.2003 #103492#

Note
_nPageNum is relative

Definition at line 1369 of file pagepreviewlayout.cxx.

References mbBookPreview, and mnCols.

Referenced by Prepare().

◆ GetParentViewShell()

SwViewShell & SwPagePreviewLayout::GetParentViewShell ( )
inline

Definition at line 481 of file pagepreviewlayout.hxx.

References mrParentViewShell.

Referenced by SwPagePreviewWin::Paint().

◆ GetPreviewDocSize()

Size SwPagePreviewLayout::GetPreviewDocSize ( ) const

◆ GetPreviewPageByPageNum()

const PreviewPage * SwPagePreviewLayout::GetPreviewPageByPageNum ( const sal_uInt16  _nPageNum) const
private

get preview page by physical page number

Parameters
_nPageNuminput parameter - physical page number of page, for which the preview page will be returned.
Returns
pointer to preview page of current preview pages. If page doesn't belongs to current preview pages, <0> is returned.

Definition at line 1331 of file pagepreviewlayout.cxx.

References maPreviewPages.

Referenced by GetPreviewPageSizeByPageNum(), GetVirtPageNumByPageNum(), IsPageVisible(), and MarkNewSelectedPage().

◆ GetPreviewPageSizeByPageNum()

Size SwPagePreviewLayout::GetPreviewPageSizeByPageNum ( sal_uInt16  _nPageNum) const

get size of a preview page by its physical page number

Parameters
_nPageNuminput parameter - physical page number of preview page, for which the page size has to be returned.
Returns
an object of class <Size>

OD 15.01.2003 #103492#

Definition at line 1394 of file pagepreviewlayout.cxx.

References PreviewPage::aPageSize, and GetPreviewPageByPageNum().

Referenced by SwAccessibleMap::GetPreviewPageSize().

◆ GetPreviewStartPosForNewScale()

Point SwPagePreviewLayout::GetPreviewStartPosForNewScale ( const Fraction _aNewScale,
const Fraction _aOldScale,
const Size _aNewWinSize 
) const

calculate start position for new scale

calculate new start position for a new scale. Calculation bases on the current visible part of the document arranged in the given preview layout. preconditions: (1) new scaling is already set at the given output device.

Returns
Point, start position for new scale

Definition at line 719 of file pagepreviewlayout.cxx.

References Point::AdjustX(), Point::AdjustY(), tools::Rectangle::Bottom(), tools::Rectangle::GetHeight(), tools::Rectangle::GetWidth(), Size::Height(), maPaintedPreviewDocRect, maPreviewDocRect, mbDoesLayoutRowsFitIntoWindow, mnPaintStartRow, mnPreviewLayoutHeight, mnPreviewLayoutWidth, mnRowHeight, Point::setX(), Point::setY(), tools::Rectangle::TopLeft(), Size::Width(), Point::X(), and Point::Y().

Referenced by SwPagePreviewWin::AdjustPreviewToNewZoom().

◆ GetRowOfPage()

sal_uInt16 SwPagePreviewLayout::GetRowOfPage ( sal_uInt16  _nPageNum) const

determine row the page with the given number is in

Parameters
_nPageNuminput parameter - physical page number of page, for which the row in preview layout has to be calculated.
Returns
number of row the page with the given physical page number is in

OD 17.01.2003 #103492#

Note
_nPageNum is relative

Definition at line 1349 of file pagepreviewlayout.cxx.

References mbBookPreview, and mnCols.

Referenced by CalcPreviewLayoutSizes(), CalcStartValuesForSelectedPageMove(), and Prepare().

◆ GetVirtPageNumByPageNum()

sal_uInt16 SwPagePreviewLayout::GetVirtPageNumByPageNum ( sal_uInt16  _nPageNum) const

get virtual page number by its physical page number

Parameters
_nPageNuminput parameter - physical page number of preview page, for which the virtual page number has to be determined.
Returns
virtual page number of page given by its physical page number, if the page is in the current preview pages vector, otherwise 0.

OD 21.03.2003 #108282#

Definition at line 1408 of file pagepreviewlayout.cxx.

References GetPreviewPageByPageNum(), SwFrame::GetVirtPageNum(), and PreviewPage::pPage.

Referenced by SwPagePreviewWin::GetStatusStr().

◆ GetWinPagesScrollAmount()

SwTwips SwPagePreviewLayout::GetWinPagesScrollAmount ( const sal_Int16  _nWinPagesToScroll) const

determine preview window page scroll amount

determine window page scroll amount

Parameters
_nWinPagesToScrollinput parameter - number of preview window pages the scroll amount has to be calculated for. Negative values for preview window page up scrolling, positive values for preview window page down scrolling.
Returns
scroll amount in SwTwips

Definition at line 926 of file pagepreviewlayout.cxx.

References tools::Rectangle::Bottom(), tools::Rectangle::GetHeight(), gnYFree, maPaintedPreviewDocRect, maPreviewDocRect, mbDoesLayoutRowsFitIntoWindow, mbLayoutSizesValid, mnPreviewLayoutHeight, mnRowHeight, and tools::Rectangle::Top().

Referenced by SwPagePreview::EndScrollHdl(), SwPagePreview::ExecPgUpAndPgDown(), and SwPagePreview::GetState().

◆ Init()

void SwPagePreviewLayout::Init ( const sal_uInt16  _nCols,
const sal_uInt16  _nRows,
const Size _rPxWinSize 
)

init page preview layout

initialize the page preview settings for a given layout. side effects: (1) If parameter <_bCalcScale> is true, mapping mode with calculated scaling is set at the output device and the zoom at the view options of the given view shell is set with the calculated scaling.

Parameters
_nColsinput parameter - initial number of page columns in the preview.
_nRowsinput parameter - initial number of page rows in the preview.
_rPxWinSizeinput parameter - window size in which the preview will be displayed and for which the scaling will be calculated.

initialize the page preview settings for a given layout.

side effects: (1) If parameter <_bCalcScale> is true, mapping mode with calculated scaling is set at the output device and the zoom at the view options of the given view shell is set with the calculated scaling.

Definition at line 171 of file pagepreviewlayout.cxx.

References ApplyNewZoomAtViewShell(), CalcPreviewLayoutSizes(), Clear_(), SwViewShell::GetOut(), Size::Height(), maWinSize, mbLayoutInfoValid, mbLayoutSizesValid, mnCols, mnPreviewLayoutHeight, mnPreviewLayoutWidth, mnRows, mrParentViewShell, OutputDevice::PixelToLogic(), OutputDevice::SetMapMode(), MapMode::SetScaleX(), MapMode::SetScaleY(), SwCalcPixStatics(), and Size::Width().

Referenced by SwPagePreviewWin::AdjustPreviewToNewZoom(), SwPagePreviewWin::CalcWish(), and SwPagePreviewWin::SetWinSize().

◆ IsPageVisible()

bool SwPagePreviewLayout::IsPageVisible ( const sal_uInt16  _nPageNum) const

determines, if page with given page number is visible in preview

Parameters
_nPageNuminput parameter - physical number of page, for which it will be determined, if it is visible.
Returns
boolean, indicating, if page with given page number is visible in preview.
Note
_nPageNum is absolute

Definition at line 780 of file pagepreviewlayout.cxx.

References PreviewPage::bVisible, and GetPreviewPageByPageNum().

Referenced by CalcStartValuesForSelectedPageMove(), SwPagePreview::EndScrollHdl(), SwPagePreview::Execute(), SwPagePreview::GetState(), SwPagePreviewWin::GetStatusStr(), and SwPagePreview::ScrollViewSzChg().

◆ IsPreviewPosInDocPreviewPage()

bool SwPagePreviewLayout::IsPreviewPosInDocPreviewPage ( const Point rPreviewPos,
Point _orDocPos,
bool &  _obPosInEmptyPage,
sal_uInt16 &  _onPageNum 
) const

checks, if given position is inside a shown document page

Parameters
_aPreviewPosinput parameter - position inside the visible preview window.
_orDocPosoutput parameter - corresponding position in the document, if given preview position is inside a shown document page, not an empty page. If not, its value is <Point( 0, 0 )>.
_obPosInEmptyPageoutput parameter - indicates, that given preview position lays inside an shown empty page.
_onPageNumoutput parameter - corresponding physical number of page, if given preview position is inside a shown document page, considers also empty pages. If not, its value is <0>.
Returns
boolean - indicating, that given preview position lays inside a shown document preview page, not an empty page.

Definition at line 892 of file pagepreviewlayout.cxx.

References maPreviewPages, Point::setX(), and Point::setY().

Referenced by SwPagePreviewWin::MouseButtonDown().

◆ MarkNewSelectedPage()

void SwPagePreviewLayout::MarkNewSelectedPage ( const sal_uInt16  _nSelectedPage)

paint to mark new selected page

Perform paint for current selected page in order to unmark it. Set new selected page and perform paint to mark this page.

Parameters
_nNewSelectedPageinput parameter - physical number of page, which will be marked as selected.

OD 17.12.2002 #103492# Perform paint for current selected page in order to unmark it. Set new selected page and perform paint to mark this page.

Note
_nSelectedPage, mnSelectedPage are absolute

Definition at line 1265 of file pagepreviewlayout.cxx.

References PreviewPage::aPageSize, PreviewPage::aPreviewWinPos, tools::Rectangle::Bottom(), PreviewPage::bVisible, SwViewShell::GetOut(), GetPreviewPageByPageNum(), SwViewShell::GetWin(), vcl::Window::Invalidate(), tools::Rectangle::Left(), OutputDevice::LogicToPixel(), mnSelectedPageNum, mrParentViewShell, OutputDevice::PixelToLogic(), tools::Rectangle::Right(), SwRect::SVRect(), SwAlignRect(), and tools::Rectangle::Top().

Referenced by SwPagePreview::EndScrollHdl(), SwPagePreview::Execute(), and SwPagePreviewWin::MouseButtonDown().

◆ Paint()

bool SwPagePreviewLayout::Paint ( vcl::RenderContext rRenderContext,
const tools::Rectangle rOutRect 
) const

paint prepared preview

Parameters
_aOutRectinput parameter - Twip rectangle of window, which should be painted.
Returns
boolean, indicating, if paint of preview was performed

Definition at line 991 of file pagepreviewlayout.cxx.

References SwRect::Clear(), SwViewShell::DLPostPaint2(), SwViewShell::DLPrePaint2(), OutputDevice::DrawRect(), OutputDevice::DrawText(), SwPageFrame::GetBorderAndShadowBoundRect(), OutputDevice::GetConnectMetaFile(), SwPageFrame::GetEmptyPageFont(), OutputDevice::GetFillColor(), OutputDevice::GetFont(), OutputDevice::GetMapMode(), SwViewShell::GetOut(), SwRootFrame::GetPageByPageNum(), SwPageFrame::GetPhyPageNum(), SwViewShellImp::GetRetoucheColor(), MapMode::GetScaleX(), SwViewShell::GetWin(), SwViewShell::Imp(), tools::Rectangle::Intersection(), SwPageFrame::IsEmptyPage(), SwPageFrame::IsLeftShadowNeeded(), SwPageFrame::IsRightShadowNeeded(), SwRootFrame::IsSuperfluous(), OutputDevice::LogicToPixel(), SwViewShellImp::m_bFirstPageInvalid, SwViewShellImp::m_pFirstVisiblePage, maPreviewPages, SwViewShell::maVisArea, maWinSize, mbInPaint, mbNewLayoutDuringPaint, mbPaintInfoValid, mnSelectedPageNum, mrLayoutRootFrame, mrParentViewShell, tools::Rectangle::Overlaps(), SwViewShell::Paint(), SwPageFrame::PaintBorderAndShadow(), SwViewShell::PaintDesktop_(), PaintSelectMarkAtPage(), OutputDevice::PixelToLogic(), OutputDevice::SetFillColor(), OutputDevice::SetFont(), OutputDevice::SetLineColor(), OutputDevice::SetMapMode(), MapMode::SetOrigin(), SwRect::SVRect(), SwAlignRect(), SwResId(), and SwViewShellImp::UpdateAccessiblePreview().

Referenced by SwPagePreviewWin::Paint().

◆ PaintSelectMarkAtPage()

void SwPagePreviewLayout::PaintSelectMarkAtPage ( vcl::RenderContext rRenderContext,
const PreviewPage _aSelectedPreviewPage 
) const
private

◆ Prepare()

bool SwPagePreviewLayout::Prepare ( const sal_uInt16  _nProposedStartPageNum,
const Point rProposedStartPos,
const Size _rPxWinSize,
sal_uInt16 &  _onStartPageNum,
tools::Rectangle _orDocPreviewPaintRect,
const bool  _bStartWithPageAtFirstCol = true 
)

prepare paint of page preview

With the valid preview layout settings - calculated and set by method <Init(..)> - the paint of a specific part of the virtual preview document is prepared. The corresponding part is given by either a start page (parameter <_nProposedStartPageNum>) or an absolute position (parameter <_aProposedStartPoint>). The accessibility preview will also be updated via a corresponding method call.

Parameters
_nProposedStartPageNum[0..<number of document pages>] input parameter - proposed number of page, which should be painted in the left-top-corner in the current output device. input parameter <_bStartWithPageAtFirstCol> influences, if proposed page is actual painted in the left-top-corner.
_nProposedStartPos[(0,0)..<PreviewDocumentSize>] input parameter - proposed absolute position in the virtual preview document, which should be painted in the left-top-corner in the current output device.
_rPxWinSizeinput parameter - pixel size of window the preview will be painted in.
_onStartPageNumoutput parameter - physical number of page, which will be painted in the left-top-corner in the current output device.
_orDocPreviewPaintRectoutput parameter - rectangle of preview document, which will be painted.
_bStartWithPageAtFirstColinput parameter with default value "true" - controls, if start page is set to page in first column the proposed start page is located.
Returns
boolean, indicating, if prepare of preview paint was successful.

delete parameter _onStartPageVirtNum

Note
_nProposedStartPageNum, _onStartPageNum are absolute

Definition at line 274 of file pagepreviewlayout.cxx.

References tools::Rectangle::Bottom(), CalcAdditionalPaintOffset(), CalcDocPreviewPaintRect(), CalcPreviewPages(), ConvertAbsoluteToRelativePageNum(), ConvertRelativeToAbsolutePageNum(), GetColOfPage(), tools::Rectangle::GetHeight(), SwViewShell::GetOut(), GetRowOfPage(), tools::Rectangle::GetWidth(), gnXFree, gnYFree, Size::Height(), Size::IsEmpty(), maPaintedPreviewDocRect, maPaintPreviewDocOffset, maPaintStartPageOffset, maPreviewDocRect, maWinSize, mbBookPreview, mbBookPreviewModeToggled, mbDoesLayoutColsFitIntoWindow, mbDoesLayoutRowsFitIntoWindow, mbInPaint, mbLayoutInfoValid, mbLayoutSizesValid, mbNewLayoutDuringPaint, mbNoPageVisible, mbPaintInfoValid, mnCols, mnColWidth, mnPages, mnPaintPhyStartPageNum, mnPaintStartCol, mnPaintStartRow, mnPreviewLayoutHeight, mnRowHeight, tools::Rectangle::Move(), mrParentViewShell, OutputDevice::PixelToLogic(), Prepare(), tools::Rectangle::Right(), Point::setX(), Point::setY(), tools::Rectangle::TopLeft(), Size::Width(), Point::X(), and Point::Y().

Referenced by SwPagePreviewWin::AdjustPreviewToNewZoom(), SwPagePreviewWin::CalcWish(), SwPagePreviewWin::MovePage(), SwPagePreviewWin::Paint(), Prepare(), SwPagePreviewWin::Scroll(), SetBookPreviewMode(), and SwPagePreviewWin::SetWinSize().

◆ PreviewLayoutValid()

bool SwPagePreviewLayout::PreviewLayoutValid ( ) const
inline

◆ ReInit()

void SwPagePreviewLayout::ReInit ( )

method to adjust page preview layout to document changes

Definition at line 251 of file pagepreviewlayout.cxx.

References CalcPreviewLayoutSizes(), ClearPreviewLayoutSizes(), mbLayoutInfoValid, and mbLayoutSizesValid.

Referenced by SwPagePreviewWin::MovePage(), and SetBookPreviewMode().

◆ Repaint()

void SwPagePreviewLayout::Repaint ( const tools::Rectangle rInvalidCoreRect) const

◆ SelectedPage()

sal_uInt16 SwPagePreviewLayout::SelectedPage ( )
inline

get selected page number

Definition at line 288 of file pagepreviewlayout.hxx.

References mnSelectedPageNum.

Referenced by SwPagePreviewWin::GetStatusStr(), and SwPagePreviewWin::SelectedPage().

◆ SetBookPreviewMode()

bool SwPagePreviewLayout::SetBookPreviewMode ( const bool  _bEnableBookPreview,
sal_uInt16 &  _onStartPageNum,
tools::Rectangle _orDocPreviewPaintRect 
)

◆ SetSelectedPage()

void SwPagePreviewLayout::SetSelectedPage ( sal_uInt16  _nSelectedPageNum)
inline

set selected page number

Definition at line 294 of file pagepreviewlayout.hxx.

References mnSelectedPageNum.

Referenced by SwPagePreviewWin::SetSelectedPage().

Friends And Related Function Documentation

◆ SwViewShell

friend class SwViewShell
friend

Definition at line 45 of file pagepreviewlayout.hxx.

Member Data Documentation

◆ gnXFree

constexpr SwTwips SwPagePreviewLayout::gnXFree = 4 * 142
staticconstexprprivate

number of horizontal and vertical twips for spacing between the pages.

Definition at line 48 of file pagepreviewlayout.hxx.

Referenced by CalcPreviewLayoutSizes(), CalcPreviewPages(), and Prepare().

◆ gnYFree

constexpr SwTwips SwPagePreviewLayout::gnYFree = 4 * 142
staticconstexprprivate

◆ maAdditionalPaintOffset

Point SwPagePreviewLayout::maAdditionalPaintOffset
private

◆ maMaxPageSize

Size SwPagePreviewLayout::maMaxPageSize
private

◆ maPaintedPreviewDocRect

tools::Rectangle SwPagePreviewLayout::maPaintedPreviewDocRect
private

◆ maPaintPreviewDocOffset

Point SwPagePreviewLayout::maPaintPreviewDocOffset
private

Definition at line 91 of file pagepreviewlayout.hxx.

Referenced by CalcDocPreviewPaintRect(), Clear_(), Prepare(), and SetBookPreviewMode().

◆ maPaintStartPageOffset

Point SwPagePreviewLayout::maPaintStartPageOffset
private

Definition at line 90 of file pagepreviewlayout.hxx.

Referenced by CalcAdditionalPaintOffset(), CalcPreviewPages(), Clear_(), and Prepare().

◆ maPreviewDocRect

tools::Rectangle SwPagePreviewLayout::maPreviewDocRect
private

◆ maPreviewPages

std::vector<std::unique_ptr<PreviewPage> > SwPagePreviewLayout::maPreviewPages
private

◆ maWinSize

Size SwPagePreviewLayout::maWinSize
private

◆ mbBookPreview

bool SwPagePreviewLayout::mbBookPreview
private

◆ mbBookPreviewModeToggled

bool SwPagePreviewLayout::mbBookPreviewModeToggled
private

Definition at line 75 of file pagepreviewlayout.hxx.

Referenced by Prepare(), SetBookPreviewMode(), and SwPagePreviewLayout().

◆ mbDoesLayoutColsFitIntoWindow

bool SwPagePreviewLayout::mbDoesLayoutColsFitIntoWindow
private

◆ mbDoesLayoutRowsFitIntoWindow

bool SwPagePreviewLayout::mbDoesLayoutRowsFitIntoWindow
private

◆ mbInPaint

bool SwPagePreviewLayout::mbInPaint
mutableprivate

#i22014# - internal booleans to indicate, that a new print preview layout has been created during a paint.

Definition at line 100 of file pagepreviewlayout.hxx.

Referenced by Clear_(), Paint(), and Prepare().

◆ mbLayoutInfoValid

bool SwPagePreviewLayout::mbLayoutInfoValid
private

boolean indicating, if the layout information (number of columns and rows) are valid.

Definition at line 58 of file pagepreviewlayout.hxx.

Referenced by Clear_(), Init(), Prepare(), PreviewLayoutValid(), and ReInit().

◆ mbLayoutSizesValid

bool SwPagePreviewLayout::mbLayoutSizesValid
private

boolean indicating, if the calculated print preview layout sizes ( windows size in twips, maximal page size, column width, row height, width and height of a print preview page, size of the print preview document ) are valid

Definition at line 63 of file pagepreviewlayout.hxx.

Referenced by Clear_(), GetWinPagesScrollAmount(), Init(), Prepare(), PreviewLayoutValid(), and ReInit().

◆ mbNewLayoutDuringPaint

bool SwPagePreviewLayout::mbNewLayoutDuringPaint
mutableprivate

Definition at line 101 of file pagepreviewlayout.hxx.

Referenced by Clear_(), Paint(), and Prepare().

◆ mbNoPageVisible

bool SwPagePreviewLayout::mbNoPageVisible
private

Definition at line 89 of file pagepreviewlayout.hxx.

Referenced by CalcPreviewPages(), Clear_(), and Prepare().

◆ mbPaintInfoValid

bool SwPagePreviewLayout::mbPaintInfoValid
private

boolean indicating, if the paint information ( physical number of start page, start column and row, paint offsets, rectangle visible of the print preview document.

Definition at line 67 of file pagepreviewlayout.hxx.

Referenced by Clear_(), Paint(), Prepare(), PreviewLayoutValid(), and Repaint().

◆ mbPrintEmptyPages

bool SwPagePreviewLayout::mbPrintEmptyPages
private

◆ mnCols

sal_uInt16 SwPagePreviewLayout::mnCols
private

◆ mnColWidth

SwTwips SwPagePreviewLayout::mnColWidth
private

◆ mnPages

sal_uInt16 SwPagePreviewLayout::mnPages
private

◆ mnPaintPhyStartPageNum

sal_uInt16 SwPagePreviewLayout::mnPaintPhyStartPageNum
private

◆ mnPaintStartCol

sal_uInt16 SwPagePreviewLayout::mnPaintStartCol
private

Definition at line 87 of file pagepreviewlayout.hxx.

Referenced by CalcPreviewPages(), Clear_(), and Prepare().

◆ mnPaintStartRow

sal_uInt16 SwPagePreviewLayout::mnPaintStartRow
private

Definition at line 88 of file pagepreviewlayout.hxx.

Referenced by Clear_(), GetPreviewStartPosForNewScale(), and Prepare().

◆ mnPreviewLayoutHeight

SwTwips SwPagePreviewLayout::mnPreviewLayoutHeight
private

◆ mnPreviewLayoutWidth

SwTwips SwPagePreviewLayout::mnPreviewLayoutWidth
private

◆ mnRowHeight

SwTwips SwPagePreviewLayout::mnRowHeight
private

◆ mnRows

sal_uInt16 SwPagePreviewLayout::mnRows
private

◆ mnSelectedPageNum

sal_uInt16 SwPagePreviewLayout::mnSelectedPageNum
private

◆ mrLayoutRootFrame

const SwRootFrame& SwPagePreviewLayout::mrLayoutRootFrame
private

top layout frame of the layout for accessing the pages

Definition at line 54 of file pagepreviewlayout.hxx.

Referenced by CalcPreviewLayoutSizes(), CalcPreviewPages(), ConvertAbsoluteToRelativePageNum(), ConvertRelativeToAbsolutePageNum(), and Paint().

◆ mrParentViewShell

SwViewShell& SwPagePreviewLayout::mrParentViewShell
private

The documentation for this class was generated from the following files: