1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/**************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/view/XRenderable.hpp>
#include <hintids.hxx>
#include <rtl/ustring.hxx>
#include <sfx2/app.hxx>
#include <sfx2/objsh.hxx>
#include <sfx2/prnmon.hxx>
#include <svl/languageoptions.hxx>
#include <editeng/paperinf.hxx>
#include <editeng/pbinitem.hxx>
#include <svx/svdview.hxx>
#include <toolkit/awt/vclxdevice.hxx>
#include <unotools/localedatawrapper.hxx>
#include <unotools/moduleoptions.hxx>
#include <unotools/syslocale.hxx>
#include <vcl/oldprintadaptor.hxx>
#include <unotxdoc.hxx>
#include <docsh.hxx>
#include <txtfld.hxx>
#include <fmtfld.hxx>
#include <fmtfsize.hxx>
#include <frmatr.hxx>
#include <rootfrm.hxx>
#include <pagefrm.hxx>
#include <cntfrm.hxx>
#include <doc.hxx>
#include <IDocumentUndoRedo.hxx>
#include <wdocsh.hxx>
#include <fesh.hxx>
#include <pam.hxx>
#include <viewimp.hxx> // Imp->SetFirstVisPageInvalid()
#include <layact.hxx>
#include <ndtxt.hxx>
#include <fldbas.hxx>
#include <docfld.hxx> // _SetGetExpFld
#include <docufld.hxx> // PostItFld /-Type
#include <shellres.hxx>
#include <viewopt.hxx>
#include <printdata.hxx> // SwPrintData
#include <pagedesc.hxx>
#include <poolfmt.hxx>
#include <mdiexp.hxx>
#include <statstr.hrc>
#include <ptqueue.hxx>
#include <tabfrm.hxx>
#include <txtfrm.hxx> // MinPrtLine
#include <viscrs.hxx> // SwShellCrsr
#include <fmtpdsc.hxx> // SwFmtPageDesc
#include <globals.hrc>
using namespace ::com::sun::star;
class SwQueuedPaint
{
public:
SwQueuedPaint *pNext;
ViewShell *pSh;
SwRect aRect;
SwQueuedPaint( ViewShell *pNew, const SwRect &rRect ) :
pNext( 0 ),
pSh( pNew ),
aRect( rRect )
{}
};
SwQueuedPaint *SwPaintQueue::pQueue = 0;
// saves some settings from the draw view
class SwDrawViewSave
{
String sLayerNm;
SdrView* pDV;
sal_Bool bPrintControls;
public:
SwDrawViewSave( SdrView* pSdrView );
~SwDrawViewSave();
};
void SwPaintQueue::Add( ViewShell *pNew, const SwRect &rNew )
{
SwQueuedPaint *pPt;
if ( 0 != (pPt = pQueue) )
{
while ( pPt->pSh != pNew && pPt->pNext )
pPt = pPt->pNext;
if ( pPt->pSh == pNew )
{
pPt->aRect.Union( rNew );
return;
}
}
SwQueuedPaint *pNQ = new SwQueuedPaint( pNew, rNew );
if ( pPt )
pPt->pNext = pNQ;
else
pQueue = pNQ;
}
void SwPaintQueue::Repaint()
{
if ( !SwRootFrm::IsInPaint() && pQueue )
{
SwQueuedPaint *pPt = pQueue;
do
{ ViewShell *pSh = pPt->pSh;
SET_CURR_SHELL( pSh );
if ( pSh->IsPreView() )
{
if ( pSh->GetWin() )
{
//Fuer PreView aussenherum, weil im PaintHdl (UI) die
//Zeilen/Spalten bekannt sind.
pSh->GetWin()->Invalidate();
pSh->GetWin()->Update();
}
}
else
pSh->Paint( pPt->aRect.SVRect() );
pPt = pPt->pNext;
} while ( pPt );
do
{ pPt = pQueue;
pQueue = pQueue->pNext;
delete pPt;
} while ( pQueue );
}
}
void SwPaintQueue::Remove( ViewShell *pSh )
{
SwQueuedPaint *pPt;
if ( 0 != (pPt = pQueue) )
{
SwQueuedPaint *pPrev = 0;
while ( pPt && pPt->pSh != pSh )
{
pPrev = pPt;
pPt = pPt->pNext;
}
if ( pPt )
{
if ( pPrev )
pPrev->pNext = pPt->pNext;
else if ( pPt == pQueue )
pQueue = 0;
delete pPt;
}
}
}
void SetSwVisArea( ViewShell *pSh, const SwRect &rRect, sal_Bool /*bPDFExport*/ )
{
OSL_ENSURE( !pSh->GetWin(), "Drucken mit Window?" );
pSh->aVisArea = rRect;
pSh->Imp()->SetFirstVisPageInvalid();
Point aPt( rRect.Pos() );
// calculate an offset for the rectangle of the n-th page to
// move the start point of the output operation to a position
// such that in the output device all pages will be painted
// at the same position
aPt.X() = -aPt.X(); aPt.Y() = -aPt.Y();
OutputDevice *pOut = pSh->GetOut();
MapMode aMapMode( pOut->GetMapMode() );
aMapMode.SetOrigin( aPt );
pOut->SetMapMode( aMapMode );
}
/******************************************************************************/
void ViewShell::InitPrt( OutputDevice *pOutDev )
{
//Fuer den Printer merken wir uns einen negativen Offset, der
//genau dem Offset de OutputSize entspricht. Das ist notwendig,
//weil unser Ursprung der linken ober Ecke der physikalischen
//Seite ist, die Ausgaben (SV) aber den Outputoffset als Urstprung
//betrachten.
if ( pOutDev )
{
aPrtOffst = Point();
aPrtOffst += pOutDev->GetMapMode().GetOrigin();
MapMode aMapMode( pOutDev->GetMapMode() );
aMapMode.SetMapUnit( MAP_TWIP );
pOutDev->SetMapMode( aMapMode );
pOutDev->SetLineColor();
pOutDev->SetFillColor();
}
else
aPrtOffst.X() = aPrtOffst.Y() = 0;
if ( !pWin )
pOut = pOutDev; //Oder was sonst?
}
void ViewShell::ChgAllPageOrientation( sal_uInt16 eOri )
{
OSL_ENSURE( nStartAction, "missing an Action" );
SET_CURR_SHELL( this );
sal_uInt16 nAll = GetDoc()->GetPageDescCnt();
sal_Bool bNewOri = Orientation(eOri) == ORIENTATION_PORTRAIT ? sal_False : sal_True;
for( sal_uInt16 i = 0; i < nAll; ++ i )
{
const SwPageDesc& rOld =
const_cast<const SwDoc *>(GetDoc())->GetPageDesc( i );
if( rOld.GetLandscape() != bNewOri )
{
SwPageDesc aNew( rOld );
{
::sw::UndoGuard const ug(GetDoc()->GetIDocumentUndoRedo());
GetDoc()->CopyPageDesc(rOld, aNew);
}
aNew.SetLandscape( bNewOri );
SwFrmFmt& rFmt = aNew.GetMaster();
SwFmtFrmSize aSz( rFmt.GetFrmSize() );
if( bNewOri ? aSz.GetHeight() > aSz.GetWidth()
: aSz.GetHeight() < aSz.GetWidth() )
{
SwTwips aTmp = aSz.GetHeight();
aSz.SetHeight( aSz.GetWidth() );
aSz.SetWidth( aTmp );
rFmt.SetFmtAttr( aSz );
}
GetDoc()->ChgPageDesc( i, aNew );
}
}
}
void ViewShell::ChgAllPageSize( Size &rSz )
{
OSL_ENSURE( nStartAction, "missing an Action" );
SET_CURR_SHELL( this );
SwDoc* pMyDoc = GetDoc();
sal_uInt16 nAll = pMyDoc->GetPageDescCnt();
for( sal_uInt16 i = 0; i < nAll; ++i )
{
const SwPageDesc &rOld = const_cast<const SwDoc *>(pMyDoc)->GetPageDesc( i );
SwPageDesc aNew( rOld );
{
::sw::UndoGuard const ug(GetDoc()->GetIDocumentUndoRedo());
GetDoc()->CopyPageDesc( rOld, aNew );
}
SwFrmFmt& rPgFmt = aNew.GetMaster();
Size aSz( rSz );
const sal_Bool bOri = aNew.GetLandscape();
if( bOri ? aSz.Height() > aSz.Width()
: aSz.Height() < aSz.Width() )
{
SwTwips aTmp = aSz.Height();
aSz.Height() = aSz.Width();
aSz.Width() = aTmp;
}
SwFmtFrmSize aFrmSz( rPgFmt.GetFrmSize() );
aFrmSz.SetSize( aSz );
rPgFmt.SetFmtAttr( aFrmSz );
pMyDoc->ChgPageDesc( i, aNew );
}
}
void ViewShell::CalcPagesForPrint( sal_uInt16 nMax )
{
SET_CURR_SHELL( this );
SwRootFrm* pMyLayout = GetLayout();
const SwFrm *pPage = pMyLayout->Lower();
SwLayAction aAction( pMyLayout, Imp() );
pMyLayout->StartAllAction();
for ( sal_uInt16 i = 1; pPage && i <= nMax; pPage = pPage->GetNext(), ++i )
{
pPage->Calc();
SwRect aOldVis( VisArea() );
aVisArea = pPage->Frm();
Imp()->SetFirstVisPageInvalid();
aAction.Reset();
aAction.SetPaint( sal_False );
aAction.SetWaitAllowed( sal_False );
aAction.SetReschedule( sal_True );
aAction.Action();
aVisArea = aOldVis;
Imp()->SetFirstVisPageInvalid();
}
pMyLayout->EndAllAction();
}
/******************************************************************************/
SwDoc * ViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt)
{
OSL_ENSURE( this->IsA( TYPE(SwFEShell) ),"ViewShell::Prt for FEShell only");
SwFEShell* pFESh = (SwFEShell*)this;
pPrtDoc->LockExpFlds();
// Make a copy of it since it gets destroyed with the temporary document
// used for PDF export
if (pPrt)
pPrtDoc->setPrinter( new SfxPrinter(*pPrt), true, true );
const SfxPoolItem* pCpyItem;
const SfxItemPool& rPool = GetAttrPool();
for( sal_uInt16 nWh = POOLATTR_BEGIN; nWh < POOLATTR_END; ++nWh )
if( 0 != ( pCpyItem = rPool.GetPoolDefaultItem( nWh ) ) )
pPrtDoc->GetAttrPool().SetPoolDefaultItem( *pCpyItem );
pPrtDoc->ReplaceStyles( *GetDoc() );
SwShellCrsr *pActCrsr = pFESh->_GetCrsr();
SwShellCrsr *pFirstCrsr = dynamic_cast<SwShellCrsr*>(pActCrsr->GetNext());
if( !pActCrsr->HasMark() )
{
pActCrsr = dynamic_cast<SwShellCrsr*>(pActCrsr->GetPrev());
}
Point aSelPoint;
if( pFESh->IsTableMode() )
{
SwShellTableCrsr* pShellTblCrsr = pFESh->GetTableCrsr();
const SwCntntNode* pCntntNode = pShellTblCrsr->GetNode()->GetCntntNode();
const SwCntntFrm *pCntntFrm = pCntntNode ? pCntntNode->getLayoutFrm( GetLayout(), 0, pShellTblCrsr->Start() ) : 0;
if( pCntntFrm )
{
SwRect aCharRect;
SwCrsrMoveState aTmpState( MV_NONE );
pCntntFrm->GetCharRect( aCharRect, *pShellTblCrsr->Start(), &aTmpState );
aSelPoint = Point( aCharRect.Left(), aCharRect.Top() );
}
}
else
{
aSelPoint = pFirstCrsr->GetSttPos();
}
const SwPageFrm* pPage = GetLayout()->GetPageAtPos( aSelPoint );
OSL_ENSURE( pPage, "no page found!" );
// get page descriptor - fall back to the first one if pPage could not be found
const SwPageDesc* pPageDesc = pPage ? pPrtDoc->FindPageDescByName(
pPage->GetPageDesc()->GetName() ) : &pPrtDoc->_GetPageDesc( (sal_uInt16)0 );
if( !pFESh->IsTableMode() && pActCrsr->HasMark() )
{
SwNodeIndex aNodeIdx( *pPrtDoc->GetNodes().GetEndOfContent().StartOfSectionNode() );
SwTxtNode* pTxtNd = pPrtDoc->GetNodes().GoNext( &aNodeIdx )->GetTxtNode();
SwCntntNode *pLastNd =
pActCrsr->GetCntntNode( (*pActCrsr->GetMark()) <= (*pActCrsr->GetPoint()) );
if( pLastNd && pLastNd->IsTxtNode() )
((SwTxtNode*)pLastNd)->CopyCollFmt( *pTxtNd );
}
pFESh->Copy( pPrtDoc );
{
SwNodeIndex aNodeIdx( *pPrtDoc->GetNodes().GetEndOfContent().StartOfSectionNode() );
SwCntntNode* pCNd = pPrtDoc->GetNodes().GoNext( &aNodeIdx );
if( pFESh->IsTableMode() )
{
SwTableNode* pTNd = pCNd->FindTableNode();
if( pTNd )
pTNd->GetTable().GetFrmFmt()->SetFmtAttr( SwFmtPageDesc( pPageDesc ) );
}
else
{
pCNd->SetAttr( SwFmtPageDesc( pPageDesc ) );
if( pFirstCrsr->HasMark() )
{
SwTxtNode *pTxtNd = pCNd->GetTxtNode();
if( pTxtNd )
{
SwCntntNode *pFirstNd =
pFirstCrsr->GetCntntNode( (*pFirstCrsr->GetMark()) > (*pFirstCrsr->GetPoint()) );
if( pFirstNd && pFirstNd->IsTxtNode() )
((SwTxtNode*)pFirstNd)->CopyCollFmt( *pTxtNd );
}
}
}
}
return pPrtDoc;
}
// TODO: there is already a GetPageByPageNum, but it checks some physical page
// number; unsure if we want that here, should find out what that is...
SwPageFrm const*
lcl_getPage(SwRootFrm const& rLayout, sal_Int32 const nPage)
{
// yes this is O(n^2) but at least it does not crash...
SwPageFrm const* pPage = dynamic_cast<const SwPageFrm*>(rLayout.Lower());
for (sal_Int32 i = nPage; pPage && (i > 0); --i)
{
if (1 == i) { // note: nPage is 1-based, i.e. 0 is invalid!
return pPage;
}
pPage = dynamic_cast<SwPageFrm const*>(pPage->GetNext());
}
OSL_ENSURE(pPage, "ERROR: SwPageFrm expected");
OSL_FAIL("non-existent page requested");
return 0;
}
sal_Bool ViewShell::PrintOrPDFExport(
OutputDevice *pOutDev,
SwPrintData const& rPrintData,
sal_Int32 nRenderer /* the index in the vector of pages to be printed */ )
{
const sal_Int32 nMaxRenderer = rPrintData.GetRenderData().GetPagesToPrint().size() - 1;
OSL_ENSURE( 0 <= nRenderer && nRenderer <= nMaxRenderer, "nRenderer out of bounds");
if (!pOutDev || nMaxRenderer < 0 || nRenderer < 0 || nRenderer > nMaxRenderer)
return sal_False;
// save settings of OutputDevice (should be done always since the
// output device is now provided by a call from outside the Writer)
pOutDev->Push();
// Print/PDF export for (multi-)selection has already generated a
// temporary document with the selected text.
// (see XRenderable implementation in unotxdoc.cxx)
// It is implemented this way because PDF export calls this Prt function
// once per page and we do not like to always have the temporary document
// to be created that often here.
ViewShell *pShell = new ViewShell( *this, 0, pOutDev );
SdrView *pDrawView = pShell->GetDrawView();
if (pDrawView)
{
pDrawView->SetBufferedOutputAllowed( false );
pDrawView->SetBufferedOverlayAllowed( false );
}
{
SET_CURR_SHELL( pShell );
if( pOpt->IsReadonly() )
pShell->pOpt->SetReadonly( sal_True );
// save options at draw view:
SwDrawViewSave aDrawViewSave( pShell->GetDrawView() );
pShell->PrepareForPrint( rPrintData );
const sal_Int32 nPage = rPrintData.GetRenderData().GetPagesToPrint()[ nRenderer ];
OSL_ENSURE( nPage < 0 ||
rPrintData.GetRenderData().GetValidPagesSet().count( nPage ) == 1,
"ViewShell::PrintOrPDFExport: nPage not valid" );
ViewShell *const pViewSh2 = (nPage < 0)
? rPrintData.GetRenderData().m_pPostItShell.get()// post-it page
: pShell; // a 'regular' page, not one from the post-it doc
SwPageFrm const*const pStPage =
lcl_getPage(*pViewSh2->GetLayout(), abs(nPage));
OSL_ENSURE( pStPage, "failed to get start page" );
if (!pStPage)
{
return sal_False;
}
//!! applying view options and formatting the document should now only be done in getRendererCount!
::SetSwVisArea( pViewSh2, pStPage->Frm() );
// FIXME disabled because rPrintData.aOffset is always (0,0)
#if 0
if( pStPage->GetFmt()->GetPoolFmtId() == RES_POOLPAGE_JAKET )
{
Point aNewOrigin = pOutDev->GetMapMode().GetOrigin();
aNewOrigin += rPrintData.aOffset;
MapMode aTmp( pOutDev->GetMapMode() );
aTmp.SetOrigin( aNewOrigin );
pOutDev->SetMapMode( aTmp );
}
#endif
pShell->InitPrt( pOutDev );
::SetSwVisArea( pViewSh2, pStPage->Frm() );
pStPage->GetUpper()->Paint( pStPage->Frm(), &rPrintData );
SwPaintQueue::Repaint();
}
delete pShell;
// restore settings of OutputDevice (should be done always now since the
// output device is now provided by a call from outside the Writer)
pOutDev->Pop();
return sal_True;
}
void ViewShell::PrtOle2( SwDoc *pDoc, const SwViewOption *pOpt, const SwPrintData& rOptions,
OutputDevice* pOleOut, const Rectangle& rRect )
{
ViewShell *pSh;
if( pDoc->GetCurrentViewShell() )
pSh = new ViewShell( *pDoc->GetCurrentViewShell(), 0, pOleOut,VSHELLFLAG_SHARELAYOUT );//swmod 080129
else //swmod 071108//swmod 071225
pSh = new ViewShell( *pDoc, 0, pOpt, pOleOut);//swmod 080129
{
SET_CURR_SHELL( pSh );
pSh->PrepareForPrint( rOptions );
pSh->SetPrtFormatOption( sal_True );
SwRect aSwRect( rRect );
pSh->aVisArea = aSwRect;
if ( pSh->GetViewOptions()->getBrowseMode() &&
pSh->GetNext() == pSh )
{
pSh->CheckBrowseView( sal_False );
pSh->GetLayout()->Lower()->InvalidateSize();
}
// CalcPagesForPrint() should not be necessary here. The pages in the
// visible area will be formatted in SwRootFrm::Paint().
// Removing this gives us a performance gain during saving the
// document because the thumbnail creation will not trigger a complete
// formatting of the document.
// Seiten fuers Drucken formatieren
// pSh->CalcPagesForPrint( SHRT_MAX );
pOleOut->Push( PUSH_CLIPREGION );
pOleOut->IntersectClipRegion( aSwRect.SVRect() );
pSh->GetLayout()->Paint( aSwRect );
pOleOut->Pop();
}
delete pSh;
}
sal_Bool ViewShell::IsAnyFieldInDoc() const
{
const SfxPoolItem* pItem;
sal_uInt32 nMaxItems = pDoc->GetAttrPool().GetItemCount2( RES_TXTATR_FIELD );
for( sal_uInt32 n = 0; n < nMaxItems; ++n )
if( 0 != (pItem = pDoc->GetAttrPool().GetItem2( RES_TXTATR_FIELD, n )))
{
const SwFmtFld* pFmtFld = (SwFmtFld*)pItem;
const SwTxtFld* pTxtFld = pFmtFld->GetTxtFld();
//#i101026# do not include postits in field check
const SwField* pFld = pFmtFld->GetFld();
if( pTxtFld && pTxtFld->GetTxtNode().GetNodes().IsDocNodes() && (pFld->Which() != RES_POSTITFLD))
return sal_True;
}
return sal_False;
}
SwDrawViewSave::SwDrawViewSave( SdrView* pSdrView )
: pDV( pSdrView )
{
if ( pDV )
{
sLayerNm.AssignAscii( RTL_CONSTASCII_STRINGPARAM("Controls" ) );
bPrintControls = pDV->IsLayerPrintable( sLayerNm );
}
}
SwDrawViewSave::~SwDrawViewSave()
{
if ( pDV )
{
pDV->SetLayerPrintable( sLayerNm, bPrintControls );
}
}
// #i6467# - method also called for page preview
void ViewShell::PrepareForPrint( const SwPrintData &rOptions )
{
pOpt->SetGraphic ( sal_True == rOptions.bPrintGraphic );
pOpt->SetTable ( sal_True == rOptions.bPrintTable );
pOpt->SetDraw ( sal_True == rOptions.bPrintDraw );
pOpt->SetControl ( sal_True == rOptions.bPrintControl );
pOpt->SetPageBack( sal_True == rOptions.bPrintPageBackground );
pOpt->SetBlackFont( sal_True == rOptions.bPrintBlackFont );
if ( HasDrawView() )
{
SdrView *pDrawView = GetDrawView();
String sLayerNm;
sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Controls" ));
// #i6467# - consider, if view shell belongs to page preview
if ( !IsPreView() )
{
pDrawView->SetLayerPrintable( sLayerNm, rOptions.bPrintControl );
}
else
{
pDrawView->SetLayerVisible( sLayerNm, rOptions.bPrintControl );
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|