38 #include <viewimp.hxx>
77 explicit SwDrawViewSave(
SdrView* pSdrView );
88 while ( pPt->
pSh != pNew && pPt->
pNext )
90 if ( pPt->
pSh == pNew )
140 while ( pPt && pPt->
pSh != pSh )
157 OSL_ENSURE( !pSh->
GetWin(),
"Print with window?" );
166 aPt.setX( -aPt.X() ); aPt.setY( -aPt.Y() );
171 aMapMode.SetOrigin( aPt );
186 aMapMode.SetMapUnit( MapUnit::MapTwip );
207 bool bNewOri = eOri != Orientation::Portrait;
209 for(
size_t i = 0;
i < nAll; ++
i )
227 if( bNewOri ? aSz.GetHeight() > aSz.GetWidth()
228 : aSz.GetHeight() < aSz.GetWidth() )
231 aSz.SetHeight( aSz.GetWidth() );
232 aSz.SetWidth( aTmp );
248 for(
size_t i = 0;
i < nAll; ++
i )
284 for ( sal_uInt16
i = 1; pPage &&
i <= nMax; pPage = pPage->
GetNext(), ++i )
306 OSL_ENSURE( dynamic_cast<const SwFEShell*>(
this) !=
nullptr,
"SwViewShell::Prt for FEShell only");
320 if(
nullptr != pCpyItem )
332 pActCursor = pActCursor->
GetPrev();
348 pContentFrame->
GetCharRect( aCharRect, *pShellTableCursor->
Start(), &aTmpState );
352 else if (pFirstCursor)
358 OSL_ENSURE( pPage,
"no page found!" );
372 static_cast<SwTextNode*>(pLastNd)->CopyCollFormat( *pTextNd );
376 pFESh->
Copy(rPrtDoc);
391 if( pFirstCursor && pFirstCursor->
HasMark() )
400 static_cast<SwTextNode*>(pFirstNd)->CopyCollFormat( *pTextNd );
414 for (sal_Int32
i = nPage; pPage && (
i > 0); --
i)
421 OSL_ENSURE(pPage,
"ERROR: SwPageFrame expected");
422 OSL_FAIL(
"non-existent page requested");
435 OSL_ENSURE( 0 <= nRenderer && nRenderer <= nMaxRenderer,
"nRenderer out of bounds");
436 if (!pOutDev || nMaxRenderer < 0 || nRenderer < 0 || nRenderer > nMaxRenderer)
448 std::unique_ptr<GDIMetaFile> pMetaFile;
455 if ( bHasPostItsToPrintInMargins )
466 pMetaFile->SetPrefMapMode(pOutDev->
GetMapMode());
467 pMetaFile->Record(pOutDev);
476 std::unique_ptr<SwViewShell> pShell(
new SwViewShell(*
this,
nullptr, pOutDev));
478 SdrView *pDrawView = pShell->GetDrawView();
490 if(
mpOpt->IsReadonly() )
491 pShell->mpOpt->SetReadonly(
true );
494 SwDrawViewSave aDrawViewSave( pShell->GetDrawView() );
495 pShell->PrepareForPrint( rPrintData, bIsPDFExport );
498 OSL_ENSURE( nPage < 0 ||
500 "SwViewShell::PrintOrPDFExport: nPage not valid" );
507 OSL_ENSURE( pStPage,
"failed to get start page" );
517 pShell->InitPrt(pOutDev);
525 SwPostItMgr *pPostItManager = bHasPostItsToPrintInMargins ? pShell->GetPostItMgr() :
nullptr;
535 pMetaFile->WindStart();
543 double fScale = 0.75;
547 pMetaFile->Scale( fScale, fScale );
548 pMetaFile->WindStart();
553 pMetaFile->WindStart();
556 pMetaFile->Play(pOutDev);
575 std::unique_ptr<SwViewShell> pSh;
579 pSh.reset(
new SwViewShell( *pDoc,
nullptr, pOpt, &rRenderContext));
583 pSh->PrepareForPrint( rOptions );
584 pSh->SetPrtFormatOption(
true );
587 pSh->maVisArea = aSwRect;
589 if ( pSh->GetViewOptions()->getBrowseMode() &&
590 pSh->GetRingContainer().size() == 1 )
592 pSh->InvalidateLayout(
false );
593 pSh->GetLayout()->Lower()->InvalidateSize();
602 rRenderContext.
Push( PushFlags::CLIPREGION );
604 pSh->GetLayout()->PaintSwFrame( rRenderContext, aSwRect );
606 rRenderContext.
Pop();
616 auto pFormatField =
dynamic_cast<const SwFormatField*
>(pItem);
619 const SwTextField* pTextField = pFormatField->GetTextField();
644 SwDrawViewSave::SwDrawViewSave(
SdrView* pSdrView )
646 , bPrintControls(true)
650 bPrintControls = pDV->IsLayerPrintable(
"Controls" );
654 SwDrawViewSave::~SwDrawViewSave()
658 pDV->SetLayerPrintable(
"Controls", bPrintControls );
vcl::RenderContext * GetOut() const
void EnableOutput(bool bEnable=true)
Base class of the Writer layout elements.
SAL_DLLPRIVATE void PrepareForPrint(const SwPrintData &rOptions, bool bIsPDFExport=false)
SwViewShell(SwViewShell &, vcl::Window *pWin, OutputDevice *pOut=nullptr, tools::Long nFlags=0)
CTor for further Shells on a document.
const SwPageFrame * GetPageAtPos(const Point &rPt, const Size *pSize=nullptr, bool bExtend=false) const
Point rPt: The point that should be used to find the page Size pSize: If given, we return the (first)...
SwRect & Union(const SwRect &rRect)
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
void setWidth(tools::Long nWidth)
SwPostItMode GetPrintPostIts() const
size_type count(const Value &v) const
IDocumentDeviceAccess const & getIDocumentDeviceAccess() const
std::unique_ptr< SwViewShell > m_pPostItShell
this contains a SwDoc with the post-it content
void Left(const tools::Long nLeft)
const SfxPoolItem * GetPoolDefaultItem(sal_uInt16 nWhich) const
const SwPosition * GetMark() const
SwQueuedPaint(SwViewShell *pNew, const SwRect &rRect)
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
const SwShellTableCursor * GetTableCursor() const
static void PrtOle2(SwDoc *pDoc, const SwViewOption *pOpt, const SwPrintData &rOptions, vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
VclPtr< OutputDevice > mpOut
Window, Printer, VirtDev, ...
VclPtr< vcl::Window > mpWin
= 0 during printing or pdf export
const Point & GetSttPos() const
const MapMode & GetMapMode() const
void IntersectClipRegion(const tools::Rectangle &rRect)
GDIMetaFile * GetConnectMetaFile() const
void Pos(const Point &rNew)
virtual void Calc(vcl::RenderContext *pRenderContext) const
Of course Writer needs its own rectangles.
SwShellCursor * GetPrev()
#define VSHELLFLAG_SHARELAYOUT
void SetLayerPrintable(const OUString &rName, bool bPrn)
The root element of a Writer document layout.
SwTableFormat * GetFrameFormat()
bool IsAnyFieldInDoc() const
Check if the DocNodesArray contains fields.
void ReplaceStyles(const SwDoc &rSource, bool bIncludePageStyles=true)
void SetLayerVisible(const OUString &rName, bool bShow)
const OUString & GetName() const
constexpr auto convertTwipToMm100(N n)
virtual void LockExpFields()=0
SwContentNode * GetContentNode(bool bPoint=true) const
void FillPrtDoc(SwDoc &rPrtDoc, const SfxPrinter *pPrt)
void SetBufferedOutputAllowed(bool bNew)
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
void SetFirstVisPageInvalid()
virtual void PaintSwFrame(vcl::RenderContext &rRenderContext, SwRect const &, SwPrintData const *const pPrintData=nullptr) const override
rtl::Reference< SwDoc > mxDoc
The document; never 0.
const SwRect & getFrameArea() const
void CalcPagesForPrint(sal_uInt16 nMax)
void DrawNotesForPage(OutputDevice *pOutDev, sal_uInt32 nPage)
void SetLandscape(bool bNew)
constexpr sal_uInt16 POOLATTR_BEGIN(HINT_BEGIN)
void InitPrt(OutputDevice *pOutDev)
SwRect maVisArea
The modern version of VisArea.
void Action(OutputDevice *pRenderContext)
const SwTable & GetTable() const
bool m_bPrintPageBackground
virtual bool GetCharRect(SwRect &, const SwPosition &, SwCursorMoveState *=nullptr, bool bAllowFarAway=true) const
const SwRenderData & GetRenderData() const
Note: in the context where this class is used the pointers should always be valid during the lifetime...
SwPageDesc * FindPageDesc(const OUString &rName, size_t *pPos=nullptr) const
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
SwShellCursor * GetCursor_()
void ChgAllPageOrientation(Orientation eOri)
const SfxItemPool & GetAttrPool() const
constexpr TypedWhichId< SwFormatField > RES_TXTATR_FIELD(RES_TXTATR_NOEND_BEGIN)
void SetConnectMetaFile(GDIMetaFile *pMtf)
void SetBufferedOverlayAllowed(bool bNew)
void Copy(SwDoc &rClpDoc, const OUString *pNewClpText=nullptr)
Copy and Paste methods for internal clipboard.
const SwRect & VisArea() const
const SwStartNode * StartOfSectionNode() const
const SwPosition * GetPoint() const
The usage of LayAction is always the same:
const SwPageDesc & GetPageDesc(const size_t i) const
bool GetLandscape() const
const SwFrame * Lower() const
SwPageDesc * GetPageDesc()
SwContentNode * GetContentNode()
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Size GetOutputSize() const
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
SwLayoutFrame * GetUpper()
tools::Long Width() const
size_t GetPageDescCnt() const
SwPageFrame const * sw_getPage(SwRootFrame const &rLayout, sal_Int32 const nPage)
o3tl::sorted_vector< sal_Int32 > & GetValidPagesSet()
void ChgPageDesc(const OUString &rName, const SwPageDesc &)
Marks a node in the document model.
SwNodes & GetNodes()
Node is in which nodes-array/doc?
tools::Long GetHeight() const
A page of the document layout.
virtual void setPrinter(SfxPrinter *pP, bool bDeleteOld, bool bCallPrtDataChanged)=0
Set the printer at the document.
SwPostItMode
this must match the definitions in css::text::NotePrintMode
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
const SwPosition * Start() const
constexpr sal_uInt16 POOLATTR_END(RES_UNKNOWNATR_END)
IDocumentUndoRedo const & GetIDocumentUndoRedo() const
Provides access to the document undo/redo interface.
SwFrameFormat & GetMaster()
SwTextNode is a paragraph in the document model.
void CopyPageDesc(const SwPageDesc &rSrcDesc, SwPageDesc &rDstDesc, bool bCopyPoolIds=true)
Copy the complete PageDesc - beyond document and "deep"! Optionally copying of PoolFormatId, -HlpId can be prevented.
void ChgAllPageSize(Size const &rSz)
friend void SetSwVisArea(SwViewShell *pSh, const SwRect &)
static void Add(SwViewShell *pSh, const SwRect &rNew)
static SwQueuedPaint * s_pPaintQueue
static void Remove(SwViewShell const *pSh)
tools::Rectangle SVRect() const
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
vcl::Window * GetWin() const
SwShellCursor * GetNext()
void SetReschedule(bool bNew)
void Top(const tools::Long nTop)
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
tools::Long Height() const
void SetWaitAllowed(bool bNew)
void SetSize(const Size &rSize)
const Point & GetOrigin() const
constexpr TypedWhichId< SwFormatField > RES_TXTATR_INPUTFIELD(55)
SwTableNode * FindTableNode()
Search table node, in which it is.
void setHeight(tools::Long nHeight)
std::vector< sal_Int32 > & GetPagesToPrint()
used for 'normal' printing A page value of 0 as entry indicates that this page is not from the docume...
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc...
Degree100 abs(Degree100 x)
void StartAllAction()
Set up Start-/EndAction for all Shells on an as high as possible (Shell section) level.
SwTextNode & GetTextNode() const
bool PrintOrPDFExport(OutputDevice *pOutDev, SwPrintData const &rPrintData, sal_Int32 nRenderer, bool bIsPDFExport)
std::unique_ptr< SwViewOption > mpOpt
void EndAllAction(bool bVirDev=false)
SwRootFrame * GetLayout() const
void Push(PushFlags nFlags=PushFlags::ALL)
void Height(tools::Long nNew)
SAL_DLLPRIVATE sal_Int32 GetDPIY() const
SwContentNode * GoNext(SwNodeIndex *) const
sal_uInt16 mnStartAction
!= 0 if at least one Action is active.
SAL_DLLPRIVATE sal_Int32 GetDPIX() const
void SetSwVisArea(SwViewShell *pSh, const SwRect &rRect)
const SwAttrPool & GetAttrPool() const
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
bool sw_GetPostIts(const IDocumentFieldsAccess &rIDFA, SetGetExpFields *pSrtLst)
void SetPoolDefaultItem(const SfxPoolItem &)