LibreOffice Module sw (master) 1
vprint.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
21#include <hintids.hxx>
22#include <sfx2/printer.hxx>
23#include <svx/svdview.hxx>
24#include <osl/diagnose.h>
26
27#include <txtfld.hxx>
28#include <fmtfld.hxx>
29#include <fmtfsize.hxx>
30#include <rootfrm.hxx>
31#include <pagefrm.hxx>
32#include <cntfrm.hxx>
33#include <doc.hxx>
34#include <IDocumentUndoRedo.hxx>
38#include <fesh.hxx>
39#include <pam.hxx>
40#include <viewimp.hxx>
41#include <layact.hxx>
42#include <ndtxt.hxx>
43#include <viewopt.hxx>
44#include <printdata.hxx>
45#include <pagedesc.hxx>
46#include <ptqueue.hxx>
47#include <viscrs.hxx>
48#include <fmtpdsc.hxx>
49#include <PostItMgr.hxx>
50#include <vprint.hxx>
51
52using namespace ::com::sun::star;
53
56{
57public:
61
62 SwQueuedPaint( SwViewShell *pNew, const SwRect &rRect ) :
63 pNext( nullptr ),
64 pSh( pNew ),
65 aRect( rRect )
66 {}
67};
68
70
71namespace {
72
73// saves some settings from the draw view
74class SwDrawViewSave
75{
76 SdrView* pDV;
77 bool bPrintControls;
78public:
79 explicit SwDrawViewSave( SdrView* pSdrView );
80 ~SwDrawViewSave();
81};
82
83}
84
85void SwPaintQueue::Add( SwViewShell *pNew, const SwRect &rNew )
86{
88 if (nullptr != pPt)
89 {
90 while ( pPt->pSh != pNew && pPt->pNext )
91 pPt = pPt->pNext;
92 if ( pPt->pSh == pNew )
93 {
94 pPt->aRect.Union( rNew );
95 return;
96 }
97 }
98 SwQueuedPaint *pNQ = new SwQueuedPaint( pNew, rNew );
99 if ( pPt )
100 pPt->pNext = pNQ;
101 else
102 s_pPaintQueue = pNQ;
103}
104
106{
108 return;
109
111 do
112 { SwViewShell *pSh = pPt->pSh;
113 CurrShell aCurr( pSh );
114 if ( pSh->IsPreview() )
115 {
116 if ( pSh->GetWin() )
117 {
118 // for previewing, since rows/columns are known in PaintHdl (UI)
119 pSh->GetWin()->Invalidate();
120 }
121 }
122 else
123 pSh->Paint(*pSh->GetOut(), pPt->aRect.SVRect());
124 pPt = pPt->pNext;
125 } while ( pPt );
126
127 do
128 {
129 pPt = s_pPaintQueue;
131 delete pPt;
132 } while (s_pPaintQueue);
133}
134
136{
138 if (nullptr == pPt)
139 return;
140
141 SwQueuedPaint *pPrev = nullptr;
142 while ( pPt && pPt->pSh != pSh )
143 {
144 pPrev = pPt;
145 pPt = pPt->pNext;
146 }
147 if ( pPt )
148 {
149 if ( pPrev )
150 pPrev->pNext = pPt->pNext;
151 else if (pPt == s_pPaintQueue)
152 s_pPaintQueue = nullptr;
153 delete pPt;
154 }
155}
156
157void SetSwVisArea( SwViewShell *pSh, const SwRect &rRect )
158{
159 OSL_ENSURE( !pSh->GetWin(), "Print with window?" );
160 pSh->maVisArea = rRect;
161 pSh->Imp()->SetFirstVisPageInvalid();
162 Point aPt( rRect.Pos() );
163
164 // calculate an offset for the rectangle of the n-th page to
165 // move the start point of the output operation to a position
166 // such that in the output device all pages will be painted
167 // at the same position
168 aPt.setX( -aPt.X() ); aPt.setY( -aPt.Y() );
169
171
172 MapMode aMapMode( pOut->GetMapMode() );
173 aMapMode.SetOrigin( aPt );
174 pOut->SetMapMode( aMapMode );
175}
176
178{
179 // For printing we use a negative offset (exactly the offset of OutputSize).
180 // This is necessary because the origin is in the upper left corner of the
181 // physical page while the output uses OutputOffset as origin.
182 if ( pOutDev )
183 {
184 maPrtOffset = Point();
185
186 maPrtOffset += pOutDev->GetMapMode().GetOrigin();
187 MapMode aMapMode( pOutDev->GetMapMode() );
188 aMapMode.SetMapUnit( MapUnit::MapTwip );
189 pOutDev->SetMapMode( aMapMode );
190 pOutDev->SetLineColor();
191 pOutDev->SetFillColor();
192 }
193 else
194 {
195 maPrtOffset.setX(0);
196 maPrtOffset.setY(0);
197 }
198
199 if ( !mpWin )
200 mpOut = pOutDev;
201}
202
204{
205 OSL_ENSURE( mnStartAction, "missing an Action" );
206 CurrShell aCurr( this );
207
208 const size_t nAll = GetDoc()->GetPageDescCnt();
209 bool bNewOri = eOri != Orientation::Portrait;
210
211 for( size_t i = 0; i < nAll; ++ i )
212 {
213 const SwPageDesc& rOld = GetDoc()->GetPageDesc( i );
214
215 if( rOld.GetLandscape() != bNewOri )
216 {
217 SwPageDesc aNew( rOld );
218 {
220 GetDoc()->CopyPageDesc(rOld, aNew);
221 }
222 aNew.SetLandscape( bNewOri );
223 SwFrameFormat& rFormat = aNew.GetMaster();
224 SwFormatFrameSize aSz( rFormat.GetFrameSize() );
225 // adjust size
226 // PORTRAIT -> higher than wide
227 // LANDSCAPE -> wider than high
228 // Height is the VarSize, width the FixSize (per Def.)
229 if( bNewOri ? aSz.GetHeight() > aSz.GetWidth()
230 : aSz.GetHeight() < aSz.GetWidth() )
231 {
232 SwTwips aTmp = aSz.GetHeight();
233 aSz.SetHeight( aSz.GetWidth() );
234 aSz.SetWidth( aTmp );
235 rFormat.SetFormatAttr( aSz );
236 }
237 GetDoc()->ChgPageDesc( i, aNew );
238 }
239 }
240}
241
243{
244 OSL_ENSURE( mnStartAction, "missing an Action" );
245 CurrShell aCurr( this );
246
247 SwDoc* pMyDoc = GetDoc();
248 const size_t nAll = pMyDoc->GetPageDescCnt();
249
250 for( size_t i = 0; i < nAll; ++i )
251 {
252 const SwPageDesc &rOld = pMyDoc->GetPageDesc( i );
253 SwPageDesc aNew( rOld );
254 {
256 GetDoc()->CopyPageDesc( rOld, aNew );
257 }
258 SwFrameFormat& rPgFormat = aNew.GetMaster();
259 Size aSz( rSz );
260 const bool bOri = aNew.GetLandscape();
261 if( bOri ? aSz.Height() > aSz.Width()
262 : aSz.Height() < aSz.Width() )
263 {
264 SwTwips aTmp = aSz.Height();
265 aSz.setHeight( aSz.Width() );
266 aSz.setWidth( aTmp );
267 }
268
269 SwFormatFrameSize aFrameSz( rPgFormat.GetFrameSize() );
270 aFrameSz.SetSize( aSz );
271 rPgFormat.SetFormatAttr( aFrameSz );
272 pMyDoc->ChgPageDesc( i, aNew );
273 }
274}
275
276void SwViewShell::CalcPagesForPrint( sal_uInt16 nMax )
277{
278 CurrShell aCurr( this );
279
280 SwRootFrame* pMyLayout = GetLayout();
281
282 const SwFrame *pPage = pMyLayout->Lower();
283 SwLayAction aAction( pMyLayout, Imp() );
284
285 pMyLayout->StartAllAction();
286 for ( sal_uInt16 i = 1; pPage && i <= nMax; pPage = pPage->GetNext(), ++i )
287 {
288 pPage->Calc(GetOut());
289 SwRect aOldVis( VisArea() );
290 maVisArea = pPage->getFrameArea();
292 aAction.Reset();
293 aAction.SetPaint( false );
294 aAction.SetWaitAllowed( false );
295 aAction.SetReschedule( true );
296
297 aAction.Action(GetOut());
298
299 maVisArea = aOldVis; //reset due to the paints
301 }
302
303 pMyLayout->EndAllAction();
304}
305
306void SwViewShell::FillPrtDoc( SwDoc& rPrtDoc, const SfxPrinter* pPrt)
307{
308 assert( dynamic_cast<const SwFEShell*>( this) && "SwViewShell::Prt for FEShell only");
309 SwFEShell* pFESh = static_cast<SwFEShell*>(this);
311
312 // use given printer
315 if (pPrt)
316 rPrtDoc.getIDocumentDeviceAccess().setPrinter( VclPtr<SfxPrinter>::Create(*pPrt), true, true );
317
318 const SfxItemPool& rPool = GetAttrPool();
319 for( sal_uInt16 nWh = POOLATTR_BEGIN; nWh < POOLATTR_END; ++nWh )
320 {
321 const SfxPoolItem* pCpyItem = rPool.GetPoolDefaultItem( nWh );
322 if( nullptr != pCpyItem )
323 rPrtDoc.GetAttrPool().SetPoolDefaultItem( *pCpyItem );
324 }
325
326 // JP 29.07.99 - Bug 67951 - set all Styles from the SourceDoc into
327 // the PrintDoc - will be replaced!
328 rPrtDoc.ReplaceStyles( *GetDoc() );
329
330 SwShellCursor *pActCursor = pFESh->GetCursor_();
331 SwShellCursor *pFirstCursor = pActCursor->GetNext();
332 if( !pActCursor->HasMark() ) // with a multi-selection the current cursor might be empty
333 {
334 pActCursor = pActCursor->GetPrev();
335 }
336
337 // Y-position of the first selection
338 Point aSelPoint;
339 if( pFESh->IsTableMode() )
340 {
341 SwShellTableCursor* pShellTableCursor = pFESh->GetTableCursor();
342
343 const SwContentNode *const pContentNode =
344 pShellTableCursor->Start()->GetNode().GetContentNode();
345 const SwContentFrame *const pContentFrame = pContentNode ? pContentNode->getLayoutFrame(GetLayout(), pShellTableCursor->Start()) : nullptr;
346 if( pContentFrame )
347 {
348 SwRect aCharRect;
350 pContentFrame->GetCharRect( aCharRect, *pShellTableCursor->Start(), &aTmpState );
351 aSelPoint = Point( aCharRect.Left(), aCharRect.Top() );
352 }
353 }
354 else if (pFirstCursor)
355 {
356 aSelPoint = pFirstCursor->GetSttPos();
357 }
358
359 const SwPageFrame* pPage = GetLayout()->GetPageAtPos( aSelPoint );
360 OSL_ENSURE( pPage, "no page found!" );
361
362 // get page descriptor - fall back to the first one if pPage could not be found
363 const SwPageDesc* pPageDesc = pPage ? rPrtDoc.FindPageDesc(
364 pPage->GetPageDesc()->GetName() ) : &rPrtDoc.GetPageDesc( 0 );
365
366 if( !pFESh->IsTableMode() && pActCursor && pActCursor->HasMark() )
367 { // Tweak paragraph attributes of last paragraph
368 SwNodeIndex aNodeIdx( *rPrtDoc.GetNodes().GetEndOfContent().StartOfSectionNode() );
369 SwTextNode* pTextNd = rPrtDoc.GetNodes().GoNext( &aNodeIdx )->GetTextNode();
370 SwContentNode *pLastNd =
371 (*pActCursor->GetMark()) <= (*pActCursor->GetPoint())
372 ? pActCursor->GetPointContentNode()
373 : pActCursor->GetMarkContentNode();
374 // copy the paragraph attributes of the first paragraph
375 if( pLastNd && pLastNd->IsTextNode() )
376 static_cast<SwTextNode*>(pLastNd)->CopyCollFormat( *pTextNd );
377 }
378
379 // fill it with the selected content
380 pFESh->Copy(rPrtDoc);
381
382 // set the page style at the first paragraph
383 {
384 SwNodeIndex aNodeIdx( *rPrtDoc.GetNodes().GetEndOfContent().StartOfSectionNode() );
385 SwContentNode* pCNd = rPrtDoc.GetNodes().GoNext( &aNodeIdx ); // go to 1st ContentNode
386 if( pFESh->IsTableMode() )
387 {
388 SwTableNode* pTNd = pCNd->FindTableNode();
389 if( pTNd )
390 pTNd->GetTable().GetFrameFormat()->SetFormatAttr( SwFormatPageDesc( pPageDesc ) );
391 }
392 else
393 {
394 pCNd->SetAttr( SwFormatPageDesc( pPageDesc ) );
395 if( pFirstCursor && pFirstCursor->HasMark() )
396 {
397 SwTextNode *pTextNd = pCNd->GetTextNode();
398 if( pTextNd )
399 {
400 SwContentNode *pFirstNd =
401 (*pFirstCursor->GetMark()) > (*pFirstCursor->GetPoint())
402 ? pFirstCursor->GetPointContentNode()
403 : pFirstCursor->GetMarkContentNode();
404 // copy paragraph attributes of the first paragraph
405 if( pFirstNd && pFirstNd->IsTextNode() )
406 static_cast<SwTextNode*>(pFirstNd)->CopyCollFormat( *pTextNd );
407 }
408 }
409 }
410 }
411}
412
413// TODO: there is already a GetPageByPageNum, but it checks some physical page
414// number; unsure if we want that here, should find out what that is...
415SwPageFrame const*
416sw_getPage(SwRootFrame const& rLayout, sal_Int32 const nPage)
417{
418 // yes this is O(n^2) but at least it does not crash...
419 SwPageFrame const* pPage = dynamic_cast<const SwPageFrame*>(rLayout.Lower());
420 for (sal_Int32 i = nPage; pPage && (i > 0); --i)
421 {
422 if (1 == i) { // note: nPage is 1-based, i.e. 0 is invalid!
423 return pPage;
424 }
425 pPage = dynamic_cast<SwPageFrame const*>(pPage->GetNext());
426 }
427 OSL_ENSURE(pPage, "ERROR: SwPageFrame expected");
428 OSL_FAIL("non-existent page requested");
429 return nullptr;
430}
431
432namespace sw
433{
434 // tdf#91680 Reserve space in margin for comments only if there are comments
435 bool IsShrinkPageForPostIts(SwViewShell const& rShell, SwPrintData const& rPrintData)
436 {
437 SwPostItMode const nPostItMode(rPrintData.GetPrintPostIts());
438 return nPostItMode == SwPostItMode::InMargins
439 && sw_GetPostIts(rShell.GetDoc()->getIDocumentFieldsAccess(), nullptr);
440 }
441}
442
444 OutputDevice *pOutDev,
445 SwPrintData const& rPrintData,
446 sal_Int32 nRenderer, /* the index in the vector of pages to be printed */
447 bool bIsPDFExport )
448{
449 // CAUTION: Do also always update the printing routines in viewpg.cxx (PrintProspect)!
450
451 const sal_Int32 nMaxRenderer = rPrintData.GetRenderData().GetPagesToPrint().size() - 1;
452 OSL_ENSURE( 0 <= nRenderer && nRenderer <= nMaxRenderer, "nRenderer out of bounds");
453 if (!pOutDev || nMaxRenderer < 0 || nRenderer < 0 || nRenderer > nMaxRenderer)
454 return false;
455
456 // save settings of OutputDevice (should be done always since the
457 // output device is now provided by a call from outside the Writer)
458 pOutDev->Push();
459
460
461 const bool bHasPostItsToPrintInMargins(::sw::IsShrinkPageForPostIts(*this, rPrintData));
462 ::std::optional<tools::Long> oOrigHeight;
463
464 // Print/PDF export for (multi-)selection has already generated a
465 // temporary document with the selected text.
466 // (see XRenderable implementation in unotxdoc.cxx)
467 // It is implemented this way because PDF export calls this Prt function
468 // once per page and we do not like to always have the temporary document
469 // to be created that often here.
470 std::unique_ptr<SwViewShell> pShell(new SwViewShell(*this, nullptr, pOutDev));
471
472 SdrView *pDrawView = pShell->GetDrawView();
473 if (pDrawView)
474 {
475 pDrawView->SetBufferedOutputAllowed( false );
476 pDrawView->SetBufferedOverlayAllowed( false );
477 }
478
479 { // additional scope so that the CurrShell is reset before destroying the shell
480
481 CurrShell aCurr( pShell.get() );
482
483 //JP 01.02.99: Bug 61335 - the ReadOnly flag is never copied
484 if( mpOpt->IsReadonly() )
485 pShell->mpOpt->SetReadonly( true );
486
487 // save options at draw view:
488 SwDrawViewSave aDrawViewSave( pShell->GetDrawView() );
489 pShell->PrepareForPrint( rPrintData, bIsPDFExport );
490
491 const sal_Int32 nPage = rPrintData.GetRenderData().GetPagesToPrint()[ nRenderer ];
492 OSL_ENSURE( nPage < 0 ||
493 rPrintData.GetRenderData().GetValidPagesSet().count( nPage ) == 1,
494 "SwViewShell::PrintOrPDFExport: nPage not valid" );
495 SwViewShell *const pViewSh2 = (nPage < 0)
496 ? rPrintData.GetRenderData().m_pPostItShell.get()// post-it page
497 : pShell.get(); // a 'regular' page, not one from the post-it doc
498
499 SwPageFrame const*const pStPage =
500 sw_getPage(*pViewSh2->GetLayout(), abs(nPage));
501 OSL_ENSURE( pStPage, "failed to get start page" );
502 if (!pStPage)
503 {
504 return false;
505 }
506
508
509 ::SetSwVisArea( pViewSh2, pStPage->getFrameArea() );
510
511 pShell->InitPrt(pOutDev);
512
513 ::SetSwVisArea( pViewSh2, pStPage->getFrameArea() );
514
515 pStPage->GetUpper()->PaintSwFrame( *pOutDev, pStPage->getFrameArea(), &rPrintData );
516
518
519 SwPostItMgr *pPostItManager = bHasPostItsToPrintInMargins ? pShell->GetPostItMgr() : nullptr;
520
521 if (pPostItManager)
522 {
523 pPostItManager->CalcRects();
524 pPostItManager->LayoutPostIts();
525 pPostItManager->DrawNotesForPage(pOutDev, nPage-1);
526 oOrigHeight.emplace(pStPage->getFrameArea().Height());
527 }
528 }
529
530 pShell.reset();
531
532 // restore settings of OutputDevice (should be done always now since the
533 // output device is now provided by a call from outside the Writer)
534 pOutDev->Pop();
535
536 // avoid a warning about unbalanced Push/Pop by doing this last:
537 if (oOrigHeight)
538 {
539 // fdo#36815 Now scale the recorded page down so the comments in
540 // margins will fit in the final page
541 double fScale = 0.75;
542 tools::Long nNewHeight = *oOrigHeight*fScale;
543 tools::Long nShiftY = (*oOrigHeight-nNewHeight)/2;
544 GDIMetaFile *const pMetaFile = pOutDev->GetConnectMetaFile();
545 pMetaFile->ScaleActions(fScale, fScale);
546 //Move the scaled page down to center it
547 //the other variant of Move does not map pixels
548 //back to the logical units correctly
549 pMetaFile->Move(0, convertTwipToMm100(nShiftY), pOutDev->GetDPIX(), pOutDev->GetDPIY());
550 }
551
552 return true;
553}
554
555void SwViewShell::PrtOle2( SwDoc *pDoc, const SwViewOption *pOpt, const SwPrintData& rOptions,
556 vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect,
557 bool bOutputForScreen )
558{
559 // For printing a shell is needed. Either the Doc already has one, then we
560 // create a new view, or it has none, then we create the first view.
561 std::unique_ptr<SwViewShell> pSh;
563 pSh.reset(new SwViewShell( *pDoc->getIDocumentLayoutAccess().GetCurrentViewShell(), nullptr, &rRenderContext,VSHELLFLAG_SHARELAYOUT ));
564 else
565 pSh.reset(new SwViewShell( *pDoc, nullptr, pOpt, &rRenderContext));
566
567 pSh->setOutputToWindow(bOutputForScreen);
568
569 {
570 CurrShell aCurr( pSh.get() );
571 pSh->PrepareForPrint( rOptions );
572 pSh->SetPrtFormatOption( true );
573
574 SwRect aSwRect( rRect );
575 pSh->maVisArea = aSwRect;
576
577 if ( pSh->GetViewOptions()->getBrowseMode() &&
578 pSh->GetRingContainer().size() == 1 )
579 {
580 pSh->InvalidateLayout( false );
581 pSh->GetLayout()->Lower()->InvalidateSize();
582 }
583
584 // CalcPagesForPrint() should not be necessary here. The pages in the
585 // visible area will be formatted in SwRootFrame::PaintSwFrame().
586 // Removing this gives us a performance gain during saving the
587 // document because the thumbnail creation will not trigger a complete
588 // formatting of the document.
589
590 rRenderContext.Push( vcl::PushFlags::CLIPREGION );
591 rRenderContext.IntersectClipRegion( aSwRect.SVRect() );
592 pSh->GetLayout()->PaintSwFrame( rRenderContext, aSwRect );
593
594 rRenderContext.Pop();
595 // first the CurrShell object needs to be destroyed!
596 }
597}
598
601{
602 for (const SfxPoolItem* pItem : mxDoc->GetAttrPool().GetItemSurrogates(RES_TXTATR_FIELD))
603 {
604 auto pFormatField = dynamic_cast<const SwFormatField*>(pItem);
605 if(pFormatField)
606 {
607 const SwTextField* pTextField = pFormatField->GetTextField();
608 if( pTextField && pTextField->GetTextNode().GetNodes().IsDocNodes() )
609 {
610 return true;
611 }
612 }
613 }
614
615 for (const SfxPoolItem* pItem : mxDoc->GetAttrPool().GetItemSurrogates(RES_TXTATR_INPUTFIELD))
616 {
617 const SwFormatField* pFormatField = dynamic_cast<const SwFormatField*>(pItem);
618 if(pFormatField)
619 {
620 const SwTextField* pTextField = pFormatField->GetTextField();
621 if( pTextField && pTextField->GetTextNode().GetNodes().IsDocNodes() )
622 {
623 return true;
624 }
625 }
626 }
627
628 return false;
629}
630
632SwDrawViewSave::SwDrawViewSave( SdrView* pSdrView )
633 : pDV( pSdrView )
634 , bPrintControls(true)
635{
636 if ( pDV )
637 {
638 bPrintControls = pDV->IsLayerPrintable( "Controls" );
639 }
640}
641
642SwDrawViewSave::~SwDrawViewSave()
643{
644 if ( pDV )
645 {
646 pDV->SetLayerPrintable( "Controls", bPrintControls );
647 }
648}
649
650// OD 09.01.2003 #i6467# - method also called for page preview
651void SwViewShell::PrepareForPrint( const SwPrintData &rOptions, bool bIsPDFExport )
652 {
653 mpOpt->SetGraphic ( rOptions.m_bPrintGraphic );
654 mpOpt->SetTable ( rOptions.m_bPrintTable );
655 mpOpt->SetDraw ( rOptions.m_bPrintDraw );
656 mpOpt->SetControl ( rOptions.m_bPrintControl );
657 mpOpt->SetPageBack ( rOptions.m_bPrintPageBackground );
658 // Font should not be black if it's a PDF Export
659 mpOpt->SetBlackFont( rOptions.m_bPrintBlackFont && !bIsPDFExport );
660
661 if ( !HasDrawView() )
662 return;
663
664 SdrView *pDrawView = GetDrawView();
665 // OD 09.01.2003 #i6467# - consider, if view shell belongs to page preview
666 if ( !IsPreview() )
667 {
668 pDrawView->SetLayerPrintable( "Controls", rOptions.m_bPrintControl );
669 }
670 else
671 {
672 pDrawView->SetLayerVisible( "Controls", rOptions.m_bPrintControl );
673 }
674}
675
676/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr auto convertTwipToMm100(N n)
void Move(tools::Long nX, tools::Long nY)
void ScaleActions(double fScaleX, double fScaleY)
virtual void setPrinter(SfxPrinter *pP, bool bDeleteOld, bool bCallPrtDataChanged)=0
Set the printer at the document.
virtual void LockExpFields()=0
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
void SetOrigin(const Point &rOrigin)
void SetMapUnit(MapUnit eUnit)
const Point & GetOrigin() const
SAL_DLLPRIVATE sal_Int32 GetDPIX() const
GDIMetaFile * GetConnectMetaFile() const
SAL_DLLPRIVATE sal_Int32 GetDPIY() const
void SetLineColor()
void SetMapMode()
void SetFillColor()
const MapMode & GetMapMode() const
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
void IntersectClipRegion(const tools::Rectangle &rRect)
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
constexpr tools::Long X() const
void SetBufferedOverlayAllowed(bool bNew)
void SetLayerPrintable(const OUString &rName, bool bPrn)
void SetBufferedOutputAllowed(bool bNew)
void SetLayerVisible(const OUString &rName, bool bShow)
const SfxPoolItem * GetPoolDefaultItem(sal_uInt16 nWhich) const
void SetPoolDefaultItem(const SfxPoolItem &)
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
tools::Long GetHeight() const
tools::Long GetWidth() const
void SetHeight(tools::Long n)
void SetSize(const Size &rSize)
void SetWidth(tools::Long n)
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
Definition: cntfrm.hxx:59
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1223
virtual bool SetAttr(const SfxPoolItem &)
made virtual
Definition: node.cxx:1586
SwShellCursor * GetCursor_()
Definition: crsrsh.hxx:343
const SwShellTableCursor * GetTableCursor() const
Definition: crsrsh.hxx:670
bool IsTableMode() const
Definition: crsrsh.hxx:668
Definition: doc.hxx:197
void CopyPageDesc(const SwPageDesc &rSrcDesc, SwPageDesc &rDstDesc, bool bCopyPoolIds=true)
Copy the complete PageDesc - beyond document and "deep"! Optionally copying of PoolFormatId,...
Definition: docfmt.cxx:1436
SwPageDesc * FindPageDesc(const OUString &rName, size_t *pPos=nullptr) const
Definition: docdesc.cxx:947
IDocumentDeviceAccess const & getIDocumentDeviceAccess() const
Definition: doc.cxx:252
size_t GetPageDescCnt() const
Definition: doc.hxx:895
SwNodes & GetNodes()
Definition: doc.hxx:422
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:371
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:419
void ChgPageDesc(const OUString &rName, const SwPageDesc &)
Definition: docdesc.cxx:978
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1337
void ReplaceStyles(const SwDoc &rSource, bool bIncludePageStyles=true)
Definition: docfmt.cxx:1568
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:896
void Copy(SwDoc &rClpDoc, const OUString *pNewClpText=nullptr)
Copy and Paste methods for internal clipboard.
Definition: fecopy.cxx:77
const SwTextField * GetTextField() const
Definition: fmtfld.hxx:149
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Definition: fmtpdsc.hxx:36
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:447
const SwRect & getFrameArea() const
Definition: frame.hxx:179
Style of a layout element.
Definition: frmfmt.hxx:72
Base class of the Writer layout elements.
Definition: frame.hxx:315
SwFrame * GetNext()
Definition: frame.hxx:682
virtual void Calc(vcl::RenderContext *pRenderContext) const
Definition: trvlfrm.cxx:1799
SwLayoutFrame * GetUpper()
Definition: frame.hxx:684
virtual bool GetCharRect(SwRect &, const SwPosition &, SwCursorMoveState *=nullptr, bool bAllowFarAway=true) const
Definition: unusedf.cxx:72
The usage of LayAction is always the same:
Definition: layact.hxx:59
void Reset()
Definition: layact.cxx:276
void Action(OutputDevice *pRenderContext)
Definition: layact.cxx:363
void SetReschedule(bool bNew)
Definition: layact.hxx:158
void SetWaitAllowed(bool bNew)
Definition: layact.hxx:159
void SetPaint(bool bNew)
Definition: layact.hxx:153
virtual void PaintSwFrame(vcl::RenderContext &rRenderContext, SwRect const &, SwPrintData const *const pPrintData=nullptr) const override
Definition: paintfrm.cxx:3511
const SwFrame * Lower() const
Definition: layfrm.hxx:101
Marks a node in the document model.
Definition: ndindex.hxx:31
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:901
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:706
bool IsTextNode() const
Definition: node.hxx:190
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:380
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:153
SwContentNode * GetContentNode()
Definition: node.hxx:666
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:165
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc....
Definition: nodes.cxx:2555
SwContentNode * GoNext(SwNodeIndex *) const
Definition: nodes.cxx:1299
const SwPosition * GetMark() const
Definition: pam.hxx:255
SwContentNode * GetPointContentNode() const
Definition: pam.hxx:279
SwContentNode * GetMarkContentNode() const
Definition: pam.hxx:280
const SwPosition * GetPoint() const
Definition: pam.hxx:253
const SwPosition * Start() const
Definition: pam.hxx:258
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:251
const OUString & GetName() const
Definition: pagedesc.hxx:196
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:238
bool GetLandscape() const
Definition: pagedesc.hxx:199
void SetLandscape(bool bNew)
Definition: pagedesc.hxx:200
A page of the document layout.
Definition: pagefrm.hxx:60
SwPageDesc * GetPageDesc()
Definition: pagefrm.hxx:147
static void Remove(SwViewShell const *pSh)
Definition: vprint.cxx:135
static void Repaint()
Definition: vprint.cxx:105
static void Add(SwViewShell *pSh, const SwRect &rNew)
Definition: vprint.cxx:85
static SwQueuedPaint * s_pPaintQueue
Definition: ptqueue.hxx:48
void LayoutPostIts()
Definition: PostItMgr.cxx:696
bool CalcRects()
Definition: PostItMgr.cxx:541
void DrawNotesForPage(OutputDevice *pOutDev, sal_uInt32 nPage)
Definition: PostItMgr.cxx:968
SwPostItMode GetPrintPostIts() const
Definition: printdata.hxx:145
bool m_bPrintControl
Definition: printdata.hxx:58
bool m_bPrintTable
Definition: printdata.hxx:58
bool m_bPrintBlackFont
Definition: printdata.hxx:59
bool m_bPrintPageBackground
Definition: printdata.hxx:58
bool m_bPrintDraw
Definition: printdata.hxx:58
bool m_bPrintGraphic
Definition: printdata.hxx:58
const SwRenderData & GetRenderData() const
Note: in the context where this class is used the pointers should always be valid during the lifetime...
Definition: printdata.hxx:128
Painting buffer.
Definition: vprint.cxx:56
SwRect aRect
Definition: vprint.cxx:60
SwQueuedPaint(SwViewShell *pNew, const SwRect &rRect)
Definition: vprint.cxx:62
SwQueuedPaint * pNext
Definition: vprint.cxx:58
SwViewShell * pSh
Definition: vprint.cxx:59
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
void Height(tools::Long nNew)
Definition: swrect.hxx:193
SwRect & Union(const SwRect &rRect)
Definition: swrect.cxx:35
void Top(const tools::Long nTop)
Definition: swrect.hxx:206
void Pos(const Point &rNew)
Definition: swrect.hxx:171
tools::Rectangle SVRect() const
Definition: swrect.hxx:292
void Left(const tools::Long nLeft)
Definition: swrect.hxx:197
std::unique_ptr< SwViewShell > m_pPostItShell
this contains a SwDoc with the post-it content
Definition: printdata.hxx:238
o3tl::sorted_vector< sal_Int32 > & GetValidPagesSet()
Definition: printdata.hxx:265
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...
Definition: printdata.hxx:276
The root element of a Writer document layout.
Definition: rootfrm.hxx:85
void StartAllAction()
Set up Start-/EndAction for all Shells on an as high as possible (Shell section) level.
Definition: pagechg.cxx:1920
static bool IsInPaint()
Definition: rootfrm.hxx:374
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)...
Definition: findfrm.cxx:658
void EndAllAction()
Definition: pagechg.cxx:1932
Represents the current text cursor of one opened edit window.
Definition: viscrs.hxx:140
const Point & GetSttPos() const
Definition: viscrs.hxx:169
SwShellCursor * GetNext()
Definition: viscrs.hxx:188
SwShellCursor * GetPrev()
Definition: viscrs.hxx:190
const SwTable & GetTable() const
Definition: node.hxx:542
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:209
SwTextNode & GetTextNode() const
Definition: txtfld.hxx:53
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
void CopyCollFormat(SwTextNode &rDestNd, bool bUndoForChgFormatColl=true)
Copy collection with all auto formats to dest-node.
Definition: ndcopy.cxx:339
void SetFirstVisPageInvalid()
Definition: viewimp.hxx:149
static void PrtOle2(SwDoc *pDoc, const SwViewOption *pOpt, const SwPrintData &rOptions, vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect, bool bOutputForScreen)
Definition: vprint.cxx:555
vcl::RenderContext * GetOut() const
Definition: viewsh.hxx:365
VclPtr< vcl::Window > mpWin
= 0 during printing or pdf export
Definition: viewsh.hxx:141
bool IsPreview() const
Definition: viewsh.hxx:517
friend void SetSwVisArea(SwViewShell *pSh, const SwRect &)
Definition: vprint.cxx:157
bool HasDrawView() const
Definition: vnew.cxx:371
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
Definition: viewsh.cxx:1851
VclPtr< OutputDevice > mpOut
Window, Printer, VirtDev, ...
Definition: viewsh.hxx:142
void ChgAllPageOrientation(Orientation eOri)
Definition: vprint.cxx:203
rtl::Reference< SwDoc > mxDoc
The document; never 0.
Definition: viewsh.hxx:199
SwViewShell(SwViewShell &, vcl::Window *pWin, OutputDevice *pOut=nullptr, tools::Long nFlags=0)
CTor for further Shells on a document.
Definition: vnew.cxx:213
SwViewShellImp * Imp()
Definition: viewsh.hxx:211
bool IsAnyFieldInDoc() const
Check if the DocNodesArray contains fields.
Definition: vprint.cxx:600
std::unique_ptr< SwViewOption > mpOpt
Definition: viewsh.hxx:144
Point maPrtOffset
Definition: viewsh.hxx:131
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2163
SwRect maVisArea
The modern version of VisArea.
Definition: viewsh.hxx:197
vcl::Window * GetWin() const
Definition: viewsh.hxx:364
const SwRect & VisArea() const
Definition: viewsh.cxx:642
IDocumentUndoRedo const & GetIDocumentUndoRedo() const
Provides access to the document undo/redo interface.
Definition: viewsh.cxx:2835
void ChgAllPageSize(Size const &rSz)
Definition: vprint.cxx:242
void FillPrtDoc(SwDoc &rPrtDoc, const SfxPrinter *pPrt)
Definition: vprint.cxx:306
sal_uInt16 mnStartAction
!= 0 if at least one Action is active.
Definition: viewsh.hxx:201
SwDoc * GetDoc() const
Definition: viewsh.hxx:308
bool PrintOrPDFExport(OutputDevice *pOutDev, SwPrintData const &rPrintData, sal_Int32 nRenderer, bool bIsPDFExport)
Definition: vprint.cxx:443
SAL_DLLPRIVATE void PrepareForPrint(const SwPrintData &rOptions, bool bIsPDFExport=false)
Definition: vprint.cxx:651
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:648
void InitPrt(OutputDevice *pOutDev)
Definition: vprint.cxx:177
SdrView * GetDrawView()
Definition: vnew.cxx:386
void CalcPagesForPrint(sal_uInt16 nMax)
Definition: vprint.cxx:276
size_type count(const Value &v) const
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
bool sw_GetPostIts(const IDocumentFieldsAccess &rIDFA, SetGetExpFields *pSrtLst)
Definition: doc.cxx:529
constexpr sal_uInt16 POOLATTR_BEGIN(HINT_BEGIN)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_FIELD(RES_TXTATR_NOEND_BEGIN)
constexpr TypedWhichId< SwFormatField > RES_TXTATR_INPUTFIELD(55)
constexpr sal_uInt16 POOLATTR_END(RES_UNKNOWNATR_END)
int i
Dialog to specify the properties of date form field.
bool IsShrinkPageForPostIts(SwViewShell const &rShell, SwPrintData const &)
Definition: vprint.cxx:435
long Long
SwNodeOffset abs(const SwNodeOffset &a)
Definition: nodeoffset.hxx:34
SwPostItMode
this must match the definitions in css::text::NotePrintMode
Definition: printdata.hxx:43
Orientation
SwNode & GetNode() const
Definition: pam.hxx:81
tools::Long SwTwips
Definition: swtypes.hxx:51
#define VSHELLFLAG_SHARELAYOUT
Definition: viewsh.hxx:96
void SetSwVisArea(SwViewShell *pSh, const SwRect &rRect)
Definition: vprint.cxx:157
SwPageFrame const * sw_getPage(SwRootFrame const &rLayout, sal_Int32 const nPage)
Definition: vprint.cxx:416
oslFileHandle & pOut