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
654
655
656
657
658
|
/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: sdrpagewindow.cxx,v $
*
* $Revision: 1.6 $
*
* last change: $Author: vg $ $Date: 2007-02-26 15:59:12 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
*
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2005 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
#ifndef _SDRPAGEWINDOW_HXX
#include <sdrpagewindow.hxx>
#endif
#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
#include <com/sun/star/awt/XWindow.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
#include <com/sun/star/beans/XPropertySet.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_POSSIZE_HPP_
#include <com/sun/star/awt/PosSize.hpp>
#endif
#ifndef _COM_SUN_STAR_UTIL_XMODECHANGEBROADCASTER_HPP_
#include <com/sun/star/util/XModeChangeBroadcaster.hpp>
#endif
#ifndef _COMPHELPER_PROCESSFACTORY_HXX_
#include <comphelper/processfactory.hxx>
#endif
#ifndef _SV_SVAPP_HXX
#include <vcl/svapp.hxx>
#endif
#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
#include <toolkit/helper/vclunohelper.hxx>
#endif
#ifndef _SVDOUNO_HXX
#include <svdouno.hxx>
#endif
#ifndef _SVDPAGE_HXX
#include <svdpage.hxx>
#endif
#ifndef _SVDVIEW_HXX
#include <svdview.hxx>
#endif
#ifndef _SVDPAGV_HXX
#include <svdpagv.hxx>
#endif
#ifndef _SDRPAINTWINDOW_HXX
#include <sdrpaintwindow.hxx>
#endif
#ifndef _SDR_CONTACT_OBJECTCONTACTOFPAGEVIEW_HXX
#include <svx/sdr/contact/objectcontactofpageview.hxx>
#endif
#ifndef _XOUTX_HXX
#include <xoutx.hxx>
#endif
#ifndef _SDR_CONTACT_DISPLAYINFO_HXX
#include <svx/sdr/contact/displayinfo.hxx>
#endif
#ifndef _VOS_MUTEX_HXX_
#include <vos/mutex.hxx>
#endif
#ifndef _SVX_FMVIEW_HXX
#include <fmview.hxx>
#endif
using namespace ::rtl;
using namespace ::com::sun::star;
////////////////////////////////////////////////////////////////////////////////////////////////////
::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > SdrPageWindow::GetControlContainer( bool _bCreateIfNecessary ) const
{
if ( !mxControlContainer.is() && _bCreateIfNecessary )
{
SdrView& rView = GetPageView().GetView();
if(GetPaintWindow().OutputToWindow() && !rView.IsPrintPreview())
{
Window* pWindow = (Window*)(&GetPaintWindow().GetOutputDevice());
const_cast< SdrPageWindow* >( this )->mxControlContainer = VCLUnoHelper::CreateControlContainer( pWindow );
// #100394# xC->setVisible triggers window->Show() and this has
// problems when the view is not completely constructed which may
// happen when loading. This leads to accessibility broadcasts which
// throw asserts due to the not finished view. All this chan be avoided
// since xC->setVisible is here called only for the side effect in
// UnoControlContainer::setVisible(...) which calls createPeer(...).
// This will now be called directly from here.
// UnoContainerModel erzeugen
// uno::Reference< awt::XWindow > xC(mxControlContainer, uno::UNO_QUERY);
// CreateControlContainer() is only used from
// , thus it seems not necessary to make
// it visible her at all.
// #58917# Das Show darf nicht am VCL-Fenster landen, weil dann Assertion vom SFX
// BOOL bVis = pWindow->IsVisible();
// xC->setVisible(TRUE);
// if ( !bVis )
// pWindow->Hide();
// if( !mxContext.is() && bVisible )
// // Es ist ein TopWindow, also automatisch anzeigen
// createPeer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > (), ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > () );
uno::Reference< awt::XControl > xControl(mxControlContainer, uno::UNO_QUERY);
if(xControl.is())
{
uno::Reference< uno::XInterface > xContext = xControl->getContext();
if(!xContext.is())
{
xControl->createPeer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > (),
::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > () );
}
}
}
else
{
// Printer und VirtualDevice, bzw. kein OutDev
uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
if( xFactory.is() )
{
const_cast< SdrPageWindow* >( this )->mxControlContainer = uno::Reference< awt::XControlContainer >(xFactory->createInstance(rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlContainer")), uno::UNO_QUERY);
uno::Reference< awt::XControlModel > xModel(xFactory->createInstance(rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlContainerModel")), uno::UNO_QUERY);
uno::Reference< awt::XControl > xControl(mxControlContainer, uno::UNO_QUERY);
if (xControl.is())
xControl->setModel(xModel);
OutputDevice& rOutDev = GetPaintWindow().GetOutputDevice();
Point aPosPix = rOutDev.GetMapMode().GetOrigin();
Size aSizePix = rOutDev.GetOutputSizePixel();
uno::Reference< awt::XWindow > xContComp(mxControlContainer, uno::UNO_QUERY);
if( xContComp.is() )
xContComp->setPosSize(aPosPix.X(), aPosPix.Y(), aSizePix.Width(), aSizePix.Height(), awt::PosSize::POSSIZE);
}
}
FmFormView* pViewAsFormView = dynamic_cast< FmFormView* >( &rView );
if ( pViewAsFormView )
pViewAsFormView->InsertControlContainer(mxControlContainer);
}
return mxControlContainer;
}
SdrPageWindow::SdrPageWindow(SdrPageView& rPageView, SdrPaintWindow& rPaintWindow)
: mpObjectContact(0L),
mrPageView(rPageView),
mpPaintWindow(&rPaintWindow),
mpOriginalPaintWindow(NULL)
{
}
SdrPageWindow::~SdrPageWindow()
{
// #110094#, #i26631#
ResetObjectContact();
if(mpObjectContact)
{
mpObjectContact->PrepareDelete();
delete mpObjectContact;
mpObjectContact = 0L;
}
if (mxControlContainer.is())
{
SdrView& rView = GetPageView().GetView();
// notify derived views
FmFormView* pViewAsFormView = dynamic_cast< FmFormView* >( &rView );
if ( pViewAsFormView )
pViewAsFormView->RemoveControlContainer(mxControlContainer);
// dispose the control container
uno::Reference< lang::XComponent > xComponent(mxControlContainer, uno::UNO_QUERY);
xComponent->dispose();
}
}
// #110094# ObjectContact section
sdr::contact::ObjectContact* SdrPageWindow::CreateViewSpecificObjectContact()
{
return new sdr::contact::ObjectContactOfPageView(*this);
}
SdrPaintInfoRec* SdrPageWindow::ImpCreateNewPageInfoRec(const Rectangle& rDirtyRect,
sal_uInt16 nPaintMode, const SdrLayerID* pId) const
{
SdrPaintInfoRec* pInfoRec = new SdrPaintInfoRec();
const sal_Bool bPrinter(GetPaintWindow().OutputToPrinter());
Rectangle aCheckRect(rDirtyRect);
Size a1PixSiz(GetPaintWindow().GetOutputDevice().PixelToLogic(Size(1, 1)));
const SdrView& rView = mrPageView.GetView();
aCheckRect.Left() -= a1PixSiz.Width();
aCheckRect.Top() -= a1PixSiz.Height();
aCheckRect.Right() += a1PixSiz.Width();
aCheckRect.Bottom() += a1PixSiz.Height();
pInfoRec->pPV = &mrPageView;
pInfoRec->bPrinter = bPrinter;
pInfoRec->aDirtyRect = rDirtyRect;
pInfoRec->aCheckRect = aCheckRect;
if(bPrinter)
{
if(rView.IsLineDraftPrn()) nPaintMode |= SDRPAINTMODE_DRAFTLINE;
if(rView.IsFillDraftPrn()) nPaintMode |= SDRPAINTMODE_DRAFTFILL;
if(rView.IsTextDraftPrn()) nPaintMode |= SDRPAINTMODE_DRAFTTEXT;
if(rView.IsGrafDraftPrn()) nPaintMode |= SDRPAINTMODE_DRAFTGRAF;
}
else
{
if(rView.IsLineDraft()) nPaintMode |= SDRPAINTMODE_DRAFTLINE;
if(rView.IsFillDraft()) nPaintMode |= SDRPAINTMODE_DRAFTFILL;
if(rView.IsTextDraft()) nPaintMode |= SDRPAINTMODE_DRAFTTEXT;
if(rView.IsGrafDraft()) nPaintMode |= SDRPAINTMODE_DRAFTGRAF;
if(rView.IsHideGrafDraft()) nPaintMode |= SDRPAINTMODE_HIDEDRAFTGRAF;
}
if(pId)
{
pInfoRec->aPaintLayer.ClearAll();
pInfoRec->aPaintLayer.Set(*pId);
}
else
{
pInfoRec->aPaintLayer = bPrinter
? mrPageView.GetPrintableLayers()
: mrPageView.GetVisibleLayers();
}
pInfoRec->nPaintMode = nPaintMode;
if(mrPageView.GetObjList() != mrPageView.GetPage())
{
pInfoRec->pAktList = mrPageView.GetObjList();
}
return pInfoRec;
}
// OVERLAYMANAGER
::sdr::overlay::OverlayManager* SdrPageWindow::GetOverlayManager() const
{
return GetPaintWindow().GetOverlayManager();
}
void SdrPageWindow::patchPaintWindow(SdrPaintWindow& rPaintWindow)
{
mpOriginalPaintWindow = mpPaintWindow;
mpPaintWindow = &rPaintWindow;
}
void SdrPageWindow::unpatchPaintWindow()
{
DBG_ASSERT(mpOriginalPaintWindow, "SdrPageWindow::unpatchPaintWindow: paint window not patched!" );
if ( mpOriginalPaintWindow )
{
mpPaintWindow = mpOriginalPaintWindow;
mpOriginalPaintWindow = NULL;
}
}
void SdrPageWindow::PrepareRedraw(const Region& rReg)
{
// get XOutDev
const SdrView& rView = mrPageView.GetView();
XOutputDevice* pXOut = rView.GetExtendedOutputDevice();
// get to be processed layers
const sal_Bool bPrinter(GetPaintWindow().OutputToPrinter());
SetOfByte aProcessLayers = bPrinter ? mrPageView.GetPrintableLayers() : mrPageView.GetVisibleLayers();
// get OutDev and set offset there
OutputDevice& rTargetDevice = GetPaintWindow().GetOutputDevice();
pXOut->SetOutDev(&rTargetDevice);
pXOut->SetOffset(Point());
// create PaintInfoRec, use Rectangle only temporarily
SdrPaintInfoRec* pInfoRec = ImpCreateNewPageInfoRec(rReg.GetBoundRect(), 0, 0L);
// create processing data
sdr::contact::DisplayInfo aDisplayInfo(&mrPageView);
aDisplayInfo.SetProcessLayers(aProcessLayers);
aDisplayInfo.SetExtendedOutputDevice(pXOut);
aDisplayInfo.SetPaintInfoRec(pInfoRec);
aDisplayInfo.SetOutputDevice(&rTargetDevice);
// #114359# Set region as redraw area, not a rectangle
aDisplayInfo.SetRedrawArea(rReg);
// no PagePainting for preparations
aDisplayInfo.SetPagePainting(rView.IsPagePaintingAllowed()); // #i72889#
// keep draw hierarchy up-to-date and expand ClipRegion
GetObjectContact().PreProcessDisplay(aDisplayInfo);
// remember eventually changed RedrawArea at PaintWindow for usage with
// overlay and PreRenderDevice stuff
GetPaintWindow().SetRedrawRegion(aDisplayInfo.GetRedrawArea());
// delete PaintInfoRec
delete pInfoRec;
}
//////////////////////////////////////////////////////////////////////////////
// clip test
#ifdef CLIPPER_TEST
#ifndef _SVDOPATH_HXX
#include <svdopath.hxx>
#endif
#ifndef _BGFX_POLYGON_B2DPOLYGON_HXX
#include <basegfx/polygon/b2dpolygon.hxx>
#endif
#ifndef _SV_SALBTYPE_HXX
#include <vcl/salbtype.hxx> // FRound
#endif
#ifndef _BGFX_POLYGON_CUTANDTOUCH_HXX
#include <basegfx/polygon/b2dpolygoncutandtouch.hxx>
#endif
#ifndef _BGFX_POLYPOLYGON_B2DPOLYGONTOOLS_HXX
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#endif
#ifndef _BGFX_POLYGON_B2DPOLYGONTOOLS_HXX
#include <basegfx/polygon/b2dpolygontools.hxx>
#endif
#ifndef _BGFX_POLYPOLYGON_B2DPOLYGONCLIPPER_HXX
#include <basegfx/polygon/b2dpolygonclipper.hxx>
#endif
// for ::std::sort
#include <algorithm>
namespace
{
void impPaintStrokePolygon(const basegfx::B2DPolygon& rCandidate, OutputDevice& rOutDev, Color aColor)
{
basegfx::B2DPolygon aCandidate(rCandidate);
if(aCandidate.areControlPointsUsed())
{
aCandidate = basegfx::tools::adaptiveSubdivideByAngle(rCandidate);
}
if(aCandidate.count())
{
const sal_uInt32 nLoopCount(aCandidate.isClosed() ? aCandidate.count() : aCandidate.count() - 1L);
rOutDev.SetFillColor();
rOutDev.SetLineColor(aColor);
for(sal_uInt32 a(0L); a < nLoopCount; a++)
{
const basegfx::B2DPoint aBStart(aCandidate.getB2DPoint(a));
const basegfx::B2DPoint aBEnd(aCandidate.getB2DPoint((a + 1) % aCandidate.count()));
const Point aStart(FRound(aBStart.getX()), FRound(aBStart.getY()));
const Point aEnd(FRound(aBEnd.getX()), FRound(aBEnd.getY()));
rOutDev.DrawLine(aStart, aEnd);
}
}
}
void impTryTest(const SdrPageView& rPageView, OutputDevice& rOutDev)
{
if(rPageView.GetPage() && rPageView.GetPage()->GetObjCount() >= 2L)
{
SdrPage* pPage = rPageView.GetPage();
SdrObject* pObjA = pPage->GetObj(0L);
if(pObjA && pObjA->ISA(SdrPathObj))
{
basegfx::B2DPolyPolygon aPolyA(((SdrPathObj*)pObjA)->GetPathPoly());
aPolyA = basegfx::tools::correctOrientations(aPolyA);
basegfx::B2DPolyPolygon aPolyB;
for(sal_uInt32 a(1L); a < rPageView.GetPage()->GetObjCount(); a++)
{
SdrObject* pObjB = pPage->GetObj(a);
if(pObjB && pObjB->ISA(SdrPathObj))
{
basegfx::B2DPolyPolygon aCandidate(((SdrPathObj*)pObjB)->GetPathPoly());
aCandidate = basegfx::tools::correctOrientations(aCandidate);
aPolyB.append(aCandidate);
}
}
if(aPolyA.count() && aPolyA.isClosed() && aPolyB.count())
{
// poly A is the clipregion, clip poly b against it. Algo depends on
// poly b being closed.
basegfx::B2DPolyPolygon aResult(basegfx::tools::clipPolyPolygonOnPolyPolygon(aPolyB, aPolyA));
for(sal_uInt32 a(0L); a < aResult.count(); a++)
{
Color aColor(rand()%255, rand()%255, rand()%255);
impPaintStrokePolygon(aResult.getB2DPolygon(a), rOutDev, aColor);
}
bool bBla = true;
}
}
}
}
} // end of anonymous namespace
#endif // CLIPPER_TEST
//////////////////////////////////////////////////////////////////////////////
void SdrPageWindow::RedrawAll(sal_uInt16 nPaintMode, ::sdr::contact::ViewObjectContactRedirector* pRedirector) const
{
// set Redirector
GetObjectContact().SetViewObjectContactRedirector(pRedirector);
// set PaintingPageView
const SdrView& rView = mrPageView.GetView();
SdrModel& rModel = *((SdrModel*)rView.GetModel());
rModel.SetPaintingPageView(&mrPageView);
// get XOutDev
XOutputDevice* pXOut = rView.GetExtendedOutputDevice();
// get to be processed layers
const sal_Bool bPrinter(GetPaintWindow().OutputToPrinter());
SetOfByte aProcessLayers = bPrinter ? mrPageView.GetPrintableLayers() : mrPageView.GetVisibleLayers();
// get TargetDevice and force output to this one given target
SdrPreRenderDevice* pPreRenderDevice = GetPaintWindow().GetPreRenderDevice();
OutputDevice& rTargetDevice = (pPreRenderDevice)
? pPreRenderDevice->GetPreRenderDevice() : GetPaintWindow().GetOutputDevice();
pXOut->SetOutDev(&rTargetDevice);
// set Offset at XOutDev
pXOut->SetOffset(Point());
// create PaintInfoRec, #114359# use Rectangle only temporarily
const Region& rRegion = GetPaintWindow().GetRedrawRegion();
SdrPaintInfoRec* pInfoRec = ImpCreateNewPageInfoRec(rRegion.GetBoundRect(), nPaintMode, 0L);
// create processing data
sdr::contact::DisplayInfo aDisplayInfo(&mrPageView);
// Draw all layers. do NOT draw form layer from CompleteRedraw, this is done separate
// as a single layer paint
const SdrLayerAdmin& rLayerAdmin = rModel.GetLayerAdmin();
const SdrLayerID nControlLayerId = rLayerAdmin.GetLayerID(rLayerAdmin.GetControlLayerName(), sal_False);
aProcessLayers.Clear(nControlLayerId);
// still something to paint?
if(!aProcessLayers.IsEmpty())
{
aDisplayInfo.SetProcessLayers(aProcessLayers);
aDisplayInfo.SetExtendedOutputDevice(pXOut);
aDisplayInfo.SetPaintInfoRec(pInfoRec);
aDisplayInfo.SetOutputDevice(&rTargetDevice);
// Set region as redraw area
aDisplayInfo.SetRedrawArea(rRegion);
// Draw/Impress
aDisplayInfo.SetPagePainting(rView.IsPagePaintingAllowed()); // #i72889#
// paint page
GetObjectContact().ProcessDisplay(aDisplayInfo);
}
// delete PaintInfoRec
delete pInfoRec;
// reset redirector
GetObjectContact().SetViewObjectContactRedirector(0L);
// LineClip test
#ifdef CLIPPER_TEST
if(true)
{
impTryTest(GetPageView(), GetPaintWindow().GetOutputDevice());
}
#endif // CLIPPER_TEST
}
void SdrPageWindow::RedrawLayer(
sal_uInt16 nPaintMode, const SdrLayerID* pId,
::sdr::contact::ViewObjectContactRedirector* pRedirector) const
{
// set redirector
GetObjectContact().SetViewObjectContactRedirector(pRedirector);
// set PaintingPageView
const SdrView& rView = mrPageView.GetView();
SdrModel& rModel = *((SdrModel*)rView.GetModel());
rModel.SetPaintingPageView(&mrPageView);
// get XOutDev
XOutputDevice* pXOut = rView.GetExtendedOutputDevice();
// get the layers to process
const sal_Bool bPrinter(GetPaintWindow().OutputToPrinter());
SetOfByte aProcessLayers = bPrinter ? mrPageView.GetPrintableLayers() : mrPageView.GetVisibleLayers();
// is the given layer visible at all?
if(aProcessLayers.IsSet(*pId))
{
// find out if we are painting the ControlLayer
const SdrLayerAdmin& rLayerAdmin = rModel.GetLayerAdmin();
const SdrLayerID nControlLayerId = rLayerAdmin.GetLayerID(rLayerAdmin.GetControlLayerName(), sal_False);
const sal_Bool bControlLayerPainting(pId && nControlLayerId == *pId);
// Get PreRenderDevice and force output to this one given target
SdrPreRenderDevice* pPreRenderDevice = GetPaintWindow().GetPreRenderDevice();
OutputDevice& rTargetDevice =
(pPreRenderDevice && !bControlLayerPainting)
? pPreRenderDevice->GetPreRenderDevice() : GetPaintWindow().GetOutputDevice();
pXOut->SetOutDev(&rTargetDevice);
// set offset at XOutDev
pXOut->SetOffset(Point());
// create PaintInfoRec, use Rectangle only temporarily
const Region& rRegion = GetPaintWindow().GetRedrawRegion();
SdrPaintInfoRec* pInfoRec = ImpCreateNewPageInfoRec(rRegion.GetBoundRect(), nPaintMode, pId);
// create processing data
sdr::contact::DisplayInfo aDisplayInfo(&mrPageView);
// is it the control layer? If Yes, set flag
aDisplayInfo.SetControlLayerPainting(bControlLayerPainting);
// Draw just the one given layer
aProcessLayers.ClearAll();
aProcessLayers.Set(*pId);
aDisplayInfo.SetProcessLayers(aProcessLayers);
aDisplayInfo.SetExtendedOutputDevice(pXOut);
aDisplayInfo.SetPaintInfoRec(pInfoRec);
aDisplayInfo.SetOutputDevice(&rTargetDevice);
// Set region as redraw area
aDisplayInfo.SetRedrawArea(rRegion);
// Writer or calc, coming from original RedrawOneLayer.
aDisplayInfo.SetPagePainting(sal_False); // #i72889# no page painting for layer painting
// check for valid draw hierarchy
if(!GetObjectContact().IsDrawHierarchyValid())
{
// Normally, PreProcessDisplay is called from BeginDrawLayer() for layer painting. Instead of finding
// all places where SC and SW use RedrawLayer() and embrace the calls with BeginDrawLayer()/EndDrawLayer(),
// i will do what happened before (and worked): build the draw hierarchy.
GetObjectContact().PreProcessDisplay(aDisplayInfo);
}
// paint page
GetObjectContact().ProcessDisplay(aDisplayInfo);
// delete PaintInfoRec
delete pInfoRec;
}
// reset redirector
GetObjectContact().SetViewObjectContactRedirector(0L);
}
// Invalidate call, used from ObjectContact(OfPageView) in InvalidatePartOfView(...)
void SdrPageWindow::Invalidate(const Rectangle& rRectangle)
{
if(GetPageView().IsVisible() && GetPaintWindow().OutputToWindow())
{
((Window&)GetPaintWindow().GetOutputDevice()).Invalidate(rRectangle, INVALIDATE_NOERASE);
}
}
// #110094# ObjectContact section
sdr::contact::ObjectContact& SdrPageWindow::GetObjectContact() const
{
if(!mpObjectContact)
{
((SdrPageWindow*)this)->mpObjectContact = ((SdrPageWindow*)this)->CreateViewSpecificObjectContact();
}
return *mpObjectContact;
}
bool SdrPageWindow::HasObjectContact() const
{
return ( mpObjectContact != NULL );
}
// #i26631#
void SdrPageWindow::ResetObjectContact()
{
if(mpObjectContact)
{
mpObjectContact->PrepareDelete();
delete mpObjectContact;
mpObjectContact = 0L;
}
}
void SdrPageWindow::SetDesignMode( bool _bDesignMode ) const
{
const ::sdr::contact::ObjectContactOfPageView* pOC = dynamic_cast< const ::sdr::contact::ObjectContactOfPageView* >( &GetObjectContact() );
DBG_ASSERT( pOC, "SdrPageWindow::SetDesignMode: invalid object contact!" );
if ( pOC )
pOC->SetUNOControlsDesignMode( _bDesignMode );
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// eof
|