Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include <com/sun/star/text/HoriOrientation.hpp>
31 : : #include <hintids.hxx>
32 : : #include <vcl/lazydelete.hxx>
33 : : #include <tools/poly.hxx>
34 : : #include <svx/xoutbmp.hxx>
35 : : #include <sfx2/progress.hxx>
36 : : #include <editeng/brshitem.hxx>
37 : : #include <editeng/opaqitem.hxx>
38 : : #include <editeng/prntitem.hxx>
39 : : #include <editeng/boxitem.hxx>
40 : : #include <editeng/shaditem.hxx>
41 : : #include <editeng/ulspitem.hxx>
42 : : #include <svx/framelink.hxx>
43 : : #include <vcl/graph.hxx>
44 : : #include <svx/svdpagv.hxx>
45 : : #include <tgrditem.hxx>
46 : : #include <switerator.hxx>
47 : : #include <fmtsrnd.hxx>
48 : : #include <fmtclds.hxx>
49 : : #include <comcore.hrc>
50 : : #include <swmodule.hxx>
51 : : #include <rootfrm.hxx>
52 : : #include <pagefrm.hxx>
53 : : #include <cntfrm.hxx>
54 : : #include <viewsh.hxx>
55 : : #include <section.hxx>
56 : : #include <sectfrm.hxx>
57 : : #include <doc.hxx>
58 : : #include <viewimp.hxx>
59 : : #include <dflyobj.hxx>
60 : : #include <flyfrm.hxx>
61 : : #include <frmtool.hxx>
62 : : #include <viewopt.hxx>
63 : : #include <dview.hxx>
64 : : #include <dcontact.hxx>
65 : : #include <txtfrm.hxx>
66 : : #include <ftnfrm.hxx>
67 : : #include <tabfrm.hxx>
68 : : #include <rowfrm.hxx>
69 : : #include <cellfrm.hxx>
70 : : #include <notxtfrm.hxx>
71 : : #include <swregion.hxx>
72 : : #include <layact.hxx>
73 : : #include <pagedesc.hxx>
74 : : #include <ptqueue.hxx>
75 : : #include <noteurl.hxx>
76 : : #include <virtoutp.hxx>
77 : : #include <lineinfo.hxx>
78 : : #include <dbg_lay.hxx>
79 : : #include <accessibilityoptions.hxx>
80 : : #include <docsh.hxx>
81 : : #include <svx/svdogrp.hxx>
82 : : #include <sortedobjs.hxx>
83 : : #include <EnhancedPDFExportHelper.hxx>
84 : : #include <bodyfrm.hxx>
85 : : #include <hffrm.hxx>
86 : : #include <colfrm.hxx>
87 : : #include <PageBreakWin.hxx>
88 : : // <--
89 : : // --> OD #i76669#
90 : : #include <svx/sdr/contact/viewobjectcontactredirector.hxx>
91 : : #include <svx/sdr/contact/viewobjectcontact.hxx>
92 : : #include <svx/sdr/contact/viewcontact.hxx>
93 : : // <--
94 : :
95 : : #include <ndole.hxx>
96 : : #include <svtools/chartprettypainter.hxx>
97 : : #include <PostItMgr.hxx>
98 : : #include <vcl/svapp.hxx>
99 : :
100 : : #define COL_NOTES_SIDEPANE RGB_COLORDATA(230,230,230)
101 : : #define COL_NOTES_SIDEPANE_BORDER RGB_COLORDATA(200,200,200)
102 : : #define COL_NOTES_SIDEPANE_SCROLLAREA RGB_COLORDATA(230,230,220)
103 : :
104 : : #include <svtools/borderhelper.hxx> //Need for svtools::DrawLine
105 : : #include <swtable.hxx> //Need for svtools::DrawLine
106 : :
107 : : #include "pagefrm.hrc"
108 : : #include <drawinglayer/geometry/viewinformation2d.hxx>
109 : : #include <drawinglayer/processor2d/baseprocessor2d.hxx>
110 : : #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
111 : : #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
112 : : #include <drawinglayer/primitive2d/borderlineprimitive2d.hxx>
113 : : #include <drawinglayer/primitive2d/discreteshadowprimitive2d.hxx>
114 : : #include <drawinglayer/primitive2d/textprimitive2d.hxx>
115 : : #include <drawinglayer/primitive2d/textlayoutdevice.hxx>
116 : : #include <drawinglayer/processor2d/processorfromoutputdevice.hxx>
117 : : #include <svx/unoapi.hxx>
118 : : #include <comphelper/sequenceasvector.hxx>
119 : : #include <basegfx/matrix/b2dhommatrix.hxx>
120 : : #include <basegfx/matrix/b2dhommatrixtools.hxx>
121 : : #include <basegfx/polygon/b2dpolygon.hxx>
122 : : #include <basegfx/color/bcolortools.hxx>
123 : :
124 : : #include <vector>
125 : : #include <algorithm>
126 : : #include <wrtsh.hxx>
127 : : #include <edtwin.hxx>
128 : : #include <view.hxx>
129 : :
130 : : using namespace ::editeng;
131 : : using namespace ::com::sun::star;
132 : : using ::drawinglayer::primitive2d::BorderLinePrimitive2D;
133 : : using ::std::pair;
134 : : using ::std::make_pair;
135 : :
136 : : //subsidiary lines enabled?
137 : : #define IS_SUBS_TABLE \
138 : : (pGlobalShell->GetViewOptions()->IsTable() && \
139 : : !pGlobalShell->GetViewOptions()->IsPagePreview()&&\
140 : : !pGlobalShell->GetViewOptions()->IsReadonly()&&\
141 : : !pGlobalShell->GetViewOptions()->IsFormView() &&\
142 : : SwViewOption::IsTableBoundaries())
143 : : //other subsidiary lines enabled?
144 : : #define IS_SUBS (!pGlobalShell->GetViewOptions()->IsPagePreview() && \
145 : : !pGlobalShell->GetViewOptions()->IsReadonly() && \
146 : : !pGlobalShell->GetViewOptions()->IsFormView() &&\
147 : : SwViewOption::IsDocBoundaries())
148 : : //subsidiary lines for sections
149 : : #define IS_SUBS_SECTION (!pGlobalShell->GetViewOptions()->IsPagePreview() && \
150 : : !pGlobalShell->GetViewOptions()->IsReadonly()&&\
151 : : !pGlobalShell->GetViewOptions()->IsFormView() &&\
152 : : SwViewOption::IsSectionBoundaries())
153 : : #define IS_SUBS_FLYS (!pGlobalShell->GetViewOptions()->IsPagePreview() && \
154 : : !pGlobalShell->GetViewOptions()->IsReadonly()&&\
155 : : !pGlobalShell->GetViewOptions()->IsFormView() &&\
156 : : SwViewOption::IsObjectBoundaries())
157 : :
158 : : //Class declaration; here because they are only used in this file
159 : :
160 : : #define SUBCOL_PAGE 0x01 //Helplines of the page
161 : : #define SUBCOL_TAB 0x08 //Helplines inside tables
162 : : #define SUBCOL_FLY 0x10 //Helplines inside fly frames
163 : : #define SUBCOL_SECT 0x20 //Helplines inside sections
164 : :
165 : : // Classes collecting the border lines and help lines
166 : 6798 : class SwLineRect : public SwRect
167 : : {
168 : : Color aColor;
169 : : SvxBorderStyle nStyle;
170 : : const SwTabFrm *pTab;
171 : : sal_uInt8 nSubColor; //colorize subsidiary lines
172 : : sal_Bool bPainted; //already painted?
173 : : sal_uInt8 nLock; //To distinguish the line and the hell layer.
174 : : public:
175 : : SwLineRect( const SwRect &rRect, const Color *pCol, const SvxBorderStyle nStyle,
176 : : const SwTabFrm *pT , const sal_uInt8 nSCol );
177 : :
178 : 20740 : const Color *GetColor() const { return &aColor;}
179 : 0 : SvxBorderStyle GetStyle() const { return nStyle; }
180 : 26620 : const SwTabFrm *GetTab() const { return pTab; }
181 : 3300 : void SetPainted() { bPainted = sal_True; }
182 [ + + ]: 9090 : void Lock( sal_Bool bLock ) { if ( bLock )
183 : 4088 : ++nLock;
184 [ + + ]: 5002 : else if ( nLock )
185 : 4082 : --nLock;
186 : 9090 : }
187 : 34922 : sal_Bool IsPainted() const { return bPainted; }
188 : 6318 : sal_Bool IsLocked() const { return nLock != 0; }
189 : 25664 : sal_uInt8 GetSubColor() const { return nSubColor;}
190 : :
191 : : sal_Bool MakeUnion( const SwRect &rRect );
192 : : };
193 : :
194 : 37445 : class SwLineRects : public std::vector< SwLineRect >
195 : : {
196 : : size_t nLastCount; //avoid unnecessary cycles in PaintLines
197 : : public:
198 : 37445 : SwLineRects() : nLastCount( 0 ) {}
199 : : void AddLineRect( const SwRect& rRect, const Color *pColor, const SvxBorderStyle nStyle,
200 : : const SwTabFrm *pTab, const sal_uInt8 nSCol );
201 : : void ConnectEdges( OutputDevice *pOut );
202 : : void PaintLines ( OutputDevice *pOut );
203 : : void LockLines( sal_Bool bLock );
204 : :
205 : : //Limit lines to 100
206 : 0 : bool isFull() const { return this->size()>100 ? true : false; }
207 : : };
208 : :
209 : 50048 : class SwSubsRects : public SwLineRects
210 : : {
211 : : void RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects );
212 : : public:
213 : : void PaintSubsidiary( OutputDevice *pOut, const SwLineRects *pRects );
214 : :
215 : : inline void Ins( const SwRect &rRect, const sal_uInt8 nSCol );
216 : : };
217 : :
218 : 25586 : class BorderLines
219 : : {
220 : : typedef ::comphelper::SequenceAsVector<
221 : : ::rtl::Reference<BorderLinePrimitive2D> > Lines_t;
222 : : Lines_t m_Lines;
223 : : public:
224 : : void AddBorderLine(::rtl::Reference<BorderLinePrimitive2D> const& xLine);
225 : 12793 : drawinglayer::primitive2d::Primitive2DSequence GetBorderLines_Clear()
226 : : {
227 : : ::comphelper::SequenceAsVector<
228 [ + - ]: 12793 : ::drawinglayer::primitive2d::Primitive2DReference> lines;
229 [ + - ][ + - ]: 13847 : for (Lines_t::const_iterator it = m_Lines.begin(); it != m_Lines.end();
[ + + ]
230 : : ++it)
231 : : {
232 [ + - ][ + - ]: 1054 : lines.push_back(it->get());
[ + - ]
233 : : }
234 : 12793 : m_Lines.clear();
235 [ + - ]: 12793 : return lines.getAsConstList();
236 : : }
237 : : };
238 : :
239 : : //----------------- End of classes for border lines ----------------------
240 : :
241 : : static ViewShell *pGlobalShell = 0;
242 : :
243 : : //Only repaint the Fly content as well as the background of the Fly content if
244 : : //a metafile is taken of the Fly.
245 : : static sal_Bool bFlyMetafile = sal_False;
246 : : static OutputDevice *pFlyMetafileOut = 0;
247 : :
248 : : //Retouch for transparent Flys is done by the background of the Flys.
249 : : //The Fly itself should certainly not be spared out. See PaintBackground and
250 : : //lcl_SubtractFlys()
251 : : static SwFlyFrm *pRetoucheFly = 0;
252 : : static SwFlyFrm *pRetoucheFly2 = 0;
253 : :
254 : : // Sizes of a pixel and the corresponding halves. Will be reset when
255 : : // entering SwRootFrm::Paint
256 : : static long nPixelSzW = 0, nPixelSzH = 0;
257 : : static long nHalfPixelSzW = 0, nHalfPixelSzH = 0;
258 : : static long nMinDistPixelW = 0, nMinDistPixelH = 0;
259 : :
260 : : // Current zoom factor
261 : : static double aScaleX = 1.0;
262 : : static double aScaleY = 1.0;
263 : : static double aMinDistScale = 0.73;
264 : : static double aEdgeScale = 0.5;
265 : :
266 : : // The borders will be collected in pLines during the Paint and later
267 : : // possibly merge them.
268 : : // The help lines will be collected and merged in pSubsLines. These will
269 : : // be compared with pLines before the work in order to avoid help lines
270 : : // to hide borders.
271 : : // bTablines is sal_True during the Paint of a table.
272 : : static BorderLines *g_pBorderLines = 0;
273 : : static SwLineRects *pLines = 0;
274 : : static SwSubsRects *pSubsLines = 0;
275 : : // global variable for sub-lines of body, header, footer, section and footnote frames.
276 : : static SwSubsRects *pSpecSubsLines = 0;
277 : :
278 : : static SfxProgress *pProgress = 0;
279 : :
280 : : static SwFlyFrm *pFlyOnlyDraw = 0;
281 : :
282 : : //So the flys can also be painted right for the hack.
283 : : static sal_Bool bTableHack = sal_False;
284 : :
285 : : //To optimize the expensive RetouchColor determination
286 : 73 : Color aGlobalRetoucheColor;
287 : :
288 : : // Set borders alignment statics.
289 : : // adjustment for 'small' twip-to-pixel relations:
290 : : // For 'small' twip-to-pixel relations (less then 2:1)
291 : : // values of <nHalfPixelSzW> and <nHalfPixelSzH> are set to ZERO.
292 : 48285 : void SwCalcPixStatics( OutputDevice *pOut )
293 : : {
294 : : // determine 'small' twip-to-pixel relation
295 : 48285 : sal_Bool bSmallTwipToPxRelW = sal_False;
296 : 48285 : sal_Bool bSmallTwipToPxRelH = sal_False;
297 : : {
298 [ + - ]: 48285 : Size aCheckTwipToPxRelSz( pOut->PixelToLogic( Size( 100, 100 )) );
299 [ - + ]: 48285 : if ( (aCheckTwipToPxRelSz.Width()/100.0) < 2.0 )
300 : : {
301 : 0 : bSmallTwipToPxRelW = sal_True;
302 : : }
303 [ - + ]: 48285 : if ( (aCheckTwipToPxRelSz.Height()/100.0) < 2.0 )
304 : : {
305 : 0 : bSmallTwipToPxRelH = sal_True;
306 : : }
307 : : }
308 : :
309 [ + - ]: 48285 : Size aSz( pOut->PixelToLogic( Size( 1,1 )) );
310 : :
311 : 48285 : nPixelSzW = aSz.Width();
312 [ - + ]: 48285 : if( !nPixelSzW )
313 : 0 : nPixelSzW = 1;
314 : 48285 : nPixelSzH = aSz.Height();
315 [ - + ]: 48285 : if( !nPixelSzH )
316 : 0 : nPixelSzH = 1;
317 : :
318 : : // consider 'small' twip-to-pixel relations
319 [ + - ]: 48285 : if ( !bSmallTwipToPxRelW )
320 : : {
321 : 48285 : nHalfPixelSzW = nPixelSzW / 2 + 1;
322 : : }
323 : : else
324 : : {
325 : 0 : nHalfPixelSzW = 0;
326 : : }
327 : : // consider 'small' twip-to-pixel relations
328 [ + - ]: 48285 : if ( !bSmallTwipToPxRelH )
329 : : {
330 : 48285 : nHalfPixelSzH = nPixelSzH / 2 + 1;
331 : : }
332 : : else
333 : : {
334 : 0 : nHalfPixelSzH = 0;
335 : : }
336 : :
337 : 48285 : nMinDistPixelW = nPixelSzW * 2 + 1;
338 : 48285 : nMinDistPixelH = nPixelSzH * 2 + 1;
339 : :
340 : 48285 : const MapMode &rMap = pOut->GetMapMode();
341 [ + - ]: 48285 : aScaleX = rMap.GetScaleX();
342 [ + - ]: 48285 : aScaleY = rMap.GetScaleY();
343 : 48285 : }
344 : :
345 : : //To be able to save the statics so the paint is more or lees reentrant.
346 : : class SwSavePaintStatics
347 : : {
348 : : sal_Bool bSFlyMetafile,
349 : : bSPageOnly;
350 : : ViewShell *pSGlobalShell;
351 : : OutputDevice *pSFlyMetafileOut;
352 : : SwFlyFrm *pSRetoucheFly,
353 : : *pSRetoucheFly2,
354 : : *pSFlyOnlyDraw;
355 : : BorderLines *pBLines;
356 : : SwLineRects *pSLines;
357 : : SwSubsRects *pSSubsLines;
358 : : SwSubsRects* pSSpecSubsLines;
359 : : SfxProgress *pSProgress;
360 : : long nSPixelSzW,
361 : : nSPixelSzH,
362 : : nSHalfPixelSzW,
363 : : nSHalfPixelSzH,
364 : : nSMinDistPixelW,
365 : : nSMinDistPixelH;
366 : : Color aSGlobalRetoucheColor;
367 : : double aSScaleX,
368 : : aSScaleY;
369 : : public:
370 : : SwSavePaintStatics();
371 : : ~SwSavePaintStatics();
372 : : };
373 : :
374 : 0 : SwSavePaintStatics::SwSavePaintStatics() :
375 : : bSFlyMetafile ( bFlyMetafile ),
376 : : pSGlobalShell ( pGlobalShell ),
377 : : pSFlyMetafileOut ( pFlyMetafileOut ),
378 : : pSRetoucheFly ( pRetoucheFly ),
379 : : pSRetoucheFly2 ( pRetoucheFly2 ),
380 : : pSFlyOnlyDraw ( pFlyOnlyDraw ),
381 : : pBLines ( g_pBorderLines ),
382 : : pSLines ( pLines ),
383 : : pSSubsLines ( pSubsLines ),
384 : : pSSpecSubsLines ( pSpecSubsLines ),
385 : : pSProgress ( pProgress ),
386 : : nSPixelSzW ( nPixelSzW ),
387 : : nSPixelSzH ( nPixelSzH ),
388 : : nSHalfPixelSzW ( nHalfPixelSzW ),
389 : : nSHalfPixelSzH ( nHalfPixelSzH ),
390 : : nSMinDistPixelW ( nMinDistPixelW ),
391 : : nSMinDistPixelH ( nMinDistPixelH ),
392 : : aSGlobalRetoucheColor( aGlobalRetoucheColor ),
393 : : aSScaleX ( aScaleX ),
394 : 0 : aSScaleY ( aScaleY )
395 : : {
396 : 0 : bFlyMetafile = sal_False;
397 : 0 : pFlyMetafileOut = 0;
398 : 0 : pRetoucheFly = 0;
399 : 0 : pRetoucheFly2 = 0;
400 : : nPixelSzW = nPixelSzH =
401 : : nHalfPixelSzW = nHalfPixelSzH =
402 : 0 : nMinDistPixelW = nMinDistPixelH = 0;
403 : 0 : aScaleX = aScaleY = 1.0;
404 : 0 : aMinDistScale = 0.73;
405 : 0 : aEdgeScale = 0.5;
406 : 0 : g_pBorderLines = 0;
407 : 0 : pLines = 0;
408 : 0 : pSubsLines = 0;
409 : 0 : pSpecSubsLines = 0L;
410 : 0 : pProgress = 0;
411 : 0 : }
412 : :
413 : 0 : SwSavePaintStatics::~SwSavePaintStatics()
414 : : {
415 : 0 : pGlobalShell = pSGlobalShell;
416 : 0 : bFlyMetafile = bSFlyMetafile;
417 : 0 : pFlyMetafileOut = pSFlyMetafileOut;
418 : 0 : pRetoucheFly = pSRetoucheFly;
419 : 0 : pRetoucheFly2 = pSRetoucheFly2;
420 : 0 : pFlyOnlyDraw = pSFlyOnlyDraw;
421 : 0 : g_pBorderLines = pBLines;
422 : 0 : pLines = pSLines;
423 : 0 : pSubsLines = pSSubsLines;
424 : 0 : pSpecSubsLines = pSSpecSubsLines;
425 : 0 : pProgress = pSProgress;
426 : 0 : nPixelSzW = nSPixelSzW;
427 : 0 : nPixelSzH = nSPixelSzH;
428 : 0 : nHalfPixelSzW = nSHalfPixelSzW;
429 : 0 : nHalfPixelSzH = nSHalfPixelSzH;
430 : 0 : nMinDistPixelW = nSMinDistPixelW;
431 : 0 : nMinDistPixelH = nSMinDistPixelH;
432 : 0 : aGlobalRetoucheColor = aSGlobalRetoucheColor;
433 : 0 : aScaleX = aSScaleX;
434 : 0 : aScaleY = aSScaleY;
435 : 0 : }
436 : :
437 : : //----------------- Implementation for the table borders --------------
438 : :
439 : : static pair<bool, pair<double, double> >
440 : 0 : lcl_TryMergeLines(pair<double, double> const mergeA,
441 : : pair<double, double> const mergeB)
442 : : {
443 : 0 : double const fMergeGap(nPixelSzW + nHalfPixelSzW); // NOT static!
444 [ # # ][ # # ]: 0 : if ( (mergeA.second + fMergeGap >= mergeB.first )
445 : : && (mergeA.first - fMergeGap <= mergeB.second))
446 : : {
447 : : return make_pair(true, make_pair(
448 : 0 : std::min(mergeA.first, mergeB.first),
449 [ # # ]: 0 : std::max(mergeA.second, mergeB.second)));
450 : : }
451 [ # # ][ # # ]: 0 : return make_pair(false, make_pair(0, 0));
[ # # ]
452 : : }
453 : :
454 : : static ::rtl::Reference<BorderLinePrimitive2D>
455 : 0 : lcl_MergeBorderLines(
456 : : BorderLinePrimitive2D const& rLine, BorderLinePrimitive2D const& rOther,
457 : : basegfx::B2DPoint const& rStart, basegfx::B2DPoint const& rEnd)
458 : : {
459 : : return new BorderLinePrimitive2D(rStart, rEnd,
460 : : rLine.getLeftWidth(),
461 : : rLine.getDistance(),
462 : : rLine.getRightWidth(),
463 : : rLine.getExtendLeftStart(),
464 : : rOther.getExtendLeftEnd(),
465 : : rLine.getExtendRightStart(),
466 : : rOther.getExtendRightEnd(),
467 : : rLine.getRGBColorLeft(),
468 : : rLine.getRGBColorGap(),
469 : : rLine.getRGBColorRight(),
470 : 0 : rLine.hasGapColor(),
471 [ # # ]: 0 : rLine.getStyle());
472 : : }
473 : :
474 : : static ::rtl::Reference<BorderLinePrimitive2D>
475 : 1572 : lcl_TryMergeBorderLine(BorderLinePrimitive2D const& rThis,
476 : : BorderLinePrimitive2D const& rOther)
477 : : {
478 : : assert(rThis.getEnd().getX() >= rThis.getStart().getX());
479 : : assert(rThis.getEnd().getY() >= rThis.getStart().getY());
480 : : assert(rOther.getEnd().getX() >= rOther.getStart().getX());
481 : : assert(rOther.getEnd().getY() >= rOther.getStart().getY());
482 : 1572 : double thisHeight = rThis.getEnd().getY() - rThis.getStart().getY();
483 : 1572 : double thisWidth = rThis.getEnd().getX() - rThis.getStart().getX();
484 : 1572 : double otherHeight = rOther.getEnd().getY() - rOther.getStart().getY();
485 : 1572 : double otherWidth = rOther.getEnd().getX() - rOther.getStart().getX();
486 : : // check for same orientation, same line width and matching colors
487 [ - + ][ + + : 2096 : if ( ((thisHeight > thisWidth) == (otherHeight > otherWidth))
- + # # #
# # # # #
# # # # #
# ]
488 : 524 : && (rThis.getLeftWidth() == rOther.getLeftWidth())
489 : 0 : && (rThis.getDistance() == rOther.getDistance())
490 : 0 : && (rThis.getRightWidth() == rOther.getRightWidth())
491 : 0 : && (rThis.getRGBColorLeft() == rOther.getRGBColorLeft())
492 : 0 : && (rThis.getRGBColorRight() == rOther.getRGBColorRight())
493 : 0 : && (rThis.hasGapColor() == rOther.hasGapColor())
494 : 0 : && (!rThis.hasGapColor() ||
495 : 0 : (rThis.getRGBColorGap() == rOther.getRGBColorGap())))
496 : : {
497 [ # # ]: 0 : if (thisHeight > thisWidth) // vertical line
498 : : {
499 [ # # ]: 0 : if (rThis.getStart().getX() == rOther.getStart().getX())
500 : : {
501 : : assert(rThis.getEnd().getX() == rOther.getEnd().getX());
502 : : pair<bool, pair<double, double> > const res = lcl_TryMergeLines(
503 : 0 : make_pair(rThis.getStart().getY(), rThis.getEnd().getY()),
504 [ # # # # ]: 0 : make_pair(rOther.getStart().getY(),rOther.getEnd().getY()));
[ # # ]
505 [ # # ]: 0 : if (res.first) // merge them
506 : : {
507 : : basegfx::B2DPoint const start(
508 : 0 : rThis.getStart().getX(), res.second.first);
509 : : basegfx::B2DPoint const end(
510 : 0 : rThis.getStart().getX(), res.second.second);
511 [ # # ]: 0 : return lcl_MergeBorderLines(rThis, rOther, start, end);
512 : : }
513 : : }
514 : : }
515 : : else // horizontal line
516 : : {
517 [ # # ]: 0 : if (rThis.getStart().getY() == rOther.getStart().getY())
518 : : {
519 : : assert(rThis.getEnd().getY() == rOther.getEnd().getY());
520 : : pair<bool, pair<double, double> > const res = lcl_TryMergeLines(
521 : 0 : make_pair(rThis.getStart().getX(), rThis.getEnd().getX()),
522 [ # # # # ]: 0 : make_pair(rOther.getStart().getX(),rOther.getEnd().getX()));
[ # # ]
523 [ # # ]: 0 : if (res.first) // merge them
524 : : {
525 : : basegfx::B2DPoint const start(
526 : 0 : res.second.first, rThis.getStart().getY());
527 : : basegfx::B2DPoint const end(
528 : 0 : res.second.second, rThis.getEnd().getY());
529 [ # # ]: 0 : return lcl_MergeBorderLines(rThis, rOther, start, end);
530 : : }
531 : : }
532 : : }
533 : : }
534 : 1572 : return 0;
535 : : }
536 : :
537 : 1054 : void BorderLines::AddBorderLine(
538 : : rtl::Reference<BorderLinePrimitive2D> const& xLine)
539 : : {
540 [ + - ][ + - ]: 2626 : for (Lines_t::reverse_iterator it = m_Lines.rbegin(); it != m_Lines.rend();
[ + + ]
541 : : ++it)
542 : : {
543 : : ::rtl::Reference<BorderLinePrimitive2D> const xMerged =
544 [ + - ][ + - ]: 1572 : lcl_TryMergeBorderLine(**it, *xLine);
545 [ - + ]: 1572 : if (xMerged.is())
546 : : {
547 [ # # ][ # # ]: 1572 : *it = xMerged; // replace existing line with merged
548 : 1054 : return;
549 : : }
550 [ + - ]: 1572 : }
551 : 1054 : m_Lines.push_back(xLine);
552 : : }
553 : :
554 : :
555 : 3343 : SwLineRect::SwLineRect( const SwRect &rRect, const Color *pCol, const SvxBorderStyle nStyl,
556 : : const SwTabFrm *pT, const sal_uInt8 nSCol ) :
557 : : SwRect( rRect ),
558 : : nStyle( nStyl ),
559 : : pTab( pT ),
560 : : nSubColor( nSCol ),
561 : : bPainted( sal_False ),
562 : 3343 : nLock( 0 )
563 : : {
564 [ - + ]: 3343 : if ( pCol != NULL )
565 : 0 : aColor = *pCol;
566 : 3343 : }
567 : :
568 : 0 : sal_Bool SwLineRect::MakeUnion( const SwRect &rRect )
569 : : {
570 : : // It has already been tested outside, whether the rectangles have
571 : : // the same orientation (horizontal or vertical), color, etc.
572 [ # # ]: 0 : if ( Height() > Width() ) //Vertical line
573 : : {
574 [ # # ][ # # ]: 0 : if ( Left() == rRect.Left() && Width() == rRect.Width() )
[ # # ]
575 : : {
576 : : // Merge when there is no gap between the lines
577 : 0 : const long nAdd = nPixelSzW + nHalfPixelSzW;
578 [ # # # # ]: 0 : if ( Bottom() + nAdd >= rRect.Top() &&
[ # # ]
579 : 0 : Top() - nAdd <= rRect.Bottom() )
580 : : {
581 : 0 : Bottom( Max( Bottom(), rRect.Bottom() ) );
582 : 0 : Top ( Min( Top(), rRect.Top() ) );
583 : 0 : return sal_True;
584 : : }
585 : : }
586 : : }
587 : : else
588 : : {
589 [ # # ][ # # ]: 0 : if ( Top() == rRect.Top() && Height() == rRect.Height() )
[ # # ]
590 : : {
591 : : // Merge when there is no gap between the lines
592 : 0 : const long nAdd = nPixelSzW + nHalfPixelSzW;
593 [ # # # # ]: 0 : if ( Right() + nAdd >= rRect.Left() &&
[ # # ]
594 : 0 : Left() - nAdd <= rRect.Right() )
595 : : {
596 : 0 : Right( Max( Right(), rRect.Right() ) );
597 : 0 : Left ( Min( Left(), rRect.Left() ) );
598 : 0 : return sal_True;
599 : : }
600 : : }
601 : : }
602 : 0 : return sal_False;
603 : : }
604 : :
605 : 3343 : void SwLineRects::AddLineRect( const SwRect &rRect, const Color *pCol, const SvxBorderStyle nStyle,
606 : : const SwTabFrm *pTab, const sal_uInt8 nSCol )
607 : : {
608 : : //Rueckwaerts durch, weil Linien die zusammengefasst werden koennen i.d.R.
609 : : //im gleichen Kontext gepaintet werden.
610 : :
611 : : //Loop backwards because lines which can be combined, can usually be painted
612 : : //in the same context.
613 : :
614 [ + - ][ + - ]: 29963 : for (SwLineRects::reverse_iterator it = this->rbegin(); it != this->rend();
[ + + ]
615 : : ++it)
616 : : {
617 [ + - ]: 26620 : SwLineRect &rLRect = (*it);
618 : : // Test for the orientation, color, table
619 [ + - + + : 118708 : if ( rLRect.GetTab() == pTab &&
+ - + + -
+ ]
[ # # + - ]
[ - + # # ]
[ - + ]
620 : 48984 : !rLRect.IsPainted() && rLRect.GetSubColor() == nSCol &&
621 : 22364 : (rLRect.Height() > rLRect.Width()) == (rRect.Height() > rRect.Width()) &&
622 : 10370 : ((!rLRect.GetColor() && !pCol) ||
623 : 10370 : (rLRect.GetColor() && pCol && *rLRect.GetColor() == *pCol)) )
624 : : {
625 [ # # ][ # # ]: 0 : if ( rLRect.MakeUnion( rRect ) )
626 : 3343 : return;
627 : : }
628 : : }
629 [ + - ]: 3343 : this->push_back( SwLineRect( rRect, pCol, nStyle, pTab, nSCol ) );
630 : : }
631 : :
632 : 0 : void SwLineRects::ConnectEdges( OutputDevice *pOut )
633 : : {
634 [ # # ]: 0 : if ( pOut->GetOutDevType() != OUTDEV_PRINTER )
635 : : {
636 : : // I'm not doing anything for a too small zoom
637 [ # # ][ # # ]: 0 : if ( aScaleX < aEdgeScale || aScaleY < aEdgeScale )
638 : 0 : return;
639 : : }
640 : :
641 : : static const long nAdd = 20;
642 : :
643 [ # # ]: 0 : std::vector<SwLineRect*> aCheck;
644 : :
645 [ # # ]: 0 : for (size_t i = 0; i < this->size(); ++i)
646 : : {
647 : 0 : SwLineRect &rL1 = (*this)[i];
648 [ # # ][ # # ]: 0 : if ( !rL1.GetTab() || rL1.IsPainted() || rL1.IsLocked() )
[ # # ][ # # ]
649 : 0 : continue;
650 : :
651 : 0 : aCheck.clear();
652 : :
653 : 0 : const sal_Bool bVert = rL1.Height() > rL1.Width();
654 : : long nL1a, nL1b, nL1c, nL1d;
655 : :
656 [ # # ]: 0 : if ( bVert )
657 : : {
658 : 0 : nL1a = rL1.Top(); nL1b = rL1.Left();
659 : 0 : nL1c = rL1.Right(); nL1d = rL1.Bottom();
660 : : }
661 : : else
662 : : {
663 : 0 : nL1a = rL1.Left(); nL1b = rL1.Top();
664 : 0 : nL1c = rL1.Bottom(); nL1d = rL1.Right();
665 : : }
666 : :
667 : : // Collect all lines to possibly link with i1
668 [ # # ][ # # ]: 0 : for (SwLineRects::iterator it2 = this->begin(); it2 != this->end(); ++it2)
669 : : {
670 : 0 : SwLineRect &rL2 = (*it2);
671 [ # # ][ # # : 0 : if ( rL2.GetTab() != rL1.GetTab() ||
# # # # #
# ]
672 : 0 : rL2.IsPainted() ||
673 : 0 : rL2.IsLocked() ||
674 : 0 : (bVert == (rL2.Height() > rL2.Width())) )
675 : 0 : continue;
676 : :
677 : : long nL2a, nL2b, nL2c, nL2d;
678 [ # # ]: 0 : if ( bVert )
679 : : {
680 : 0 : nL2a = rL2.Top(); nL2b = rL2.Left();
681 : 0 : nL2c = rL2.Right(); nL2d = rL2.Bottom();
682 : : }
683 : : else
684 : : {
685 : 0 : nL2a = rL2.Left(); nL2b = rL2.Top();
686 : 0 : nL2c = rL2.Bottom(); nL2d = rL2.Right();
687 : : }
688 : :
689 [ # # ][ # # ]: 0 : if ( (nL1a - nAdd < nL2d && nL1d + nAdd > nL2a) &&
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
690 : : ((nL1b > nL2b && nL1c < nL2c) ||
691 : : (nL1c >= nL2c && nL1b - nAdd < nL2c) ||
692 : : (nL1b <= nL2b && nL1c + nAdd > nL2b)) )
693 : : {
694 [ # # ]: 0 : aCheck.push_back( &rL2 );
695 : : }
696 : : }
697 [ # # ]: 0 : if ( aCheck.size() < 2 )
698 : 0 : continue;
699 : :
700 : 0 : sal_Bool bRemove = sal_False;
701 : :
702 : : // For each line test all following ones.
703 [ # # ][ # # ]: 0 : for ( sal_uInt16 k = 0; !bRemove && k < aCheck.size(); ++k )
[ # # ]
704 : : {
705 : 0 : SwLineRect &rR1 = *aCheck[k];
706 : :
707 [ # # ][ # # ]: 0 : for ( sal_uInt16 k2 = k+1; !bRemove && k2 < aCheck.size(); ++k2 )
[ # # ]
708 : : {
709 : 0 : SwLineRect &rR2 = *aCheck[k2];
710 [ # # ]: 0 : if ( bVert )
711 : : {
712 : 0 : SwLineRect *pLA = 0;
713 : 0 : SwLineRect *pLB = 0;
714 [ # # ]: 0 : if ( rR1.Top() < rR2.Top() )
715 : : {
716 : 0 : pLA = &rR1; pLB = &rR2;
717 : : }
718 [ # # ]: 0 : else if ( rR1.Top() > rR2.Top() )
719 : : {
720 : 0 : pLA = &rR2; pLB = &rR1;
721 : : }
722 : : // are k1 and k2 describing a double line?
723 [ # # ][ # # ]: 0 : if ( pLA && pLA->Bottom() + 60 > pLB->Top() )
[ # # ]
724 : : {
725 [ # # ]: 0 : if ( rL1.Top() < pLA->Top() )
726 : : {
727 [ # # ]: 0 : if ( rL1.Bottom() == pLA->Bottom() )
728 : 0 : continue; //Small mistake (where?)
729 : :
730 : 0 : SwRect aIns( rL1 );
731 : 0 : aIns.Bottom( pLA->Bottom() );
732 [ # # ][ # # ]: 0 : if ( !rL1.IsInside( aIns ) )
733 : 0 : continue;
734 : : this->push_back( SwLineRect( aIns, rL1.GetColor(),
735 : : table::BorderLineStyle::SOLID,
736 [ # # ]: 0 : rL1.GetTab(), SUBCOL_TAB ) );
737 [ # # ]: 0 : if ( isFull() )
738 : : {
739 : 0 : --i;
740 : 0 : k = aCheck.size();
741 : : break;
742 : : }
743 : : }
744 : :
745 [ # # ]: 0 : if ( rL1.Bottom() > pLB->Bottom() )
746 : 0 : rL1.Top( pLB->Top() ); // extend i1 on the top
747 : : else
748 : 0 : bRemove = sal_True; //stopping, remove i1
749 : : }
750 : : }
751 : : else
752 : : {
753 : 0 : SwLineRect *pLA = 0;
754 : 0 : SwLineRect *pLB = 0;
755 [ # # ]: 0 : if ( rR1.Left() < rR2.Left() )
756 : : {
757 : 0 : pLA = &rR1; pLB = &rR2;
758 : : }
759 [ # # ]: 0 : else if ( rR1.Left() > rR2.Left() )
760 : : {
761 : 0 : pLA = &rR2; pLB = &rR1;
762 : : }
763 : : // Is it double line?
764 [ # # ][ # # ]: 0 : if ( pLA && pLA->Right() + 60 > pLB->Left() )
[ # # ]
765 : : {
766 [ # # ]: 0 : if ( rL1.Left() < pLA->Left() )
767 : : {
768 [ # # ]: 0 : if ( rL1.Right() == pLA->Right() )
769 : 0 : continue; //small error
770 : :
771 : 0 : SwRect aIns( rL1 );
772 : 0 : aIns.Right( pLA->Right() );
773 [ # # ][ # # ]: 0 : if ( !rL1.IsInside( aIns ) )
774 : 0 : continue;
775 : : this->push_back( SwLineRect( aIns, rL1.GetColor(),
776 : : table::BorderLineStyle::SOLID,
777 [ # # ]: 0 : rL1.GetTab(), SUBCOL_TAB ) );
778 [ # # ]: 0 : if ( isFull() )
779 : : {
780 : 0 : --i;
781 : 0 : k = aCheck.size();
782 : : break;
783 : : }
784 : : }
785 [ # # ]: 0 : if ( rL1.Right() > pLB->Right() )
786 : 0 : rL1.Left( pLB->Left() );
787 : : else
788 : 0 : bRemove = sal_True;
789 : : }
790 : : }
791 : : }
792 : : }
793 [ # # ]: 0 : if ( bRemove )
794 : : {
795 [ # # ][ # # ]: 0 : this->erase(this->begin() + i);
796 : 0 : --i;
797 : : }
798 : 0 : }
799 : : }
800 : :
801 : : inline void SwSubsRects::Ins( const SwRect &rRect, const sal_uInt8 nSCol )
802 : : {
803 : : // Lines that are shorted than the largest line width won't be inserted
804 : : if ( rRect.Height() > DEF_LINE_WIDTH_4 || rRect.Width() > DEF_LINE_WIDTH_4 )
805 : : {
806 : : this->push_back(
807 : : SwLineRect(rRect, 0, table::BorderLineStyle::SOLID, 0, nSCol));
808 : : }
809 : : }
810 : :
811 : 0 : void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects )
812 : : {
813 : : // All help lines that are covered by any border will be removed or split
814 : :
815 [ # # ]: 0 : for (size_t i = 0; i < this->size(); ++i)
816 : : {
817 : : // get a copy instead of a reference, because an <insert> may destroy
818 : : // the object due to a necessary array resize.
819 : 0 : const SwLineRect aSubsLineRect = SwLineRect((*this)[i]);
820 : :
821 : : // add condition <aSubsLineRect.IsLocked()> in order to consider only
822 : : // border lines, which are *not* locked.
823 [ # # ]: 0 : if ( aSubsLineRect.IsPainted() ||
[ # # # # ]
824 : 0 : aSubsLineRect.IsLocked() )
825 : 0 : continue;
826 : :
827 : 0 : const bool bVerticalSubs = aSubsLineRect.Height() > aSubsLineRect.Width();
828 : 0 : SwRect aSubsRect( aSubsLineRect );
829 [ # # ]: 0 : if ( bVerticalSubs )
830 : : {
831 : 0 : aSubsRect.Left ( aSubsRect.Left() - (nPixelSzW+nHalfPixelSzW) );
832 : 0 : aSubsRect.Right ( aSubsRect.Right() + (nPixelSzW+nHalfPixelSzW) );
833 : : }
834 : : else
835 : : {
836 : 0 : aSubsRect.Top ( aSubsRect.Top() - (nPixelSzH+nHalfPixelSzH) );
837 : 0 : aSubsRect.Bottom( aSubsRect.Bottom() + (nPixelSzH+nHalfPixelSzH) );
838 : : }
839 [ # # ][ # # ]: 0 : for (SwLineRects::const_iterator itK = rRects.begin(); itK != rRects.end(); ++itK)
840 : : {
841 : 0 : const SwLineRect &rLine = *itK;
842 : :
843 : : // do *not* consider painted or locked border lines.
844 : : // #i1837# - locked border lines have to be considered.
845 [ # # ]: 0 : if ( rLine.IsLocked () )
846 : 0 : continue;
847 : :
848 [ # # ]: 0 : if ( !bVerticalSubs == ( rLine.Height() > rLine.Width() ) ) //same direction?
849 : 0 : continue;
850 : :
851 [ # # ][ # # ]: 0 : if ( aSubsRect.IsOver( rLine ) )
852 : : {
853 [ # # ]: 0 : if ( bVerticalSubs ) // Vertical?
854 : : {
855 [ # # # # ]: 0 : if ( aSubsRect.Left() <= rLine.Right() &&
[ # # ]
856 : 0 : aSubsRect.Right() >= rLine.Left() )
857 : : {
858 : 0 : long nTmp = rLine.Top()-(nPixelSzH+1);
859 [ # # ]: 0 : if ( aSubsLineRect.Top() < nTmp )
860 : : {
861 : 0 : SwRect aNewSubsRect( aSubsLineRect );
862 : 0 : aNewSubsRect.Bottom( nTmp );
863 : 0 : this->push_back( SwLineRect( aNewSubsRect, 0, aSubsLineRect.GetStyle(), 0,
864 [ # # ]: 0 : aSubsLineRect.GetSubColor() ) );
865 : : }
866 : 0 : nTmp = rLine.Bottom()+nPixelSzH+1;
867 [ # # ]: 0 : if ( aSubsLineRect.Bottom() > nTmp )
868 : : {
869 : 0 : SwRect aNewSubsRect( aSubsLineRect );
870 : 0 : aNewSubsRect.Top( nTmp );
871 : 0 : this->push_back( SwLineRect( aNewSubsRect, 0, aSubsLineRect.GetStyle(), 0,
872 [ # # ]: 0 : aSubsLineRect.GetSubColor() ) );
873 : : }
874 [ # # ][ # # ]: 0 : this->erase(this->begin() + i);
875 : 0 : --i;
876 : 0 : break;
877 : : }
878 : : }
879 : : else //horizontal
880 : : {
881 [ # # # # ]: 0 : if ( aSubsRect.Top() <= rLine.Bottom() &&
[ # # ]
882 : 0 : aSubsRect.Bottom() >= rLine.Top() )
883 : : {
884 : 0 : long nTmp = rLine.Left()-(nPixelSzW+1);
885 [ # # ]: 0 : if ( aSubsLineRect.Left() < nTmp )
886 : : {
887 : 0 : SwRect aNewSubsRect( aSubsLineRect );
888 : 0 : aNewSubsRect.Right( nTmp );
889 : 0 : this->push_back( SwLineRect( aNewSubsRect, 0, aSubsLineRect.GetStyle(), 0,
890 [ # # ]: 0 : aSubsLineRect.GetSubColor() ) );
891 : : }
892 : 0 : nTmp = rLine.Right()+nPixelSzW+1;
893 [ # # ]: 0 : if ( aSubsLineRect.Right() > nTmp )
894 : : {
895 : 0 : SwRect aNewSubsRect( aSubsLineRect );
896 : 0 : aNewSubsRect.Left( nTmp );
897 : 0 : this->push_back( SwLineRect( aNewSubsRect, 0, aSubsLineRect.GetStyle(), 0,
898 [ # # ]: 0 : aSubsLineRect.GetSubColor() ) );
899 : : }
900 [ # # ][ # # ]: 0 : this->erase(this->begin() + i);
901 : 0 : --i;
902 : 0 : break;
903 : : }
904 : : }
905 : : }
906 : : }
907 : : }
908 : 0 : }
909 : :
910 : 26518 : void SwLineRects::LockLines( sal_Bool bLock )
911 : : {
912 [ + - ][ + + ]: 35608 : for (SwLineRects::iterator it = this->begin(); it != this->end(); ++it)
913 : 9090 : (*it).Lock( bLock );
914 : 26518 : }
915 : :
916 : 0 : void lcl_DrawDashedRect( OutputDevice * pOut, SwLineRect & rLRect )
917 : : {
918 : 0 : double nHalfLWidth = rLRect.Height( );
919 [ # # ]: 0 : if ( nHalfLWidth > 1 )
920 : : {
921 : 0 : nHalfLWidth = nHalfLWidth / 2;
922 : : }
923 : : else
924 : : {
925 : 0 : nHalfLWidth = 1;
926 : : }
927 : :
928 : 0 : long startX = rLRect.Left( );
929 : 0 : long startY = rLRect.Top( ) + static_cast<long>(nHalfLWidth);
930 : 0 : long endX = rLRect.Left( ) + rLRect.Width( );
931 : 0 : long endY = rLRect.Top( ) + static_cast<long>(nHalfLWidth);
932 : :
933 [ # # ]: 0 : if ( rLRect.Height( ) > rLRect.Width( ) )
934 : : {
935 : 0 : nHalfLWidth = rLRect.Width( );
936 [ # # ]: 0 : if ( nHalfLWidth > 1 )
937 : : {
938 : 0 : nHalfLWidth = nHalfLWidth / 2;
939 : : }
940 : : else
941 : : {
942 : 0 : nHalfLWidth = 1;
943 : : }
944 : 0 : startX = rLRect.Left( ) + static_cast<long>(nHalfLWidth);
945 : 0 : startY = rLRect.Top( );
946 : 0 : endX = rLRect.Left( ) + static_cast<long>(nHalfLWidth);
947 : 0 : endY = rLRect.Top( ) + rLRect.Height( );
948 : : }
949 : :
950 : : svtools::DrawLine( *pOut, Point( startX, startY ), Point( endX, endY ),
951 [ # # ]: 0 : sal_uInt32( nHalfLWidth * 2 ), rLRect.GetStyle( ) );
952 : 0 : }
953 : :
954 : 25052 : void SwLineRects::PaintLines( OutputDevice *pOut )
955 : : {
956 : : // Paint the borders. Sadly two passes are needed.
957 : : // Once for the inside and once for the outside edges of tables
958 [ - + ]: 25052 : if ( this->size() != nLastCount )
959 : : {
960 : : // #i16816# tagged pdf support
961 [ # # ]: 0 : SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, *pOut );
962 : :
963 [ # # ]: 0 : pOut->Push( PUSH_FILLCOLOR|PUSH_LINECOLOR );
964 [ # # ]: 0 : pOut->SetFillColor();
965 [ # # ]: 0 : pOut->SetLineColor();
966 [ # # ]: 0 : ConnectEdges( pOut );
967 : 0 : const Color *pLast = 0;
968 : :
969 : 0 : sal_Bool bPaint2nd = sal_False;
970 : 0 : size_t nMinCount = this->size();
971 : :
972 [ # # ]: 0 : for ( size_t i = 0; i < size(); ++i )
973 : : {
974 : 0 : SwLineRect &rLRect = operator[](i);
975 : :
976 [ # # ]: 0 : if ( rLRect.IsPainted() )
977 : 0 : continue;
978 : :
979 [ # # ]: 0 : if ( rLRect.IsLocked() )
980 : : {
981 : 0 : nMinCount = Min( nMinCount, i );
982 : 0 : continue;
983 : : }
984 : :
985 : : // Paint it now or in the second pass?
986 : 0 : sal_Bool bPaint = sal_True;
987 [ # # ]: 0 : if ( rLRect.GetTab() )
988 : : {
989 [ # # ]: 0 : if ( rLRect.Height() > rLRect.Width() )
990 : : {
991 : : // Vertical edge, overlapping with the table edge?
992 : 0 : SwTwips nLLeft = rLRect.Left() - 30,
993 : 0 : nLRight = rLRect.Right() + 30,
994 : 0 : nTLeft = rLRect.GetTab()->Frm().Left() + rLRect.GetTab()->Prt().Left(),
995 : 0 : nTRight = rLRect.GetTab()->Frm().Left() + rLRect.GetTab()->Prt().Right();
996 [ # # ][ # # ]: 0 : if ( (nTLeft >= nLLeft && nTLeft <= nLRight) ||
[ # # ][ # # ]
997 : : (nTRight>= nLLeft && nTRight<= nLRight) )
998 : 0 : bPaint = sal_False;
999 : : }
1000 : : else
1001 : : {
1002 : : // Horizontal edge, overlapping with the table edge?
1003 : 0 : SwTwips nLTop = rLRect.Top() - 30,
1004 : 0 : nLBottom = rLRect.Bottom() + 30,
1005 : 0 : nTTop = rLRect.GetTab()->Frm().Top() + rLRect.GetTab()->Prt().Top(),
1006 : 0 : nTBottom = rLRect.GetTab()->Frm().Top() + rLRect.GetTab()->Prt().Bottom();
1007 [ # # ][ # # ]: 0 : if ( (nTTop >= nLTop && nTTop <= nLBottom) ||
[ # # ][ # # ]
1008 : : (nTBottom >= nLTop && nTBottom <= nLBottom) )
1009 : 0 : bPaint = sal_False;
1010 : : }
1011 : : }
1012 [ # # ]: 0 : if ( bPaint )
1013 : : {
1014 [ # # ][ # # ]: 0 : if ( !pLast || *pLast != *rLRect.GetColor() )
[ # # ]
1015 : : {
1016 : 0 : pLast = rLRect.GetColor();
1017 : :
1018 : 0 : sal_uLong nOldDrawMode = pOut->GetDrawMode();
1019 [ # # ]: 0 : if( pGlobalShell->GetWin() &&
[ # # # # ]
1020 [ # # ]: 0 : Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
1021 [ # # ]: 0 : pOut->SetDrawMode( 0 );
1022 : :
1023 [ # # ]: 0 : pOut->SetLineColor( *pLast );
1024 [ # # ]: 0 : pOut->SetFillColor( *pLast );
1025 [ # # ]: 0 : pOut->SetDrawMode( nOldDrawMode );
1026 : : }
1027 : :
1028 [ # # ]: 0 : if( !rLRect.IsEmpty() )
1029 [ # # ]: 0 : lcl_DrawDashedRect( pOut, rLRect );
1030 : 0 : rLRect.SetPainted();
1031 : : }
1032 : : else
1033 : 0 : bPaint2nd = sal_True;
1034 : : }
1035 [ # # ]: 0 : if ( bPaint2nd )
1036 : : {
1037 [ # # ]: 0 : for ( size_t i = 0; i < size(); ++i )
1038 : : {
1039 : 0 : SwLineRect &rLRect = operator[](i);
1040 [ # # ]: 0 : if ( rLRect.IsPainted() )
1041 : 0 : continue;
1042 : :
1043 [ # # ]: 0 : if ( rLRect.IsLocked() )
1044 : : {
1045 : 0 : nMinCount = Min( nMinCount, i );
1046 : 0 : continue;
1047 : : }
1048 : :
1049 [ # # ][ # # ]: 0 : if ( !pLast || *pLast != *rLRect.GetColor() )
[ # # ]
1050 : : {
1051 : 0 : pLast = rLRect.GetColor();
1052 : :
1053 : 0 : sal_uLong nOldDrawMode = pOut->GetDrawMode();
1054 [ # # ]: 0 : if( pGlobalShell->GetWin() &&
[ # # # # ]
1055 [ # # ]: 0 : Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
1056 : : {
1057 [ # # ]: 0 : pOut->SetDrawMode( 0 );
1058 : : }
1059 : :
1060 [ # # ]: 0 : pOut->SetFillColor( *pLast );
1061 [ # # ]: 0 : pOut->SetDrawMode( nOldDrawMode );
1062 : : }
1063 [ # # ]: 0 : if( !rLRect.IsEmpty() )
1064 [ # # ]: 0 : lcl_DrawDashedRect( pOut, rLRect );
1065 : 0 : rLRect.SetPainted();
1066 : : }
1067 : : }
1068 : 0 : nLastCount = nMinCount;
1069 [ # # ][ # # ]: 0 : pOut->Pop();
1070 : : }
1071 : 25052 : }
1072 : :
1073 : 25490 : void SwSubsRects::PaintSubsidiary( OutputDevice *pOut,
1074 : : const SwLineRects *pRects )
1075 : : {
1076 [ + + ]: 25490 : if ( !this->empty() )
1077 : : {
1078 : : // #i16816# tagged pdf support
1079 [ + - ]: 717 : SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, *pOut );
1080 : :
1081 : : // Remove all help line that are almost covered (tables)
1082 [ + + ]: 9062 : for (SwSubsRects::size_type i = 0; i != this->size(); ++i)
1083 : : {
1084 : 8345 : SwLineRect &rLi = (*this)[i];
1085 : 8345 : const bool bVerticalSubs = rLi.Height() > rLi.Width();
1086 : :
1087 [ + + ]: 134335 : for (SwSubsRects::size_type k = i + 1; k != this->size(); ++k)
1088 : : {
1089 : 126033 : SwLineRect &rLk = (*this)[k];
1090 [ + + ]: 126033 : if ( rLi.SSize() == rLk.SSize() )
1091 : : {
1092 [ + - ]: 12796 : if ( bVerticalSubs == ( rLk.Height() > rLk.Width() ) )
1093 : : {
1094 [ + + ]: 12796 : if ( bVerticalSubs )
1095 : : {
1096 : 7254 : long nLi = rLi.Right();
1097 : 7254 : long nLk = rLk.Right();
1098 [ - + ][ + + : 21936 : if ( rLi.Top() == rLk.Top() &&
+ + + - +
+ - + ]
1099 : 8466 : ((nLi < rLk.Left() && nLi+21 > rLk.Left()) ||
1100 : 6216 : (nLk < rLi.Left() && nLk+21 > rLi.Left())))
1101 : : {
1102 [ # # ][ # # ]: 0 : this->erase(this->begin() + k);
1103 : : // don't continue with inner loop any more:
1104 : : // the array may shrink!
1105 : 0 : --i;
1106 : 0 : break;
1107 : : }
1108 : : }
1109 : : else
1110 : : {
1111 : 5542 : long nLi = rLi.Bottom();
1112 : 5542 : long nLk = rLk.Bottom();
1113 [ + + ][ + + : 19563 : if ( rLi.Left() == rLk.Left() &&
+ + + + +
+ - + ]
1114 : 8154 : ((nLi < rLk.Top() && nLi+21 > rLk.Top()) ||
1115 : 5867 : (nLk < rLi.Top() && nLk+21 > rLi.Top())))
1116 : : {
1117 [ + - ][ + - ]: 43 : this->erase(this->begin() + k);
1118 : : // don't continue with inner loop any more:
1119 : : // the array may shrink!
1120 : 43 : --i;
1121 : 43 : break;
1122 : : }
1123 : : }
1124 : : }
1125 : : }
1126 : : }
1127 : : }
1128 : :
1129 [ + + ][ - + ]: 717 : if ( pRects && (!pRects->empty()) )
[ - + ]
1130 [ # # ]: 0 : RemoveSuperfluousSubsidiaryLines( *pRects );
1131 : :
1132 [ + - ]: 717 : if ( !this->empty() )
1133 : : {
1134 [ + - ]: 717 : pOut->Push( PUSH_FILLCOLOR|PUSH_LINECOLOR );
1135 [ + - ]: 717 : pOut->SetLineColor();
1136 : :
1137 : : // Reset draw mode in high contrast mode in order to get fill color
1138 : : // set at output device. Recover draw mode after draw of lines.
1139 : : // Necessary for the subsidiary lines painted by the fly frames.
1140 : 717 : sal_uLong nOldDrawMode = pOut->GetDrawMode();
1141 [ - + ]: 1434 : if( pGlobalShell->GetWin() &&
[ + - - + ]
1142 [ + - ]: 717 : Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
1143 : : {
1144 [ # # ]: 0 : pOut->SetDrawMode( 0 );
1145 : : }
1146 : :
1147 [ + - ][ + + ]: 9019 : for (SwSubsRects::iterator it = this->begin(); it != this->end();
1148 : : ++it)
1149 : : {
1150 : 8302 : SwLineRect &rLRect = (*it);
1151 : : // Add condition <!rLRect.IsLocked()> to prevent paint of locked subsidiary lines.
1152 [ + + ]: 14620 : if ( !rLRect.IsPainted() &&
[ + + + + ]
1153 : 6318 : !rLRect.IsLocked() )
1154 : : {
1155 : 3300 : const Color *pCol = 0;
1156 [ - + - + : 3300 : switch ( rLRect.GetSubColor() )
- ]
1157 : : {
1158 [ # # ]: 0 : case SUBCOL_PAGE: pCol = &SwViewOption::GetDocBoundariesColor(); break;
1159 [ + - ]: 2734 : case SUBCOL_FLY: pCol = &SwViewOption::GetObjectBoundariesColor(); break;
1160 [ # # ]: 0 : case SUBCOL_TAB: pCol = &SwViewOption::GetTableBoundariesColor(); break;
1161 [ + - ]: 566 : case SUBCOL_SECT: pCol = &SwViewOption::GetSectionBoundColor(); break;
1162 : : }
1163 : :
1164 [ + + ]: 3300 : if ( pOut->GetFillColor() != *pCol )
1165 [ + - ]: 714 : pOut->SetFillColor( *pCol );
1166 [ + - ][ + - ]: 3300 : pOut->DrawRect( rLRect.SVRect() );
1167 : :
1168 : 3300 : rLRect.SetPainted();
1169 : : }
1170 : : }
1171 : :
1172 [ + - ]: 717 : pOut->SetDrawMode( nOldDrawMode );
1173 : :
1174 [ + - ]: 717 : pOut->Pop();
1175 [ + - ]: 717 : }
1176 : : }
1177 : 25490 : }
1178 : :
1179 : : //-------------------------------------------------------------------------
1180 : : //Diverse Functions die in diesem File so verwendet werden.
1181 : :
1182 : : // Note: function <SwAlignRect(..)> also used outside this file.
1183 : : // Correction: adjust rectangle on pixel level in order
1184 : : // to assure, that the border 'leaves its original pixel', if it has to.
1185 : : // No prior adjustments for odd relation between pixel and twip.
1186 : 156092 : void SwAlignRect( SwRect &rRect, const ViewShell *pSh )
1187 : : {
1188 [ + - ][ + + ]: 156092 : if( !rRect.HasArea() )
1189 : : return;
1190 : :
1191 : : // Assure that view shell (parameter <pSh>) exists, if the output device
1192 : : // is taken from this view shell --> no output device, no alignment.
1193 : : // Output device taken from view shell <pSh>, if <bFlyMetafile> not set.
1194 [ + - ][ + - ]: 156060 : if ( !bFlyMetafile && !pSh )
1195 : : {
1196 : : return;
1197 : : }
1198 : :
1199 : : const OutputDevice *pOut = bFlyMetafile ?
1200 [ + - ]: 156060 : pFlyMetafileOut : pSh->GetOut();
1201 : :
1202 : : // Hold original rectangle in pixel
1203 [ + - ][ + - ]: 156060 : const Rectangle aOrgPxRect = pOut->LogicToPixel( rRect.SVRect() );
1204 : : // Determine pixel-center rectangle in twip
1205 [ + - ][ + - ]: 156060 : const SwRect aPxCenterRect( pOut->PixelToLogic( aOrgPxRect ) );
1206 : :
1207 : : // Perform adjustments on pixel level.
1208 [ + - ]: 156060 : SwRect aAlignedPxRect( aOrgPxRect );
1209 [ + + ]: 156060 : if ( rRect.Top() > aPxCenterRect.Top() )
1210 : : {
1211 : : // 'leave pixel overlapping on top'
1212 : 24763 : aAlignedPxRect.Top( aAlignedPxRect.Top() + 1 );
1213 : : }
1214 : :
1215 [ + + ]: 156060 : if ( rRect.Bottom() < aPxCenterRect.Bottom() )
1216 : : {
1217 : : // 'leave pixel overlapping on bottom'
1218 : 42551 : aAlignedPxRect.Bottom( aAlignedPxRect.Bottom() - 1 );
1219 : : }
1220 : :
1221 [ + + ]: 156060 : if ( rRect.Left() > aPxCenterRect.Left() )
1222 : : {
1223 : : // 'leave pixel overlapping on left'
1224 : 19488 : aAlignedPxRect.Left( aAlignedPxRect.Left() + 1 );
1225 : : }
1226 : :
1227 [ + + ]: 156060 : if ( rRect.Right() < aPxCenterRect.Right() )
1228 : : {
1229 : : // 'leave pixel overlapping on right'
1230 : 119882 : aAlignedPxRect.Right( aAlignedPxRect.Right() - 1 );
1231 : : }
1232 : :
1233 : : // Consider negative width/height check, if aligned SwRect has negative width/height.
1234 : : // If Yes, adjust it to width/height = 0 twip.
1235 : : // NOTE: A SwRect with negative width/height can occur, if the width/height
1236 : : // of the given SwRect in twip was less than a pixel in twip and that
1237 : : // the alignment calculates that the aligned SwRect should not contain
1238 : : // the pixels the width/height is on.
1239 [ - + ]: 156060 : if ( aAlignedPxRect.Width() < 0 )
1240 : : {
1241 : 0 : aAlignedPxRect.Width(0);
1242 : : }
1243 [ - + ]: 156060 : if ( aAlignedPxRect.Height() < 0 )
1244 : : {
1245 : 0 : aAlignedPxRect.Height(0);
1246 : : }
1247 : : // Consider zero width/height for converting a rectangle from
1248 : : // pixel to logic it needs a width/height. Thus, set width/height
1249 : : // to one, if it's zero and correct this on the twip level after the conversion.
1250 : 156060 : sal_Bool bZeroWidth = sal_False;
1251 [ + + ]: 156060 : if ( aAlignedPxRect.Width() == 0 )
1252 : : {
1253 : 36983 : aAlignedPxRect.Width(1);
1254 : 36983 : bZeroWidth = sal_True;
1255 : : }
1256 : 156060 : sal_Bool bZeroHeight = sal_False;
1257 [ + + ]: 156060 : if ( aAlignedPxRect.Height() == 0 )
1258 : : {
1259 : 2343 : aAlignedPxRect.Height(1);
1260 : 2343 : bZeroHeight = sal_True;
1261 : : }
1262 : :
1263 [ + - ][ + - ]: 156060 : rRect = pOut->PixelToLogic( aAlignedPxRect.SVRect() );
[ + - ]
1264 : :
1265 : : // Consider zero width/height and adjust calculated aligned twip rectangle.
1266 : : // Reset width/height to zero; previous negative width/height haven't to be considered.
1267 [ + + ]: 156060 : if ( bZeroWidth )
1268 : : {
1269 : 36983 : rRect.Width(0);
1270 : : }
1271 [ + + ]: 156060 : if ( bZeroHeight )
1272 : : {
1273 : 156092 : rRect.Height(0);
1274 : : }
1275 : : }
1276 : :
1277 : : /** Helper method for twip adjustments on pixel base
1278 : :
1279 : : method compares the x- or y-pixel position of two twip-point. If the x-/y-pixel
1280 : : positions are the same, the x-/y-pixel position of the second twip point is
1281 : : adjusted by a given amount of pixels.
1282 : :
1283 : : @author OD
1284 : : */
1285 : 0 : void lcl_CompPxPosAndAdjustPos( const OutputDevice& _rOut,
1286 : : const Point& _rRefPt,
1287 : : Point& _rCompPt,
1288 : : const sal_Bool _bChkXPos,
1289 : : const sal_Int8 _nPxAdjustment )
1290 : : {
1291 [ # # ]: 0 : const Point aRefPxPt = _rOut.LogicToPixel( _rRefPt );
1292 [ # # ]: 0 : Point aCompPxPt = _rOut.LogicToPixel( _rCompPt );
1293 : :
1294 [ # # ]: 0 : if ( _bChkXPos )
1295 : : {
1296 [ # # ]: 0 : if ( aCompPxPt.X() == aRefPxPt.X() )
1297 : : {
1298 : 0 : aCompPxPt.X() += _nPxAdjustment ;
1299 [ # # ]: 0 : const Point aAdjustedCompPt = _rOut.PixelToLogic( aCompPxPt );
1300 : 0 : _rCompPt.X() = aAdjustedCompPt.X();
1301 : : }
1302 : : }
1303 : : else
1304 : : {
1305 [ # # ]: 0 : if ( aCompPxPt.Y() == aRefPxPt.Y() )
1306 : : {
1307 : 0 : aCompPxPt.Y() += _nPxAdjustment ;
1308 [ # # ]: 0 : const Point aAdjustedCompPt = _rOut.PixelToLogic( aCompPxPt );
1309 : 0 : _rCompPt.Y() = aAdjustedCompPt.Y();
1310 : : }
1311 : : }
1312 : 0 : }
1313 : :
1314 : : /** Method to pixel-align rectangle for drawing graphic object
1315 : :
1316 : : Because for drawing a graphic left-top-corner and size coordinations are
1317 : : used, these coordinations have to be determined on pixel level.
1318 : : Thus, convert rectangle to pixel and then convert left-top-corner and
1319 : : size of pixel rectangle back to logic.
1320 : : This calculation is necessary, because there exists a different between
1321 : : the convert from logic to pixel of a normal rectangle with its left-top-
1322 : : and right-bottom-corner and the same convert of the same rectangle
1323 : : with left-top-corner and size.
1324 : : Call this method before each <GraphicObject.Draw(...)>
1325 : :
1326 : : @author OD
1327 : : */
1328 : 234 : void SwAlignGrfRect( SwRect *pGrfRect, const OutputDevice &rOut )
1329 : : {
1330 [ + - ][ + - ]: 234 : Rectangle aPxRect = rOut.LogicToPixel( pGrfRect->SVRect() );
1331 [ + - ]: 234 : pGrfRect->Pos( rOut.PixelToLogic( aPxRect.TopLeft() ) );
1332 [ + - ][ + - ]: 234 : pGrfRect->SSize( rOut.PixelToLogic( aPxRect.GetSize() ) );
1333 : 234 : }
1334 : :
1335 : 1584 : long lcl_AlignWidth( const long nWidth )
1336 : : {
1337 [ + + ]: 1584 : if ( nWidth )
1338 : : {
1339 : 1572 : const long nW = nWidth % nPixelSzW;
1340 : :
1341 [ + - ][ - + ]: 1572 : if ( !nW || nW > nHalfPixelSzW )
1342 : 0 : return Max(1L, nWidth - nHalfPixelSzW);
1343 : : }
1344 : 1584 : return nWidth;
1345 : : }
1346 : :
1347 : 1578 : long lcl_AlignHeight( const long nHeight )
1348 : : {
1349 [ + - ]: 1578 : if ( nHeight )
1350 : : {
1351 : 1578 : const long nH = nHeight % nPixelSzH;
1352 : :
1353 [ + - ][ + + ]: 1578 : if ( !nH || nH > nHalfPixelSzH )
1354 : 3 : return Max(1L, nHeight - nHalfPixelSzH);
1355 : : }
1356 : 1578 : return nHeight;
1357 : : }
1358 : :
1359 : 0 : long lcl_MinHeightDist( const long nDist )
1360 : : {
1361 [ # # ][ # # ]: 0 : if ( aScaleX < aMinDistScale || aScaleY < aMinDistScale )
1362 : 0 : return nDist;
1363 : 0 : return ::lcl_AlignHeight( Max( nDist, nMinDistPixelH ));
1364 : : }
1365 : :
1366 : 0 : long lcl_MinWidthDist( const long nDist )
1367 : : {
1368 [ # # ][ # # ]: 0 : if ( aScaleX < aMinDistScale || aScaleY < aMinDistScale )
1369 : 0 : return nDist;
1370 : 0 : return ::lcl_AlignWidth( Max( nDist, nMinDistPixelW ));
1371 : : }
1372 : :
1373 : : //Calculate PrtArea plus surrounding plus shadow.
1374 : 12963 : void lcl_CalcBorderRect( SwRect &rRect, const SwFrm *pFrm,
1375 : : const SwBorderAttrs &rAttrs,
1376 : : const sal_Bool bShadow )
1377 : : {
1378 : : // Special handling for cell frames.
1379 : : // The printing area of a cell frame is completely enclosed in the frame area
1380 : : // and a cell frame has no shadow. Thus, for cell frames the calculated
1381 : : // area equals the frame area.
1382 : : // Notes: Borders of cell frames in R2L text direction will switch its side
1383 : : // - left border is painted on the right; right border on the left.
1384 : : // See <lcl_PaintLeftLine> and <lcl_PaintRightLine>.
1385 [ + + ]: 12963 : if( pFrm->IsSctFrm() )
1386 : : {
1387 : 129 : rRect = pFrm->Prt();
1388 : 129 : rRect.Pos() += pFrm->Frm().Pos();
1389 : : }
1390 [ + + ]: 12834 : else if ( pFrm->IsCellFrm() )
1391 : 76 : rRect = pFrm->Frm();
1392 : : else
1393 : : {
1394 : 12758 : rRect = pFrm->Prt();
1395 : 12758 : rRect.Pos() += pFrm->Frm().Pos();
1396 : :
1397 [ + - ]: 12758 : if ( rAttrs.IsLine() || rAttrs.IsBorderDist() ||
[ - + # # ]
[ + + ][ + + ]
1398 : 0 : (bShadow && rAttrs.GetShadow().GetLocation() != SVX_SHADOW_NONE) )
1399 : : {
1400 : : //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
1401 [ - + ][ # # ]: 542 : SwRectFn fnRect = pFrm->IsVertical() ? ( pFrm->IsVertLR() ? fnRectVertL2R : fnRectVert ) : fnRectHori;
1402 : :
1403 : 542 : const SvxBoxItem &rBox = rAttrs.GetBox();
1404 [ + - ]: 542 : const sal_Bool bTop = 0 != (pFrm->*fnRect->fnGetTopMargin)();
1405 [ + + ]: 542 : if ( bTop )
1406 : : {
1407 : 524 : SwTwips nDiff = rBox.GetTop() ?
1408 : 524 : rBox.CalcLineSpace( BOX_LINE_TOP ) :
1409 : 0 : ( rAttrs.IsBorderDist() ?
1410 : : // Increase of distance by one twip is incorrect.
1411 [ + - # # ]: 1048 : rBox.GetDistance( BOX_LINE_TOP ) : 0 );
1412 [ + - ]: 524 : if( nDiff )
1413 [ + - ]: 524 : (rRect.*fnRect->fnSubTop)( nDiff );
1414 : : }
1415 : :
1416 [ + - ]: 542 : const sal_Bool bBottom = 0 != (pFrm->*fnRect->fnGetBottomMargin)();
1417 [ + + ]: 542 : if ( bBottom )
1418 : : {
1419 : 539 : SwTwips nDiff = 0;
1420 : : // #i29550#
1421 [ - + # # ]: 539 : if ( pFrm->IsTabFrm() &&
[ - + ]
1422 : 0 : ((SwTabFrm*)pFrm)->IsCollapsingBorders() )
1423 : : {
1424 : : // For collapsing borders, we have to add the height of
1425 : : // the height of the last line
1426 : 0 : nDiff = ((SwTabFrm*)pFrm)->GetBottomLineSize();
1427 : : }
1428 : : else
1429 : : {
1430 : 539 : nDiff = rBox.GetBottom() ?
1431 : 539 : rBox.CalcLineSpace( BOX_LINE_BOTTOM ) :
1432 : 0 : ( rAttrs.IsBorderDist() ?
1433 : : // Increase of distance by one twip is incorrect.
1434 [ + - # # ]: 1078 : rBox.GetDistance( BOX_LINE_BOTTOM ) : 0 );
1435 : : }
1436 [ + - ]: 539 : if( nDiff )
1437 [ + - ]: 539 : (rRect.*fnRect->fnAddBottom)( nDiff );
1438 : : }
1439 : :
1440 [ + + ]: 542 : if ( rBox.GetLeft() )
1441 [ + - ]: 524 : (rRect.*fnRect->fnSubLeft)( rBox.CalcLineSpace( BOX_LINE_LEFT ) );
1442 [ - + ]: 18 : else if ( rAttrs.IsBorderDist() )
1443 : : // Increase of distance by one twip is incorrect.
1444 [ # # ]: 0 : (rRect.*fnRect->fnSubLeft)( rBox.GetDistance( BOX_LINE_LEFT ) );
1445 : :
1446 [ + + ]: 542 : if ( rBox.GetRight() )
1447 [ + - ]: 524 : (rRect.*fnRect->fnAddRight)( rBox.CalcLineSpace( BOX_LINE_RIGHT ) );
1448 [ - + ]: 18 : else if ( rAttrs.IsBorderDist() )
1449 : : // Increase of distance by one twip is incorrect.
1450 [ # # ]: 0 : (rRect.*fnRect->fnAddRight)( rBox.GetDistance( BOX_LINE_RIGHT ) );
1451 : :
1452 [ + + ][ - + ]: 542 : if ( bShadow && rAttrs.GetShadow().GetLocation() != SVX_SHADOW_NONE )
[ - + ]
1453 : : {
1454 : 0 : const SvxShadowItem &rShadow = rAttrs.GetShadow();
1455 [ # # ]: 0 : if ( bTop )
1456 [ # # ]: 0 : (rRect.*fnRect->fnSubTop)(rShadow.CalcShadowSpace(SHADOW_TOP));
1457 [ # # ]: 0 : (rRect.*fnRect->fnSubLeft)(rShadow.CalcShadowSpace(SHADOW_LEFT));
1458 [ # # ]: 0 : if ( bBottom )
1459 : : (rRect.*fnRect->fnAddBottom)
1460 [ # # ]: 0 : (rShadow.CalcShadowSpace( SHADOW_BOTTOM ));
1461 [ # # ]: 0 : (rRect.*fnRect->fnAddRight)(rShadow.CalcShadowSpace(SHADOW_RIGHT));
1462 : : }
1463 : : }
1464 : : }
1465 : :
1466 : 12963 : ::SwAlignRect( rRect, pGlobalShell );
1467 : 12963 : }
1468 : :
1469 : 0 : void lcl_ExtendLeftAndRight( SwRect& _rRect,
1470 : : const SwFrm& _rFrm,
1471 : : const SwBorderAttrs& _rAttrs,
1472 : : const SwRectFn& _rRectFn )
1473 : : {
1474 : : // Extend left/right border/shadow rectangle to bottom of previous frame/to
1475 : : // top of next frame, if border/shadow is joined with previous/next frame.
1476 [ # # ]: 0 : if ( _rAttrs.JoinedWithPrev( _rFrm ) )
1477 : : {
1478 : 0 : const SwFrm* pPrevFrm = _rFrm.GetPrev();
1479 [ # # ][ # # ]: 0 : (_rRect.*_rRectFn->fnSetTop)( (pPrevFrm->*_rRectFn->fnGetPrtBottom)() );
1480 : : }
1481 [ # # ]: 0 : if ( _rAttrs.JoinedWithNext( _rFrm ) )
1482 : : {
1483 : 0 : const SwFrm* pNextFrm = _rFrm.GetNext();
1484 [ # # ][ # # ]: 0 : (_rRect.*_rRectFn->fnSetBottom)( (pNextFrm->*_rRectFn->fnGetPrtTop)() );
1485 : : }
1486 : 0 : }
1487 : :
1488 : 798 : void lcl_SubtractFlys( const SwFrm *pFrm, const SwPageFrm *pPage,
1489 : : const SwRect &rRect, SwRegionRects &rRegion )
1490 : : {
1491 : 798 : const SwSortedObjs& rObjs = *pPage->GetSortedObjs();
1492 [ + + ]: 798 : const SwFlyFrm* pSelfFly = pFrm->IsInFly() ? pFrm->FindFlyFrm() : pRetoucheFly2;
1493 [ + - ]: 798 : if ( !pRetoucheFly )
1494 : 798 : pRetoucheFly = pRetoucheFly2;
1495 : :
1496 [ + + ][ + - ]: 2111 : for ( sal_uInt16 j = 0; (j < rObjs.Count()) && !rRegion.empty(); ++j )
[ + + ]
1497 : : {
1498 : 1313 : const SwAnchoredObject* pAnchoredObj = rObjs[j];
1499 : 1313 : const SdrObject* pSdrObj = pAnchoredObj->GetDrawObj();
1500 : :
1501 : : // Do not consider invisible objects
1502 [ - + ][ + - ]: 1313 : if ( !pPage->GetFmt()->GetDoc()->IsVisibleLayerId( pSdrObj->GetLayer() ) )
1503 : 0 : continue;
1504 : :
1505 [ + + ]: 1313 : if ( !pAnchoredObj->ISA(SwFlyFrm) )
1506 : 264 : continue;
1507 : :
1508 [ + - ]: 1049 : const SwFlyFrm *pFly = static_cast<const SwFlyFrm*>(pAnchoredObj);
1509 : :
1510 [ + + ][ + - ]: 1049 : if ( pSelfFly == pFly || pRetoucheFly == pFly || !rRect.IsOver( pFly->Frm() ) )
[ + + ][ + + ]
1511 : 379 : continue;
1512 : :
1513 [ - + # # : 670 : if ( !pFly->GetFmt()->GetPrint().GetValue() &&
# # ][ - + ]
1514 : 0 : (OUTDEV_PRINTER == pGlobalShell->GetOut()->GetOutDevType() ||
1515 : 0 : pGlobalShell->IsPreView()))
1516 : 0 : continue;
1517 : :
1518 : 126 : const sal_Bool bLowerOfSelf = pSelfFly && pFly->IsLowerOf( pSelfFly ) ?
1519 [ + + - + ]: 796 : sal_True : sal_False;
1520 : :
1521 : : //For character bound Flys only examine those Flys in which it is not
1522 : : //anchored itself.
1523 : : //Why only for character bound ones you may ask? It never makes sense to
1524 : : //subtract frames in which it is anchored itself right?
1525 [ + + ][ - + ]: 670 : if ( pSelfFly && pSelfFly->IsLowerOf( pFly ) )
[ - + ]
1526 : 0 : continue;
1527 : :
1528 : : //Any why does it not apply for the RetoucheFly too?
1529 [ - + ][ # # ]: 670 : if ( pRetoucheFly && pRetoucheFly->IsLowerOf( pFly ) )
[ - + ]
1530 : 0 : continue;
1531 : :
1532 : : #if OSL_DEBUG_LEVEL > 0
1533 : : //Flys who are anchored inside their own one, must have a bigger OrdNum
1534 : : //or be character bound.
1535 : : if ( pSelfFly && bLowerOfSelf )
1536 : : {
1537 : : OSL_ENSURE( pFly->IsFlyInCntFrm() ||
1538 : : pSdrObj->GetOrdNumDirect() > pSelfFly->GetVirtDrawObj()->GetOrdNumDirect(),
1539 : : "Fly with wrong z-Order" );
1540 : : }
1541 : : #endif
1542 : :
1543 : 670 : sal_Bool bStopOnHell = sal_True;
1544 [ + + ]: 670 : if ( pSelfFly )
1545 : : {
1546 : 126 : const SdrObject *pTmp = pSelfFly->GetVirtDrawObj();
1547 [ + - ]: 126 : if ( pSdrObj->GetLayer() == pTmp->GetLayer() )
1548 : : {
1549 [ + + ]: 126 : if ( pSdrObj->GetOrdNumDirect() < pTmp->GetOrdNumDirect() )
1550 : : //In the same layer we only observe those that are above.
1551 : 53 : continue;
1552 : : }
1553 : : else
1554 : : {
1555 [ # # ][ # # ]: 0 : if ( !bLowerOfSelf && !pFly->GetFmt()->GetOpaque().GetValue() )
[ # # ]
1556 : : //From other layers we are only interested in non
1557 : : //transparent ones or those that are internal
1558 : 0 : continue;
1559 : 0 : bStopOnHell = sal_False;
1560 : : }
1561 : : }
1562 [ - + ]: 617 : if ( pRetoucheFly )
1563 : : {
1564 : 0 : const SdrObject *pTmp = pRetoucheFly->GetVirtDrawObj();
1565 [ # # ]: 0 : if ( pSdrObj->GetLayer() == pTmp->GetLayer() )
1566 : : {
1567 [ # # ]: 0 : if ( pSdrObj->GetOrdNumDirect() < pTmp->GetOrdNumDirect() )
1568 : : //In the same layer we only observe those that are above.
1569 : 0 : continue;
1570 : : }
1571 : : else
1572 : : {
1573 [ # # ][ # # ]: 0 : if ( !pFly->IsLowerOf( pRetoucheFly ) && !pFly->GetFmt()->GetOpaque().GetValue() )
[ # # ]
1574 : : //From other layers we are only interested in non
1575 : : //transparent ones or those that are internal
1576 : 0 : continue;
1577 : 0 : bStopOnHell = sal_False;
1578 : : }
1579 : : }
1580 : :
1581 : : //If the content of the Fly is transparent, we subtract it only if it's
1582 : : //contained in the hell layer.
1583 : 617 : const IDocumentDrawModelAccess* pIDDMA = pFly->GetFmt()->getIDocumentDrawModelAccess();
1584 : 617 : sal_Bool bHell = pSdrObj->GetLayer() == pIDDMA->GetHellId();
1585 [ + + ][ + - : 2015 : if ( (bStopOnHell && bHell) ||
+ - + + -
+ # # #
# ][ + + ]
[ + - ]
1586 : : /// Change internal order of condition
1587 : : /// first check "!bHell", then "..->Lower()" and "..->IsNoTxtFrm()"
1588 : : /// have not to be performed, if frame is in "Hell"
1589 : 1210 : ( !bHell && pFly->Lower() && pFly->Lower()->IsNoTxtFrm() &&
1590 : 188 : ( ((SwNoTxtFrm*)pFly->Lower())->IsTransparent() ||
1591 : 0 : ((SwNoTxtFrm*)pFly->Lower())->HasAnimation() ||
1592 : 0 : pFly->GetFmt()->GetSurround().IsContour()
1593 : : )
1594 : : )
1595 : : )
1596 : 200 : continue;
1597 : :
1598 : : // Own if-statements for transparent background/shadow of fly frames
1599 : : // in order to handle special conditions.
1600 [ - + ]: 417 : if ( pFly->IsBackgroundTransparent() )
1601 : : {
1602 : : // Background <pFly> is transparent drawn. Thus normally, its region
1603 : : // have not to be substracted from given region.
1604 : : // But, if method is called for a fly frame and
1605 : : // <pFly> is a direct lower of this fly frame and
1606 : : // <pFly> inherites its transparent background brush from its parent,
1607 : : // then <pFly> frame area have to be subtracted from given region.
1608 : : // NOTE: Because in Status Quo transparent backgrounds can only be
1609 : : // assigned to fly frames, the handle of this special case
1610 : : // avoids drawing of transparent areas more than once, if
1611 : : // a fly frame inherites a transparent background from its
1612 : : // parent fly frame.
1613 [ # # # # : 0 : if ( pFrm->IsFlyFrm() &&
# # ][ # # ]
1614 : 0 : (pFly->GetAnchorFrm()->FindFlyFrm() == pFrm) &&
1615 : 0 : static_cast<const SwFlyFrmFmt*>(pFly->GetFmt())->IsBackgroundBrushInherited()
1616 : : )
1617 : : {
1618 : 0 : SwRect aRect;
1619 [ # # ]: 0 : SwBorderAttrAccess aAccess( SwFrm::GetCache(), (SwFrm*)pFly );
1620 [ # # ]: 0 : const SwBorderAttrs &rAttrs = *aAccess.Get();
1621 [ # # ]: 0 : ::lcl_CalcBorderRect( aRect, pFly, rAttrs, sal_True );
1622 [ # # ]: 0 : rRegion -= aRect;
1623 [ # # ]: 0 : continue;
1624 : : }
1625 : : else
1626 : : {
1627 : 0 : continue;
1628 : : }
1629 : : }
1630 [ - + ]: 417 : if ( pFly->IsShadowTransparent() )
1631 : : {
1632 : 0 : continue;
1633 : : }
1634 : :
1635 [ - + ][ # # ]: 417 : if ( bHell && pFly->GetAnchorFrm()->IsInFly() )
[ - + ]
1636 : : {
1637 : : //So the border won't get dismantled by the background of the other
1638 : : //Fly.
1639 : 0 : SwRect aRect;
1640 [ # # ]: 0 : SwBorderAttrAccess aAccess( SwFrm::GetCache(), (SwFrm*)pFly );
1641 [ # # ]: 0 : const SwBorderAttrs &rAttrs = *aAccess.Get();
1642 [ # # ]: 0 : ::lcl_CalcBorderRect( aRect, pFly, rAttrs, sal_True );
1643 [ # # ][ # # ]: 0 : rRegion -= aRect;
1644 : : }
1645 : : else
1646 : : {
1647 : 417 : SwRect aRect( pFly->Prt() );
1648 : 417 : aRect += pFly->Frm().Pos();
1649 [ + - ]: 417 : rRegion -= aRect;
1650 : : }
1651 : : }
1652 [ + - ]: 798 : if ( pRetoucheFly == pRetoucheFly2 )
1653 : 798 : pRetoucheFly = 0;
1654 : 798 : }
1655 : :
1656 : : //---------------- Output for BrushItem ----------------
1657 : :
1658 : : /** lcl_DrawGraphicBackgrd - local help method to draw a background for a graphic
1659 : :
1660 : : Under certain circumstances we have to draw a background for a graphic.
1661 : : This method takes care of the conditions and draws the background with the
1662 : : corresponding color.
1663 : : Method introduced for bug fix #103876# in order to optimize drawing tiled
1664 : : background graphics. Previously, this code was integrated in method
1665 : : <lcl_DrawGraphic>.
1666 : : Method implemented as a inline, checking the conditions and calling method
1667 : : method <lcl_implDrawGraphicBackgrd(..)> for the intrinsic drawing.
1668 : :
1669 : : @author OD
1670 : :
1671 : : @param _rBackgrdBrush
1672 : : background brush contain the color the background has to be drawn.
1673 : :
1674 : : @param _pOut
1675 : : output device the background has to be drawn in.
1676 : :
1677 : : @param _rPaintRect
1678 : : paint retangle in the output device, which has to be drawn with the background.
1679 : : rectangle have to be aligned by method ::SwAlignRect
1680 : :
1681 : : @param _rGraphicObj
1682 : : graphic object, for which the background has to be drawn. Used for checking
1683 : : the transparency of its bitmap, its type and if the graphic is drawn transparent
1684 : :
1685 : : @param _bNumberingGraphic
1686 : : boolean indicating that graphic is used as a numbering.
1687 : :
1688 : : @param _bBackgrdAlreadyDrawn
1689 : : boolean (optional; default: false) indicating, if the background is already drawn.
1690 : : */
1691 : 0 : void lcl_implDrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush,
1692 : : OutputDevice* _pOut,
1693 : : const SwRect& _rAlignedPaintRect,
1694 : : const GraphicObject& _rGraphicObj )
1695 : : {
1696 : : /// determine color of background
1697 : : /// If color of background brush is not "no fill"/"auto fill" or
1698 : : /// <bFlyMetafile> is set, use color of background brush, otherwise
1699 : : /// use global retouche color.
1700 [ # # ]: 0 : const Color aColor( ( (_rBackgrdBrush.GetColor() != COL_TRANSPARENT) || bFlyMetafile )
1701 : : ? _rBackgrdBrush.GetColor()
1702 [ # # ][ # # ]: 0 : : aGlobalRetoucheColor );
1703 : :
1704 : : /// determine, if background color have to be drawn transparent
1705 : : /// and calculate transparency percent value
1706 : 0 : sal_Int8 nTransparencyPercent = 0;
1707 : 0 : bool bDrawTransparent = false;
1708 [ # # ]: 0 : if ( aColor.GetTransparency() != 0 )
1709 : : /// background color is transparent --> draw transparent.
1710 : : {
1711 : 0 : bDrawTransparent = true;
1712 : 0 : nTransparencyPercent = (aColor.GetTransparency()*100 + 0x7F)/0xFF;
1713 : : }
1714 [ # # # # ]: 0 : else if ( (_rGraphicObj.GetAttr().GetTransparency() != 0) &&
[ # # ]
1715 [ # # ]: 0 : (_rBackgrdBrush.GetColor() == COL_TRANSPARENT) )
1716 : : /// graphic is drawn transparent and background color is
1717 : : /// "no fill"/"auto fill" --> draw transparent
1718 : : {
1719 : 0 : bDrawTransparent = true;
1720 : 0 : nTransparencyPercent = (_rGraphicObj.GetAttr().GetTransparency()*100 + 0x7F)/0xFF;
1721 : : }
1722 : :
1723 [ # # ]: 0 : if ( bDrawTransparent )
1724 : : {
1725 : : /// draw background transparent
1726 [ # # ]: 0 : if( _pOut->GetFillColor() != aColor.GetRGBColor() )
1727 [ # # ]: 0 : _pOut->SetFillColor( aColor.GetRGBColor() );
1728 [ # # ][ # # ]: 0 : PolyPolygon aPoly( _rAlignedPaintRect.SVRect() );
[ # # ][ # # ]
1729 [ # # ][ # # ]: 0 : _pOut->DrawTransparent( aPoly, nTransparencyPercent );
1730 : : }
1731 : : else
1732 : : {
1733 : : /// draw background opaque
1734 [ # # ]: 0 : if ( _pOut->GetFillColor() != aColor )
1735 [ # # ]: 0 : _pOut->SetFillColor( aColor );
1736 [ # # ][ # # ]: 0 : _pOut->DrawRect( _rAlignedPaintRect.SVRect() );
1737 : : }
1738 : 0 : }
1739 : :
1740 : 0 : inline void lcl_DrawGraphicBackgrd( const SvxBrushItem& _rBackgrdBrush,
1741 : : OutputDevice* _pOut,
1742 : : const SwRect& _rAlignedPaintRect,
1743 : : const GraphicObject& _rGraphicObj,
1744 : : bool _bNumberingGraphic,
1745 : : bool _bBackgrdAlreadyDrawn = false )
1746 : : {
1747 : : /// draw background with background color, if
1748 : : /// (1) graphic is not used as a numbering AND
1749 : : /// (2) background is not already drawn AND
1750 : : /// (3) intrinsic graphic is transparent OR intrinsic graphic doesn't exists
1751 [ # # ][ # # : 0 : if ( !_bNumberingGraphic &&
# # # # ]
[ # # ]
1752 : 0 : !_bBackgrdAlreadyDrawn &&
1753 : 0 : ( _rGraphicObj.IsTransparent() || _rGraphicObj.GetType() == GRAPHIC_NONE )
1754 : : )
1755 : : {
1756 : 0 : lcl_implDrawGraphicBackgrd( _rBackgrdBrush, _pOut, _rAlignedPaintRect, _rGraphicObj );
1757 : : }
1758 : 0 : }
1759 : :
1760 : : /// Note: the transparency of the background graphic
1761 : : /// is saved in SvxBrushItem.GetGraphicObject(<shell>).GetAttr().Set/GetTransparency()
1762 : : /// and is considered in the drawing of the graphic.
1763 : : /// Thus, to provide transparent background graphic for text frames nothing
1764 : : /// has to be coded.
1765 : : /// Use align rectangle for drawing graphic
1766 : : /// Pixel-align coordinations for drawing graphic.
1767 : : /// Outsource code for drawing background of the graphic
1768 : : /// with a background color in method <lcl_DrawGraphicBackgrd>
1769 : : /// Also, change type of <bGrfNum> and <bClip> from <sal_Bool> to <bool>.
1770 : 0 : void lcl_DrawGraphic( const SvxBrushItem& rBrush, OutputDevice *pOut,
1771 : : ViewShell &rSh, const SwRect &rGrf, const SwRect &rOut,
1772 : : bool bClip, bool bGrfNum,
1773 : : bool bBackgrdAlreadyDrawn = false )
1774 : : /// add parameter <bBackgrdAlreadyDrawn> to indicate
1775 : : /// that the background is already drawn.
1776 : : {
1777 : : /// Calculate align rectangle from parameter <rGrf> and use aligned
1778 : : /// rectangle <aAlignedGrfRect> in the following code
1779 : 0 : SwRect aAlignedGrfRect = rGrf;
1780 [ # # ]: 0 : ::SwAlignRect( aAlignedGrfRect, &rSh );
1781 : :
1782 : : /// Change type from <sal_Bool> to <bool>.
1783 [ # # ][ # # ]: 0 : const bool bNotInside = bClip && !rOut.IsInside( aAlignedGrfRect );
[ # # ]
1784 [ # # ]: 0 : if ( bNotInside )
1785 : : {
1786 [ # # ]: 0 : pOut->Push( PUSH_CLIPREGION );
1787 [ # # ][ # # ]: 0 : pOut->IntersectClipRegion( rOut.SVRect() );
1788 : : }
1789 : :
1790 : : //Hier kein Link, wir wollen die Grafik synchron laden!
1791 [ # # ][ # # ]: 0 : ((SvxBrushItem&)rBrush).SetDoneLink( Link() );
1792 [ # # ]: 0 : GraphicObject *pGrf = (GraphicObject*)rBrush.GetGraphicObject();
1793 : :
1794 : : /// Outsourcing drawing of background with a background color.
1795 [ # # ]: 0 : ::lcl_DrawGraphicBackgrd( rBrush, pOut, aAlignedGrfRect, *pGrf, bGrfNum, bBackgrdAlreadyDrawn );
1796 : :
1797 : : /// Because for drawing a graphic left-top-corner and size coordinations are
1798 : : /// used, these coordinations have to be determined on pixel level.
1799 [ # # ]: 0 : ::SwAlignGrfRect( &aAlignedGrfRect, *pOut );
1800 [ # # ]: 0 : pGrf->DrawWithPDFHandling( *pOut, aAlignedGrfRect.Pos(), aAlignedGrfRect.SSize() );
1801 : :
1802 [ # # ]: 0 : if ( bNotInside )
1803 [ # # ]: 0 : pOut->Pop();
1804 : 0 : } // end of method <lcl_DrawGraphic>
1805 : :
1806 : 13194 : void DrawGraphic( const SvxBrushItem *pBrush,
1807 : : OutputDevice *pOutDev,
1808 : : const SwRect &rOrg,
1809 : : const SwRect &rOut,
1810 : : const sal_uInt8 nGrfNum,
1811 : : const sal_Bool bConsiderBackgroundTransparency )
1812 : : /// Add 6th parameter to indicate that method should
1813 : : /// consider background transparency, saved in the color of the brush item
1814 : : {
1815 : 13194 : ViewShell &rSh = *pGlobalShell;
1816 : 13194 : bool bReplaceGrfNum = GRFNUM_REPLACE == nGrfNum;
1817 : 13194 : bool bGrfNum = GRFNUM_NO != nGrfNum;
1818 : 13194 : Size aGrfSize;
1819 : 13194 : SvxGraphicPosition ePos = GPOS_NONE;
1820 [ + - ][ + + ]: 13194 : if( pBrush && !bReplaceGrfNum )
1821 : : {
1822 [ + - ]: 489 : if( rSh.GetViewOptions()->IsGraphic() )
1823 : : {
1824 : : // load graphic directly in PDF import
1825 : : // #i68953# - also during print load graphic directly.
1826 [ + - - + ]: 978 : if ( (rSh).GetViewOptions()->IsPDFExport() ||
[ - + ]
1827 : 489 : rSh.GetOut()->GetOutDevType() == OUTDEV_PRINTER )
1828 : : {
1829 [ # # ]: 0 : ((SvxBrushItem*)pBrush)->PurgeMedium();
1830 [ # # ][ # # ]: 0 : ((SvxBrushItem*)pBrush)->SetDoneLink( Link() );
1831 : : }
1832 : : else
1833 : 489 : ((SvxBrushItem*)pBrush)->SetDoneLink( STATIC_LINK(
1834 [ + - ][ + - ]: 489 : rSh.GetDoc(), SwDoc, BackgroundDone ) );
1835 [ + - ]: 489 : const Graphic* pGrf = pBrush->GetGraphic();
1836 [ + + ][ + - ]: 489 : if( pGrf && GRAPHIC_NONE != pGrf->GetType() )
[ - + ][ - + ]
1837 : : {
1838 : 0 : ePos = pBrush->GetGraphicPos();
1839 [ # # ][ # # ]: 0 : if( pGrf->IsSupportedGraphic() )
1840 : : // don't the use the specific output device! Bug 94802
1841 [ # # ]: 0 : aGrfSize = ::GetGraphicSizeTwip( *pGrf, 0 );
1842 : : }
1843 : : }
1844 : : else
1845 : 0 : bReplaceGrfNum = bGrfNum;
1846 : : }
1847 : :
1848 : 13194 : SwRect aGrf;
1849 : 13194 : aGrf.SSize( aGrfSize );
1850 : 13194 : sal_Bool bDraw = sal_True;
1851 : 13194 : sal_Bool bRetouche = sal_True;
1852 [ - - - - : 13194 : switch ( ePos )
- - - - -
- - + - ]
1853 : : {
1854 : : case GPOS_LT:
1855 : 0 : aGrf.Pos() = rOrg.Pos();
1856 : 0 : break;
1857 : :
1858 : : case GPOS_MT:
1859 : 0 : aGrf.Pos().Y() = rOrg.Top();
1860 : 0 : aGrf.Pos().X() = rOrg.Left() + rOrg.Width()/2 - aGrfSize.Width()/2;
1861 : 0 : break;
1862 : :
1863 : : case GPOS_RT:
1864 : 0 : aGrf.Pos().Y() = rOrg.Top();
1865 : 0 : aGrf.Pos().X() = rOrg.Right() - aGrfSize.Width();
1866 : 0 : break;
1867 : :
1868 : : case GPOS_LM:
1869 : 0 : aGrf.Pos().Y() = rOrg.Top() + rOrg.Height()/2 - aGrfSize.Height()/2;
1870 : 0 : aGrf.Pos().X() = rOrg.Left();
1871 : 0 : break;
1872 : :
1873 : : case GPOS_MM:
1874 : 0 : aGrf.Pos().Y() = rOrg.Top() + rOrg.Height()/2 - aGrfSize.Height()/2;
1875 : 0 : aGrf.Pos().X() = rOrg.Left() + rOrg.Width()/2 - aGrfSize.Width()/2;
1876 : 0 : break;
1877 : :
1878 : : case GPOS_RM:
1879 : 0 : aGrf.Pos().Y() = rOrg.Top() + rOrg.Height()/2 - aGrfSize.Height()/2;
1880 : 0 : aGrf.Pos().X() = rOrg.Right() - aGrfSize.Width();
1881 : 0 : break;
1882 : :
1883 : : case GPOS_LB:
1884 : 0 : aGrf.Pos().Y() = rOrg.Bottom() - aGrfSize.Height();
1885 : 0 : aGrf.Pos().X() = rOrg.Left();
1886 : 0 : break;
1887 : :
1888 : : case GPOS_MB:
1889 : 0 : aGrf.Pos().Y() = rOrg.Bottom() - aGrfSize.Height();
1890 : 0 : aGrf.Pos().X() = rOrg.Left() + rOrg.Width()/2 - aGrfSize.Width()/2;
1891 : 0 : break;
1892 : :
1893 : : case GPOS_RB:
1894 : 0 : aGrf.Pos().Y() = rOrg.Bottom() - aGrfSize.Height();
1895 : 0 : aGrf.Pos().X() = rOrg.Right() - aGrfSize.Width();
1896 : 0 : break;
1897 : :
1898 : : case GPOS_AREA:
1899 : 0 : aGrf = rOrg;
1900 : : /// In spite the fact that the background graphic have to fill the complete
1901 : : /// area, it has been checked, if the graphic will completely fill out
1902 : : /// the region to be painted <rOut> and thus, nothing has to be retouched.
1903 : : /// For example, this is the case for a fly frame without a background
1904 : : /// brush positioned on the border of the page and inherited the
1905 : : /// background brush from the page.
1906 [ # # ]: 0 : bRetouche = !rOut.IsInside( aGrf );
1907 : 0 : break;
1908 : :
1909 : : case GPOS_TILED:
1910 : : {
1911 : : // draw background of tiled graphic before drawing tiled graphic in loop
1912 : : // determine graphic object
1913 [ # # ]: 0 : GraphicObject* pGraphicObj = const_cast< GraphicObject* >(pBrush->GetGraphicObject());
1914 : : // calculate aligned paint rectangle
1915 : 0 : SwRect aAlignedPaintRect = rOut;
1916 [ # # ]: 0 : ::SwAlignRect( aAlignedPaintRect, &rSh );
1917 : : // draw background color for aligned paint rectangle
1918 [ # # ]: 0 : lcl_DrawGraphicBackgrd( *pBrush, pOutDev, aAlignedPaintRect, *pGraphicObj, bGrfNum );
1919 : :
1920 : : // set left-top-corner of background graphic to left-top-corner of the
1921 : : // area, from which the background brush is determined.
1922 : 0 : aGrf.Pos() = rOrg.Pos();
1923 : : // setup clipping at output device
1924 [ # # ]: 0 : pOutDev->Push( PUSH_CLIPREGION );
1925 [ # # ][ # # ]: 0 : pOutDev->IntersectClipRegion( rOut.SVRect() );
1926 : : // use new method <GraphicObject::DrawTiled(::)>
1927 : : {
1928 : : // calculate paint offset
1929 : 0 : Point aPaintOffset( aAlignedPaintRect.Pos() - aGrf.Pos() );
1930 : : // draw background graphic tiled for aligned paint rectangle
1931 : : // #i42643#
1932 : : // For PDF export, every draw operation for bitmaps takes a
1933 : : // noticeable amount of place (~50 characters). Thus, optimize
1934 : : // between tile bitmap size and number of drawing operations here.
1935 : : //
1936 : : // A_out
1937 : : // n_chars = k1 * ---------- + k2 * A_bitmap
1938 : : // A_bitmap
1939 : : //
1940 : : // minimum n_chars is obtained for (derive for A_bitmap,
1941 : : // set to 0, take positive solution):
1942 : : // k1
1943 : : // A_bitmap = Sqrt( ---- A_out )
1944 : : // k2
1945 : : //
1946 : : // where k1 is the number of chars per draw operation, and
1947 : : // k2 is the number of chars per bitmap pixel.
1948 : : // This is approximately 50 and 7 for current PDF writer, respectively.
1949 : : //
1950 : 0 : const double k1( 50 );
1951 : 0 : const double k2( 7 );
1952 : 0 : const Size aSize( aAlignedPaintRect.SSize() );
1953 : 0 : const double Abitmap( k1/k2 * static_cast<double>(aSize.Width())*aSize.Height() );
1954 : :
1955 : : pGraphicObj->DrawTiled( pOutDev,
1956 : : aAlignedPaintRect.SVRect(),
1957 : 0 : aGrf.SSize(),
1958 : 0 : Size( aPaintOffset.X(), aPaintOffset.Y() ),
1959 : : NULL, GRFMGR_DRAW_STANDARD,
1960 [ # # ]: 0 : ::std::max( 128, static_cast<int>( sqrt(sqrt( Abitmap)) + .5 ) ) );
[ # # # # ]
1961 : : }
1962 : : // reset clipping at output device
1963 [ # # ]: 0 : pOutDev->Pop();
1964 : : // set <bDraw> and <bRetouche> to false, indicating that background
1965 : : // graphic and background are already drawn.
1966 : 0 : bDraw = bRetouche = sal_False;
1967 : : }
1968 : 0 : break;
1969 : :
1970 : : case GPOS_NONE:
1971 : 13194 : bDraw = sal_False;
1972 : 13194 : break;
1973 : :
1974 : : default: OSL_ENSURE( !pOutDev, "new Graphic position?" );
1975 : : }
1976 : :
1977 : : /// init variable <bGrfBackgrdAlreadDrawn> to indicate, if background of
1978 : : /// graphic is already drawn or not.
1979 : 13194 : bool bGrfBackgrdAlreadyDrawn = false;
1980 [ + - ]: 13194 : if ( bRetouche )
1981 : : {
1982 [ + - ]: 13194 : pOutDev->Push( PUSH_FILLCOLOR|PUSH_LINECOLOR );
1983 [ + - ]: 13194 : pOutDev->SetLineColor();
1984 : :
1985 : : // check, if a existing background graphic (not filling the complete
1986 : : // background) is transparent drawn and the background color is
1987 : : // "no fill" respectively "auto fill", if background transparency
1988 : : // has to be considered.
1989 : : // If YES, memorise transparency of background graphic.
1990 : : // check also, if background graphic bitmap is transparent.
1991 : 13194 : bool bTransparentGrfWithNoFillBackgrd = false;
1992 : 13194 : sal_Int32 nGrfTransparency = 0;
1993 : 13194 : bool bGrfIsTransparent = false;
1994 [ - + ][ # # ]: 13194 : if ( (ePos != GPOS_NONE) &&
[ # # ]
1995 : : (ePos != GPOS_TILED) && (ePos != GPOS_AREA)
1996 : : )
1997 : : {
1998 [ # # ]: 0 : GraphicObject *pGrf = (GraphicObject*)pBrush->GetGraphicObject();
1999 [ # # ]: 0 : if ( bConsiderBackgroundTransparency )
2000 : : {
2001 : 0 : GraphicAttr pGrfAttr = pGrf->GetAttr();
2002 [ # # # # ]: 0 : if ( (pGrfAttr.GetTransparency() != 0) &&
[ # # ][ # # ]
2003 [ # # ]: 0 : ( pBrush && (pBrush->GetColor() == COL_TRANSPARENT) )
2004 : : )
2005 : : {
2006 : 0 : bTransparentGrfWithNoFillBackgrd = true;
2007 : 0 : nGrfTransparency = pGrfAttr.GetTransparency();
2008 [ # # ]: 0 : }
2009 : : }
2010 [ # # ]: 0 : if ( pGrf->IsTransparent() )
2011 : : {
2012 : 0 : bGrfIsTransparent = true;
2013 : : }
2014 : : }
2015 : :
2016 : : /// to get color of brush, check background color against COL_TRANSPARENT ("no fill"/"auto fill")
2017 : : /// instead of checking, if transparency is not set.
2018 : : const Color aColor( pBrush &&
2019 [ + + ]: 13683 : ( !(pBrush->GetColor() == COL_TRANSPARENT) ||
2020 : : bFlyMetafile )
2021 : : ? pBrush->GetColor()
2022 [ + + - + ]: 13683 : : aGlobalRetoucheColor );
[ # # ]
2023 : :
2024 : : /// determine, if background region have to be
2025 : : /// drawn transparent.
2026 : : /// background region has to be drawn transparent, if
2027 : : /// background transparency have to be considered
2028 : : /// AND
2029 : : /// ( background color is transparent OR
2030 : : /// background graphic is transparent and background color is "no fill"
2031 : : /// )
2032 : : sal_Bool bDrawTransparent = bConsiderBackgroundTransparency &&
2033 : 396 : ( ( aColor.GetTransparency() != 0) ||
2034 [ + + + - ]: 13590 : bTransparentGrfWithNoFillBackgrd );
[ - + ]
2035 : :
2036 : : // #i75614# reset draw mode in high contrast mode in order to get fill color set
2037 : 13194 : const sal_uLong nOldDrawMode = pOutDev->GetDrawMode();
2038 [ - + ]: 26355 : if ( pGlobalShell->GetWin() &&
[ + + - + ]
2039 [ + - ]: 13161 : Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
2040 : : {
2041 [ # # ]: 0 : pOutDev->SetDrawMode( 0 );
2042 : : }
2043 : :
2044 : : /// OD 06.08.2002 #99657# - if background region have to be drawn
2045 : : /// transparent, set only the RGB values of the background color as
2046 : : /// the fill color for the output device.
2047 [ - + ]: 13194 : if ( bDrawTransparent )
2048 : : {
2049 [ # # ]: 0 : if( pOutDev->GetFillColor() != aColor.GetRGBColor() )
2050 [ # # ]: 0 : pOutDev->SetFillColor( aColor.GetRGBColor() );
2051 : : }
2052 : : else
2053 : : {
2054 [ + + ]: 13194 : if( pOutDev->GetFillColor() != aColor )
2055 [ + - ]: 1906 : pOutDev->SetFillColor( aColor );
2056 : : }
2057 : :
2058 : : // #i75614#
2059 : : // restore draw mode
2060 [ + - ]: 13194 : pOutDev->SetDrawMode( nOldDrawMode );
2061 : :
2062 : : /// OD 02.09.2002 #99657#
2063 [ - + ]: 13194 : if ( bDrawTransparent )
2064 : : {
2065 : : /// background region have to be drawn transparent.
2066 : : /// Thus, create a poly-polygon from the region and draw it with
2067 : : /// the corresponding transparency precent.
2068 [ # # ][ # # ]: 0 : PolyPolygon aDrawPoly( rOut.SVRect() );
[ # # ][ # # ]
2069 [ # # ][ # # ]: 0 : if ( aGrf.HasArea() )
2070 : : {
2071 [ # # ]: 0 : if ( !bGrfIsTransparent )
2072 : : {
2073 : : /// substract area of background graphic from draw area
2074 : : /// OD 08.10.2002 #103898# - consider only that part of the
2075 : : /// graphic area that is overlapping with draw area.
2076 : 0 : SwRect aTmpGrf = aGrf;
2077 [ # # ]: 0 : aTmpGrf.Intersection( rOut );
2078 [ # # ][ # # ]: 0 : if ( aTmpGrf.HasArea() )
2079 : : {
2080 [ # # ][ # # ]: 0 : Polygon aGrfPoly( aTmpGrf.SVRect() );
2081 [ # # ][ # # ]: 0 : aDrawPoly.Insert( aGrfPoly );
2082 : : }
2083 : : }
2084 : : else
2085 : 0 : bGrfBackgrdAlreadyDrawn = true;
2086 : : }
2087 : : /// calculate transparency percent:
2088 : : /// ( <transparency value[0x01..0xFF]>*100 + 0x7F ) / 0xFF
2089 : : /// If there is a background graphic with a background color "no fill"/"auto fill",
2090 : : /// the transparency value is taken from the background graphic,
2091 : : /// otherwise take the transparency value from the color.
2092 : : sal_Int8 nTransparencyPercent = static_cast<sal_Int8>(
2093 : 0 : (( bTransparentGrfWithNoFillBackgrd ? nGrfTransparency : aColor.GetTransparency()
2094 [ # # ]: 0 : )*100 + 0x7F)/0xFF);
2095 : : /// draw poly-polygon transparent
2096 [ # # ][ # # ]: 0 : pOutDev->DrawTransparent( aDrawPoly, nTransparencyPercent );
2097 : : }
2098 : : else
2099 : : {
2100 [ + - ]: 13194 : SwRegionRects aRegion( rOut, 4 );
2101 [ + - ]: 13194 : if ( !bGrfIsTransparent )
2102 [ + - ]: 13194 : aRegion -= aGrf;
2103 : : else
2104 : 0 : bGrfBackgrdAlreadyDrawn = true;
2105 : : /// loop rectangles of background region, which has to be drawn
2106 [ + + ]: 26408 : for( sal_uInt16 i = 0; i < aRegion.size(); ++i )
2107 : : {
2108 [ + - ][ + - ]: 13214 : pOutDev->DrawRect( aRegion[i].SVRect() );
2109 : 13194 : }
2110 : : }
2111 [ + - ]: 13194 : pOutDev ->Pop();
2112 : : }
2113 : :
2114 [ - + ][ # # ]: 13194 : if( bDraw && aGrf.IsOver( rOut ) )
[ # # ][ - + ]
2115 : : /// OD 02.09.2002 #99657#
2116 : : /// add parameter <bGrfBackgrdAlreadyDrawn>
2117 : : lcl_DrawGraphic( *pBrush, pOutDev, rSh, aGrf, rOut, true, bGrfNum,
2118 [ # # ]: 0 : bGrfBackgrdAlreadyDrawn );
2119 : :
2120 [ - + ]: 13194 : if( bReplaceGrfNum )
2121 : : {
2122 [ # # ]: 0 : const BitmapEx& rBmp = ViewShell::GetReplacementBitmap( false );
2123 [ # # ]: 0 : Font aTmp( pOutDev->GetFont() );
2124 [ # # ][ # # ]: 0 : Graphic::DrawEx( pOutDev, aEmptyStr, aTmp, rBmp, rOrg.Pos(), rOrg.SSize() );
2125 : : }
2126 : 13194 : }
2127 : :
2128 : : //------------------------------------------------------------------------
2129 : :
2130 : : /** local help method for SwRootFrm::Paint(..) - Adjust given rectangle to pixel size
2131 : :
2132 : : By OD at 27.09.2002 for #103636#
2133 : : In order to avoid paint errors caused by multiple alignments - e.g. method
2134 : : ::SwAlignRect(..) - and other changes to the rectangle to be painted,
2135 : : this method is called for the rectangle to be painted in order to
2136 : : adjust it to the pixel it is overlapping.
2137 : :
2138 : : @author OD
2139 : : */
2140 : 12259 : void lcl_AdjustRectToPixelSize( SwRect& io_aSwRect, const OutputDevice &aOut )
2141 : : {
2142 : : /// local constant object of class <Size> to determine number of Twips
2143 : : /// representing a pixel.
2144 [ + - ]: 12259 : const Size aTwipToPxSize( aOut.PixelToLogic( Size( 1,1 )) );
2145 : :
2146 : : /// local object of class <Rectangle> in Twip coordinates
2147 : : /// calculated from given rectangle aligned to pixel centers.
2148 : : const Rectangle aPxCenterRect = aOut.PixelToLogic(
2149 [ + - ][ + - ]: 12259 : aOut.LogicToPixel( io_aSwRect.SVRect() ) );
[ + - ]
2150 : :
2151 : : /// local constant object of class <Rectangle> representing given rectangle
2152 : : /// in pixel.
2153 [ + - ][ + - ]: 12259 : const Rectangle aOrgPxRect = aOut.LogicToPixel( io_aSwRect.SVRect() );
2154 : :
2155 : : /// calculate adjusted rectangle from pixel centered rectangle.
2156 : : /// Due to rounding differences <aPxCenterRect> doesn't exactly represents
2157 : : /// the Twip-centers. Thus, adjust borders by half of pixel width/height plus 1.
2158 : : /// Afterwards, adjust calculated Twip-positions of the all borders.
2159 : 12259 : Rectangle aSizedRect = aPxCenterRect;
2160 : 12259 : aSizedRect.Left() -= (aTwipToPxSize.Width()/2 + 1);
2161 : 12259 : aSizedRect.Right() += (aTwipToPxSize.Width()/2 + 1);
2162 : 12259 : aSizedRect.Top() -= (aTwipToPxSize.Height()/2 + 1);
2163 : 12259 : aSizedRect.Bottom() += (aTwipToPxSize.Height()/2 + 1);
2164 : :
2165 : : /// adjust left()
2166 [ + - ][ + + ]: 24538 : while ( (aOut.LogicToPixel(aSizedRect)).Left() < aOrgPxRect.Left() )
2167 : : {
2168 : 12279 : ++aSizedRect.Left();
2169 : : }
2170 : : /// adjust right()
2171 [ + - ][ + + ]: 24577 : while ( (aOut.LogicToPixel(aSizedRect)).Right() > aOrgPxRect.Right() )
2172 : : {
2173 : 12318 : --aSizedRect.Right();
2174 : : }
2175 : : /// adjust top()
2176 [ + - ][ + + ]: 24564 : while ( (aOut.LogicToPixel(aSizedRect)).Top() < aOrgPxRect.Top() )
2177 : : {
2178 : 12305 : ++aSizedRect.Top();
2179 : : }
2180 : : /// adjust bottom()
2181 [ + - ][ + + ]: 24566 : while ( (aOut.LogicToPixel(aSizedRect)).Bottom() > aOrgPxRect.Bottom() )
2182 : : {
2183 : 12307 : --aSizedRect.Bottom();
2184 : : }
2185 : :
2186 [ + - ]: 12259 : io_aSwRect = SwRect( aSizedRect );
2187 : :
2188 : : #if OSL_DEBUG_LEVEL > 0
2189 : : Rectangle aTestOrgPxRect = aOut.LogicToPixel( io_aSwRect.SVRect() );
2190 : : Rectangle aTestNewPxRect = aOut.LogicToPixel( aSizedRect );
2191 : : OSL_ENSURE( aTestOrgPxRect == aTestNewPxRect,
2192 : : "Error in lcl_AlignRectToPixelSize(..): Adjusted rectangle has incorrect position or size");
2193 : : /// check Left()
2194 : : --aSizedRect.Left();
2195 : : aTestNewPxRect = aOut.LogicToPixel( aSizedRect );
2196 : : OSL_ENSURE( aTestOrgPxRect.Left() >= (aTestNewPxRect.Left()+1),
2197 : : "Error in lcl_AlignRectToPixelSize(..): Left() not correct adjusted");
2198 : : ++aSizedRect.Left();
2199 : : /// check Right()
2200 : : ++aSizedRect.Right();
2201 : : aTestNewPxRect = aOut.LogicToPixel( aSizedRect );
2202 : : OSL_ENSURE( aTestOrgPxRect.Right() <= (aTestNewPxRect.Right()-1),
2203 : : "Error in lcl_AlignRectToPixelSize(..): Right() not correct adjusted");
2204 : : --aSizedRect.Right();
2205 : : /// check Top()
2206 : : --aSizedRect.Top();
2207 : : aTestNewPxRect = aOut.LogicToPixel( aSizedRect );
2208 : : OSL_ENSURE( aTestOrgPxRect.Top() >= (aTestNewPxRect.Top()+1),
2209 : : "Error in lcl_AlignRectToPixelSize(..): Top() not correct adjusted");
2210 : : ++aSizedRect.Top();
2211 : : /// check Bottom()
2212 : : ++aSizedRect.Bottom();
2213 : : aTestNewPxRect = aOut.LogicToPixel( aSizedRect );
2214 : : OSL_ENSURE( aTestOrgPxRect.Bottom() <= (aTestNewPxRect.Bottom()-1),
2215 : : "Error in lcl_AlignRectToPixelSize(..): Bottom() not correct adjusted");
2216 : : --aSizedRect.Bottom();
2217 : : #endif
2218 : 12259 : }
2219 : :
2220 : : //
2221 : : // FUNCTIONS USED FOR COLLAPSING TABLE BORDER LINES START
2222 : : //
2223 : :
2224 : : struct SwLineEntry
2225 : : {
2226 : : SwTwips mnKey;
2227 : : SwTwips mnStartPos;
2228 : : SwTwips mnEndPos;
2229 : :
2230 : : svx::frame::Style maAttribute;
2231 : :
2232 : : enum OverlapType { NO_OVERLAP, OVERLAP1, OVERLAP2, OVERLAP3 };
2233 : :
2234 : : public:
2235 : : SwLineEntry( SwTwips nKey,
2236 : : SwTwips nStartPos,
2237 : : SwTwips nEndPos,
2238 : : const svx::frame::Style& rAttribute );
2239 : :
2240 : : OverlapType Overlaps( const SwLineEntry& rComp ) const;
2241 : : };
2242 : :
2243 : 71757 : SwLineEntry::SwLineEntry( SwTwips nKey,
2244 : : SwTwips nStartPos,
2245 : : SwTwips nEndPos,
2246 : : const svx::frame::Style& rAttribute )
2247 : : : mnKey( nKey ),
2248 : : mnStartPos( nStartPos ),
2249 : : mnEndPos( nEndPos ),
2250 : 71757 : maAttribute( rAttribute )
2251 : : {
2252 : 71757 : }
2253 : :
2254 : : /*
2255 : :
2256 : : 1. ---------- rOld
2257 : : ---------- rNew
2258 : :
2259 : : 2. ---------- rOld
2260 : : ------------- rNew
2261 : :
2262 : : 3. ------- rOld
2263 : : ------------- rNew
2264 : :
2265 : : 4. ------------- rOld
2266 : : ---------- rNew
2267 : :
2268 : : 5. ---------- rOld
2269 : : ---- rNew
2270 : :
2271 : : 6. ---------- rOld
2272 : : ---------- rNew
2273 : :
2274 : : 7. ------------- rOld
2275 : : ---------- rNew
2276 : :
2277 : : 8. ---------- rOld
2278 : : ------------- rNew
2279 : :
2280 : : 9. ---------- rOld
2281 : : ---------- rNew
2282 : : */
2283 : :
2284 : 70165 : SwLineEntry::OverlapType SwLineEntry::Overlaps( const SwLineEntry& rNew ) const
2285 : : {
2286 : 70165 : SwLineEntry::OverlapType eRet = OVERLAP3;
2287 : :
2288 [ + - ][ + + ]: 70165 : if ( mnStartPos >= rNew.mnEndPos || mnEndPos <= rNew.mnStartPos )
2289 : 57698 : eRet = NO_OVERLAP;
2290 : :
2291 : : // 1, 2, 3
2292 [ - + ]: 12467 : else if ( mnEndPos < rNew.mnEndPos )
2293 : 0 : eRet = OVERLAP1;
2294 : :
2295 : : // 4, 5, 6, 7
2296 [ + - ][ + - ]: 12467 : else if ( mnStartPos <= rNew.mnStartPos && mnEndPos >= rNew.mnEndPos )
2297 : 12467 : eRet = OVERLAP2;
2298 : :
2299 : : // 8, 9
2300 : 70165 : return eRet;
2301 : : }
2302 : :
2303 : : struct lt_SwLineEntry
2304 : : {
2305 : 100628 : bool operator()( const SwLineEntry& e1, const SwLineEntry& e2 ) const
2306 : : {
2307 : 100628 : return e1.mnStartPos < e2.mnStartPos;
2308 : : }
2309 : : };
2310 : :
2311 : : typedef std::set< SwLineEntry, lt_SwLineEntry > SwLineEntrySet;
2312 : : typedef std::set< SwLineEntry, lt_SwLineEntry >::iterator SwLineEntrySetIter;
2313 : : typedef std::set< SwLineEntry, lt_SwLineEntry >::const_iterator SwLineEntrySetConstIter;
2314 : : typedef std::map< SwTwips, SwLineEntrySet > SwLineEntryMap;
2315 : : typedef std::map< SwTwips, SwLineEntrySet >::iterator SwLineEntryMapIter;
2316 : : typedef std::map< SwTwips, SwLineEntrySet >::const_iterator SwLineEntryMapConstIter;
2317 : :
2318 : 671 : class SwTabFrmPainter
2319 : : {
2320 : : SwLineEntryMap maVertLines;
2321 : : SwLineEntryMap maHoriLines;
2322 : : const SwTabFrm& mrTabFrm;
2323 : :
2324 : : void Insert( SwLineEntry&, bool bHori );
2325 : : void Insert( const SwFrm& rFrm, const SvxBoxItem& rBoxItem );
2326 : : void HandleFrame( const SwLayoutFrm& rFrm );
2327 : : void FindStylesForLine( const Point&,
2328 : : const Point&,
2329 : : svx::frame::Style*,
2330 : : bool bHori ) const;
2331 : :
2332 : : public:
2333 : : SwTabFrmPainter( const SwTabFrm& rTabFrm );
2334 : :
2335 : : void PaintLines( OutputDevice& rDev, const SwRect& rRect ) const;
2336 : : };
2337 : :
2338 : 671 : SwTabFrmPainter::SwTabFrmPainter( const SwTabFrm& rTabFrm )
2339 [ + - ]: 671 : : mrTabFrm( rTabFrm )
2340 : : {
2341 [ + - ]: 671 : HandleFrame( rTabFrm );
2342 : 671 : }
2343 : :
2344 : 12008 : void SwTabFrmPainter::HandleFrame( const SwLayoutFrm& rLayoutFrm )
2345 : : {
2346 : : // Add border lines of cell frames. Skip covered cells. Skip cells
2347 : : // in special row span row, which do not have a negative row span:
2348 [ + + ][ + - ]: 12008 : if ( rLayoutFrm.IsCellFrm() && !rLayoutFrm.IsCoveredCell() )
[ + + ]
2349 : : {
2350 : 8589 : const SwCellFrm* pThisCell = static_cast<const SwCellFrm*>(&rLayoutFrm);
2351 : 8589 : const SwRowFrm* pRowFrm = static_cast<const SwRowFrm*>(pThisCell->GetUpper());
2352 : 8589 : const long nRowSpan = pThisCell->GetTabBox()->getRowSpan();
2353 [ # # ][ # # ]: 8589 : if ( !pRowFrm->IsRowSpanLine() || nRowSpan > 1 || nRowSpan < -1 )
[ + - ][ - + ]
2354 : : {
2355 [ + - ]: 8589 : SwBorderAttrAccess aAccess( SwFrm::GetCache(), &rLayoutFrm );
2356 [ + - ]: 8589 : const SwBorderAttrs& rAttrs = *aAccess.Get();
2357 : 8589 : const SvxBoxItem& rBox = rAttrs.GetBox();
2358 [ + - ][ + - ]: 8589 : Insert( rLayoutFrm, rBox );
2359 : : }
2360 : : }
2361 : :
2362 : : // Recurse into lower layout frames, but do not recurse into lower tabframes.
2363 : 12008 : const SwFrm* pLower = rLayoutFrm.Lower();
2364 [ + + ]: 31966 : while ( pLower )
2365 : : {
2366 [ - + ]: 19958 : const SwLayoutFrm* pLowerLayFrm = dynamic_cast<const SwLayoutFrm*>(pLower);
2367 [ + + ][ + - ]: 19958 : if ( pLowerLayFrm && !pLowerLayFrm->IsTabFrm() )
[ + + ]
2368 : 11337 : HandleFrame( *pLowerLayFrm );
2369 : :
2370 : 19958 : pLower = pLower->GetNext();
2371 : : }
2372 : 12008 : }
2373 : :
2374 : 671 : void SwTabFrmPainter::PaintLines( OutputDevice& rDev, const SwRect& rRect ) const
2375 : : {
2376 : : // #i16816# tagged pdf support
2377 [ + - ]: 671 : SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, rDev );
2378 : :
2379 : 671 : const SwFrm* pTmpFrm = &mrTabFrm;
2380 [ + - ]: 671 : const bool bVert = pTmpFrm->IsVertical();
2381 : :
2382 : 671 : SwLineEntryMapConstIter aIter = maHoriLines.begin();
2383 : 671 : bool bHori = true;
2384 : :
2385 : : // color for subsidiary lines:
2386 [ + - ]: 671 : const Color& rCol( SwViewOption::GetTableBoundariesColor() );
2387 : :
2388 : : // high contrast mode:
2389 : : // overrides the color of non-subsidiary lines.
2390 : 671 : const Color* pHCColor = 0;
2391 : 671 : sal_uLong nOldDrawMode = rDev.GetDrawMode();
2392 [ - + ]: 1342 : if( pGlobalShell->GetWin() &&
[ + - - + ]
2393 [ + - ]: 671 : Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
2394 : : {
2395 [ # # ]: 0 : pHCColor = &SwViewOption::GetFontColor();
2396 [ # # ]: 0 : rDev.SetDrawMode( 0 );
2397 : : }
2398 : :
2399 : : // set clip region:
2400 [ + - ]: 671 : rDev.Push( PUSH_CLIPREGION );
2401 : 671 : Size aSize( rRect.SSize() );
2402 : : // Hack! Necessary, because the layout is not pixel aligned!
2403 : 671 : aSize.Width() += nPixelSzW; aSize.Height() += nPixelSzH;
2404 [ + - ][ + - ]: 671 : rDev.SetClipRegion( Rectangle( rRect.Pos(), aSize ) );
[ + - ][ + - ]
2405 : :
2406 : : // The following stuff if necessary to have the new table borders fit
2407 : : // into a ::SwAlignRect adjusted world.
2408 [ - + ]: 671 : const SwTwips nTwipXCorr = bVert ? 0 : Max( 0L, nHalfPixelSzW - 2 ); // 1 < 2 < 3 ;-)
2409 [ - + ]: 671 : const SwTwips nTwipYCorr = !bVert ? 0 : Max( 0L, nHalfPixelSzW - 2 ); // 1 < 2 < 3 ;-)
2410 : 671 : const SwFrm* pUpper = mrTabFrm.GetUpper();
2411 : 671 : SwRect aUpper( pUpper->Prt() );
2412 : 671 : aUpper.Pos() += pUpper->Frm().Pos();
2413 : 671 : SwRect aUpperAligned( aUpper );
2414 [ + - ]: 671 : ::SwAlignRect( aUpperAligned, pGlobalShell );
2415 : :
2416 : 6053 : while ( true )
2417 : : {
2418 [ + + ][ + + ]: 6724 : if ( bHori && aIter == maHoriLines.end() )
[ + + ][ + + ]
2419 : : {
2420 : 671 : aIter = maVertLines.begin();
2421 : 671 : bHori = false;
2422 : : }
2423 : :
2424 [ + + ][ + + ]: 6724 : if ( !bHori && aIter == maVertLines.end() )
[ + + ][ + + ]
2425 : : break;
2426 : :
2427 : 6053 : const SwLineEntrySet& rEntrySet = (*aIter).second;
2428 : 6053 : SwLineEntrySetConstIter aSetIter = rEntrySet.begin();
2429 [ + + ]: 27942 : while ( aSetIter != rEntrySet.end() )
2430 : : {
2431 : 21889 : const SwLineEntry& rEntry = *aSetIter;
2432 : 21889 : const svx::frame::Style& rEntryStyle( (*aSetIter).maAttribute );
2433 : :
2434 : 21889 : Point aStart, aEnd;
2435 [ + + ]: 21889 : if ( bHori )
2436 : : {
2437 : 10562 : aStart.X() = rEntry.mnStartPos;
2438 : 10562 : aStart.Y() = rEntry.mnKey;
2439 : 10562 : aEnd.X() = rEntry.mnEndPos;
2440 : 10562 : aEnd.Y() = rEntry.mnKey;
2441 : : }
2442 : : else
2443 : : {
2444 : 11327 : aStart.X() = rEntry.mnKey;
2445 : 11327 : aStart.Y() = rEntry.mnStartPos;
2446 : 11327 : aEnd.X() = rEntry.mnKey;
2447 : 11327 : aEnd.Y() = rEntry.mnEndPos;
2448 : : }
2449 : :
2450 : 21889 : SwRect aRepaintRect( aStart, aEnd );
2451 : :
2452 : : // the repaint rectangle has to be moved a bit for the centered lines:
2453 [ + + ]: 21889 : SwTwips nRepaintRectSize = !rEntryStyle.GetWidth() ? 1 : rEntryStyle.GetWidth();
2454 [ + + ]: 21889 : if ( bHori )
2455 : : {
2456 : 10562 : aRepaintRect.Height( 2 * nRepaintRectSize );
2457 : 10562 : aRepaintRect.Pos().Y() -= nRepaintRectSize;
2458 : : }
2459 : : else
2460 : : {
2461 : 11327 : aRepaintRect.Width( 2 * nRepaintRectSize );
2462 : 11327 : aRepaintRect.Pos().X() -= nRepaintRectSize;
2463 : : }
2464 : :
2465 [ + - ][ + + ]: 21889 : if ( rRect.IsOver( aRepaintRect ) )
2466 : : {
2467 [ + - ][ + + ]: 74904 : svx::frame::Style aStyles[ 7 ];
2468 : 9363 : aStyles[ 0 ] = rEntryStyle;
2469 [ + - ]: 9363 : FindStylesForLine( aStart, aEnd, aStyles, bHori );
2470 : :
2471 : : // subsidiary lines
2472 : 9363 : const Color* pTmpColor = 0;
2473 [ + + ]: 9363 : if ( 0 == aStyles[ 0 ].GetWidth() )
2474 : : {
2475 [ + - ][ + - ]: 74 : if ( IS_SUBS_TABLE && pGlobalShell->GetWin() )
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
2476 [ + - ]: 74 : aStyles[ 0 ].Set( rCol, rCol, rCol, false, 1, 0, 0 );
2477 : : }
2478 : : else
2479 : 9289 : pTmpColor = pHCColor;
2480 : :
2481 : : // The line sizes stored in the line style have to be adjusted as well.
2482 : : // This will guarantee that lines with the same twip size will have the
2483 : : // same pixel size.
2484 [ + + ]: 74904 : for ( int i = 0; i < 7; ++i )
2485 : : {
2486 : 65541 : sal_uInt16 nPrim = aStyles[ i ].Prim();
2487 : 65541 : sal_uInt16 nDist = aStyles[ i ].Dist();
2488 : 65541 : sal_uInt16 nSecn = aStyles[ i ].Secn();
2489 : :
2490 [ + + ]: 65541 : if ( nPrim > 0 )
2491 : 55289 : nPrim = (sal_uInt16)( Max( 1L, nPixelSzH * ( nPrim / nPixelSzH ) ) );
2492 [ + + ]: 65541 : if ( nDist > 0 )
2493 : 212 : nDist = (sal_uInt16)( Max( 1L, nPixelSzH * ( nDist / nPixelSzH ) ) );
2494 [ + + ]: 65541 : if ( nSecn > 0 )
2495 : 212 : nSecn = (sal_uInt16)( Max( 1L, nPixelSzH * ( nSecn / nPixelSzH ) ) );
2496 : :
2497 [ + - ]: 65541 : aStyles[ i ].Set( nPrim, nDist, nSecn );
2498 : : }
2499 : :
2500 : : // The (twip) positions will be adjusted to meet these requirements:
2501 : : // 1. The y coordinates are located in the middle of the pixel grid
2502 : : // 2. The x coordinated are located at the beginning of the pixel grid
2503 : : // This is done, because the horizontal lines are painted "at beginning",
2504 : : // whereas the vertical lines are painted "centered". By making the line
2505 : : // sizes a multiple of one pixel size, we can assure, that all lines having
2506 : : // the same twip size have the same pixel size, independent of their position
2507 : : // on the screen.
2508 [ + - ][ + - ]: 9363 : Point aPaintStart = rDev.PixelToLogic( rDev.LogicToPixel( aStart ) );
2509 [ + - ][ + - ]: 9363 : Point aPaintEnd = rDev.PixelToLogic( rDev.LogicToPixel( aEnd ) );
2510 : :
2511 [ + - ]: 9363 : if( pGlobalShell->GetWin() )
2512 : : {
2513 : : // The table borders do not use SwAlignRect, but all the other frames do.
2514 : : // Therefore we tweak the outer borders a bit to achieve that the outer
2515 : : // borders match the subsidiary lines of the upper:
2516 [ + + ]: 9363 : if ( aStart.X() == aUpper.Left() )
2517 : 2064 : aPaintStart.X() = aUpperAligned.Left();
2518 [ + - ][ + + ]: 7299 : else if ( aStart.X() == aUpper._Right() )
2519 [ + - ]: 710 : aPaintStart.X() = aUpperAligned._Right();
2520 [ + + ]: 9363 : if ( aStart.Y() == aUpper.Top() )
2521 : 1448 : aPaintStart.Y() = aUpperAligned.Top();
2522 [ + - ][ - + ]: 7915 : else if ( aStart.Y() == aUpper._Bottom() )
2523 [ # # ]: 0 : aPaintStart.Y() = aUpperAligned._Bottom();
2524 : :
2525 [ + + ]: 9363 : if ( aEnd.X() == aUpper.Left() )
2526 : 907 : aPaintEnd.X() = aUpperAligned.Left();
2527 [ + - ][ + + ]: 8456 : else if ( aEnd.X() == aUpper._Right() )
2528 [ + - ]: 1621 : aPaintEnd.X() = aUpperAligned._Right();
2529 [ + + ]: 9363 : if ( aEnd.Y() == aUpper.Top() )
2530 : 365 : aPaintEnd.Y() = aUpperAligned.Top();
2531 [ + - ][ - + ]: 8998 : else if ( aEnd.Y() == aUpper._Bottom() )
2532 [ # # ]: 0 : aPaintEnd.Y() = aUpperAligned._Bottom();
2533 : : }
2534 : :
2535 : : // logically vertical lines are painted centered on the line,
2536 : : // logically horizontal lines are painted "below" the line
2537 [ + - ][ - + ]: 9363 : bool const isBelow((mrTabFrm.IsVertical()) ? !bHori : bHori);
2538 : : double const offsetStart = (isBelow)
2539 : 4298 : ? aStyles[0].GetWidth() / 2.0
2540 : 5065 : : std::max<double>(aStyles[1].GetWidth(),
2541 [ + + ][ + - ]: 18726 : aStyles[3].GetWidth()) / 2.0;
[ + + ][ + + ]
[ # # # # ]
2542 : : double const offsetEnd = (isBelow)
2543 : 4298 : ? aStyles[0].GetWidth() / 2.0
2544 : 5065 : : std::max<double>(aStyles[4].GetWidth(),
2545 [ + + ][ + - ]: 18726 : aStyles[6].GetWidth()) / 2.0;
[ + + ][ + + ]
[ # # # # ]
2546 [ + - ][ - + ]: 9363 : if (mrTabFrm.IsVertical())
2547 : : {
2548 : 0 : aPaintStart.X() -= static_cast<long>(offsetStart + 0.5);
2549 : 0 : aPaintEnd.X() -= static_cast<long>(offsetEnd + 0.5);
2550 : : }
2551 : : else
2552 : : {
2553 : 9363 : aPaintStart.Y() += static_cast<long>(offsetStart + 0.5);
2554 : 9363 : aPaintEnd.Y() += static_cast<long>(offsetEnd + 0.5);
2555 : : }
2556 : :
2557 : 9363 : aPaintStart.X() -= nTwipXCorr; // nHalfPixelSzW - 2 to assure that we do not leave the pixel
2558 : 9363 : aPaintEnd.X() -= nTwipXCorr;
2559 : 9363 : aPaintStart.Y() -= nTwipYCorr;
2560 : 9363 : aPaintEnd.Y() -= nTwipYCorr;
2561 : :
2562 : : // Here comes the painting stuff: Thank you, DR, great job!!!
2563 [ + + ]: 9363 : if ( bHori )
2564 : : {
2565 : : mrTabFrm.ProcessPrimitives( svx::frame::CreateBorderPrimitives(
2566 : : aPaintStart,
2567 : : aPaintEnd,
2568 : : aStyles[ 0 ], // current style
2569 : : aStyles[ 1 ], // aLFromT
2570 : : aStyles[ 2 ], // aLFromL
2571 : : aStyles[ 3 ], // aLFromB
2572 : : aStyles[ 4 ], // aRFromT
2573 : : aStyles[ 5 ], // aRFromR
2574 : : aStyles[ 6 ], // aRFromB
2575 : : pTmpColor
2576 : : )
2577 [ + - ][ + - ]: 4298 : );
[ + - ]
2578 : : }
2579 : : else
2580 : : {
2581 : : mrTabFrm.ProcessPrimitives( svx::frame::CreateBorderPrimitives(
2582 : : aPaintEnd,
2583 : : aPaintStart,
2584 : : aStyles[ 0 ], // current style
2585 : : aStyles[ 4 ], // aBFromL
2586 : : aStyles[ 5 ], // aBFromB
2587 : : aStyles[ 6 ], // aBFromR
2588 : : aStyles[ 1 ], // aTFromL
2589 : : aStyles[ 2 ], // aTFromT
2590 : : aStyles[ 3 ], // aTFromR
2591 : : pTmpColor
2592 : : )
2593 [ + - ][ + - ]: 9363 : );
[ + - ]
2594 : : }
2595 : : }
2596 : :
2597 : 21889 : ++aSetIter;
2598 : : }
2599 : :
2600 : 6053 : ++aIter;
2601 : : }
2602 : :
2603 : : // restore output device:
2604 [ + - ]: 671 : rDev.Pop();
2605 [ + - ][ + - ]: 671 : rDev.SetDrawMode( nOldDrawMode );
2606 : 671 : }
2607 : :
2608 : : // Finds the lines that join the line defined by (StartPoint, EndPoint) in either
2609 : : // StartPoint or Endpoint. The styles of these lines are required for DR's magic
2610 : : // line painting functions.
2611 : 9363 : void SwTabFrmPainter::FindStylesForLine( const Point& rStartPoint,
2612 : : const Point& rEndPoint,
2613 : : svx::frame::Style* pStyles,
2614 : : bool bHori ) const
2615 : : {
2616 : : // pStyles[ 1 ] = bHori ? aLFromT : TFromL
2617 : : // pStyles[ 2 ] = bHori ? aLFromL : TFromT,
2618 : : // pStyles[ 3 ] = bHori ? aLFromB : TFromR,
2619 : : // pStyles[ 4 ] = bHori ? aRFromT : BFromL,
2620 : : // pStyles[ 5 ] = bHori ? aRFromR : BFromB,
2621 : : // pStyles[ 6 ] = bHori ? aRFromB : BFromR,
2622 : :
2623 [ + - ]: 9363 : SwLineEntryMapConstIter aMapIter = maVertLines.find( rStartPoint.X() );
2624 : : OSL_ENSURE( aMapIter != maVertLines.end(), "FindStylesForLine: Error" );
2625 : 9363 : const SwLineEntrySet& rVertSet = (*aMapIter).second;
2626 : 9363 : SwLineEntrySetConstIter aIter = rVertSet.begin();
2627 : :
2628 [ + + ]: 54718 : while ( aIter != rVertSet.end() )
2629 : : {
2630 : 45355 : const SwLineEntry& rEntry = *aIter;
2631 [ + + ]: 45355 : if ( bHori )
2632 : : {
2633 [ + + ]: 20780 : if ( rStartPoint.Y() == rEntry.mnStartPos )
2634 : 3712 : pStyles[ 3 ] = rEntry.maAttribute;
2635 [ + + ]: 17068 : else if ( rStartPoint.Y() == rEntry.mnEndPos )
2636 : 3867 : pStyles[ 1 ] = rEntry.maAttribute;
2637 : : }
2638 : : else
2639 : : {
2640 [ + + ]: 24575 : if ( rStartPoint.Y() == rEntry.mnEndPos )
2641 : 3901 : pStyles[ 2 ] = rEntry.maAttribute;
2642 [ + + ]: 20674 : else if ( rEndPoint.Y() == rEntry.mnStartPos )
2643 : 3813 : pStyles[ 5 ] = rEntry.maAttribute;
2644 : : }
2645 : 45355 : ++aIter;
2646 : : }
2647 : :
2648 [ + - ]: 9363 : aMapIter = maHoriLines.find( rStartPoint.Y() );
2649 : : OSL_ENSURE( aMapIter != maHoriLines.end(), "FindStylesForLine: Error" );
2650 : 9363 : const SwLineEntrySet& rHoriSet = (*aMapIter).second;
2651 : 9363 : aIter = rHoriSet.begin();
2652 : :
2653 [ + + ]: 47520 : while ( aIter != rHoriSet.end() )
2654 : : {
2655 : 38157 : const SwLineEntry& rEntry = *aIter;
2656 [ + + ]: 38157 : if ( bHori )
2657 : : {
2658 [ + + ]: 17794 : if ( rStartPoint.X() == rEntry.mnEndPos )
2659 : 3039 : pStyles[ 2 ] = rEntry.maAttribute;
2660 [ + + ]: 14755 : else if ( rEndPoint.X() == rEntry.mnStartPos )
2661 : 3317 : pStyles[ 5 ] = rEntry.maAttribute;
2662 : : }
2663 : : else
2664 : : {
2665 [ + + ]: 20363 : if ( rStartPoint.X() == rEntry.mnEndPos )
2666 : 4127 : pStyles[ 1 ] = rEntry.maAttribute;
2667 [ + + ]: 16236 : else if ( rStartPoint.X() == rEntry.mnStartPos )
2668 : 4342 : pStyles[ 3 ] = rEntry.maAttribute;
2669 : : }
2670 : 38157 : ++aIter;
2671 : : }
2672 : :
2673 [ + + ]: 9363 : if ( bHori )
2674 : : {
2675 [ + - ]: 4298 : aMapIter = maVertLines.find( rEndPoint.X() );
2676 : : OSL_ENSURE( aMapIter != maVertLines.end(), "FindStylesForLine: Error" );
2677 : 4298 : const SwLineEntrySet& rVertSet2 = (*aMapIter).second;
2678 : 4298 : aIter = rVertSet2.begin();
2679 : :
2680 [ + + ]: 25078 : while ( aIter != rVertSet2.end() )
2681 : : {
2682 : 20780 : const SwLineEntry& rEntry = *aIter;
2683 [ + + ]: 20780 : if ( rEndPoint.Y() == rEntry.mnStartPos )
2684 : 3712 : pStyles[ 6 ] = rEntry.maAttribute;
2685 [ + + ]: 17068 : else if ( rEndPoint.Y() == rEntry.mnEndPos )
2686 : 3867 : pStyles[ 4 ] = rEntry.maAttribute;
2687 : 20780 : ++aIter;
2688 : : }
2689 : : }
2690 : : else
2691 : : {
2692 [ + - ]: 5065 : aMapIter = maHoriLines.find( rEndPoint.Y() );
2693 : : OSL_ENSURE( aMapIter != maHoriLines.end(), "FindStylesForLine: Error" );
2694 : 5065 : const SwLineEntrySet& rHoriSet2 = (*aMapIter).second;
2695 : 5065 : aIter = rHoriSet2.begin();
2696 : :
2697 [ + + ]: 25428 : while ( aIter != rHoriSet2.end() )
2698 : : {
2699 : 20363 : const SwLineEntry& rEntry = *aIter;
2700 [ + + ]: 20363 : if ( rEndPoint.X() == rEntry.mnEndPos )
2701 : 4127 : pStyles[ 4 ] = rEntry.maAttribute;
2702 [ + + ]: 16236 : else if ( rEndPoint.X() == rEntry.mnStartPos )
2703 : 4342 : pStyles[ 6 ] = rEntry.maAttribute;
2704 : 20363 : ++aIter;
2705 : : }
2706 : : }
2707 : 9363 : }
2708 : :
2709 : : // special case: #i9860#
2710 : : // first line in follow table without repeated headlines
2711 : 8589 : static bool lcl_IsFirstRowInFollowTableWithoutRepeatedHeadlines(
2712 : : SwTabFrm const& rTabFrm, SwFrm const& rFrm, SvxBoxItem const& rBoxItem)
2713 : : {
2714 : : SwRowFrm const*const pThisRowFrm =
2715 [ - + ]: 8589 : dynamic_cast<const SwRowFrm*>(rFrm.GetUpper());
2716 : : return (pThisRowFrm
2717 : 8589 : && (pThisRowFrm->GetUpper() == &rTabFrm)
2718 : 8589 : && rTabFrm.IsFollow()
2719 : 0 : && !rTabFrm.GetTable()->GetRowsToRepeat()
2720 : 0 : && ( !pThisRowFrm->GetPrev()
2721 : 0 : || static_cast<const SwRowFrm*>(pThisRowFrm->GetPrev())
2722 : 0 : ->IsRowSpanLine())
2723 : 0 : && !rBoxItem.GetTop()
2724 [ + - + - : 25767 : && rBoxItem.GetBottom());
- + # # #
# # # #
# ][ # # ]
2725 : : }
2726 : :
2727 : 8589 : void SwTabFrmPainter::Insert( const SwFrm& rFrm, const SvxBoxItem& rBoxItem )
2728 : : {
2729 : : // build 4 line entries for the 4 borders:
2730 : 8589 : SwRect aBorderRect = rFrm.Frm();
2731 [ - + ]: 8589 : if ( rFrm.IsTabFrm() )
2732 : : {
2733 : 0 : aBorderRect = rFrm.Prt();
2734 : 0 : aBorderRect.Pos() += rFrm.Frm().Pos();
2735 : : }
2736 : :
2737 : : bool const bBottomAsTop(lcl_IsFirstRowInFollowTableWithoutRepeatedHeadlines(
2738 [ + - ]: 8589 : mrTabFrm, rFrm, rBoxItem));
2739 [ + - ]: 8589 : bool const bVert = mrTabFrm.IsVertical();
2740 [ + - ]: 8589 : bool const bR2L = mrTabFrm.IsRightToLeft();
2741 : :
2742 [ + - ]: 8589 : svx::frame::Style aL( rBoxItem.GetLeft() );
2743 [ + - ]: 8589 : svx::frame::Style aR( rBoxItem.GetRight() );
2744 [ + - ]: 8589 : svx::frame::Style aT( rBoxItem.GetTop() );
2745 [ + - ]: 8589 : svx::frame::Style aB( rBoxItem.GetBottom() );
2746 : :
2747 [ + - ]: 8589 : aR.MirrorSelf();
2748 [ + - ]: 8589 : aB.MirrorSelf();
2749 : :
2750 [ + - ]: 8589 : const SwTwips nLeft = aBorderRect._Left();
2751 [ + - ]: 8589 : const SwTwips nRight = aBorderRect._Right();
2752 [ + - ]: 8589 : const SwTwips nTop = aBorderRect._Top();
2753 [ + - ]: 8589 : const SwTwips nBottom = aBorderRect._Bottom();
2754 : :
2755 : 8589 : aL.SetRefMode( svx::frame::REFMODE_CENTERED );
2756 : 8589 : aR.SetRefMode( svx::frame::REFMODE_CENTERED );
2757 [ + - ]: 8589 : aT.SetRefMode( !bVert ? svx::frame::REFMODE_BEGIN : svx::frame::REFMODE_END );
2758 [ + - ]: 8589 : aB.SetRefMode( !bVert ? svx::frame::REFMODE_BEGIN : svx::frame::REFMODE_END );
2759 : :
2760 : : SwLineEntry aLeft (nLeft, nTop, nBottom,
2761 [ - + ][ - + ]: 8589 : (bVert) ? aB : ((bR2L) ? aR : aL));
2762 : : SwLineEntry aRight (nRight, nTop, nBottom,
2763 [ # # ][ - + ]: 8589 : (bVert) ? ((bBottomAsTop) ? aB : aT) : ((bR2L) ? aL : aR));
[ - + ]
2764 : : SwLineEntry aTop (nTop, nLeft, nRight,
2765 [ - + ][ - + ]: 8589 : (bVert) ? aL : ((bBottomAsTop) ? aB : aT));
2766 : : SwLineEntry aBottom(nBottom, nLeft, nRight,
2767 [ - + ]: 8589 : (bVert) ? aR : aB);
2768 : :
2769 [ + - ]: 8589 : Insert( aLeft, false );
2770 [ + - ]: 8589 : Insert( aRight, false );
2771 [ + - ]: 8589 : Insert( aTop, true );
2772 [ + - ]: 8589 : Insert( aBottom, true );
2773 : 8589 : }
2774 : :
2775 : 34356 : void SwTabFrmPainter::Insert( SwLineEntry& rNew, bool bHori )
2776 : : {
2777 : : // get all lines from structure, that have key entry of pLE
2778 [ + + ]: 34356 : SwLineEntryMap* pLine2 = bHori ? &maHoriLines : &maVertLines;
2779 : 34356 : const SwTwips nKey = rNew.mnKey;
2780 [ + - ]: 34356 : SwLineEntryMapIter aMapIter = pLine2->find( nKey );
2781 : :
2782 [ + + ]: 34356 : SwLineEntrySet* pLineSet = aMapIter != pLine2->end() ? &((*aMapIter).second) : 0;
2783 [ + + ]: 34356 : if ( !pLineSet )
2784 : : {
2785 [ + - ]: 6053 : SwLineEntrySet aNewSet;
2786 [ + - ][ + - ]: 6053 : (*pLine2)[ nKey ] = aNewSet;
2787 [ + - ]: 6053 : pLineSet = &(*pLine2)[ nKey ];
2788 : : }
2789 : 34356 : SwLineEntrySetIter aIter = pLineSet->begin();
2790 : :
2791 [ + - ][ + + ]: 92054 : while ( pLineSet && aIter != pLineSet->end() && rNew.mnStartPos < rNew.mnEndPos )
[ + - ][ + - ]
[ + + ]
2792 : : {
2793 : 70165 : const SwLineEntry& rOld = *aIter;
2794 : 70165 : const SwLineEntry::OverlapType nOverlapType = rOld.Overlaps( rNew );
2795 : :
2796 : 70165 : const svx::frame::Style& rOldAttr = rOld.maAttribute;
2797 : 70165 : const svx::frame::Style& rNewAttr = rNew.maAttribute;
2798 [ + + ][ + - ]: 70165 : const svx::frame::Style& rCmpAttr = rNewAttr > rOldAttr ? rNewAttr : rOldAttr;
2799 : :
2800 [ - + ]: 70165 : if ( SwLineEntry::OVERLAP1 == nOverlapType )
2801 : : {
2802 : : OSL_ENSURE( rNew.mnStartPos >= rOld.mnStartPos, "Overlap type 3? How this?" );
2803 : :
2804 : : // new left segment
2805 : 0 : const SwLineEntry aLeft( nKey, rOld.mnStartPos, rNew.mnStartPos, rOldAttr );
2806 : :
2807 : : // new middle segment
2808 : 0 : const SwLineEntry aMiddle( nKey, rNew.mnStartPos, rOld.mnEndPos, rCmpAttr );
2809 : :
2810 : : // new right segment
2811 : 0 : rNew.mnStartPos = rOld.mnEndPos;
2812 : :
2813 : : // update current lines set
2814 [ # # ]: 0 : pLineSet->erase( aIter );
2815 [ # # ][ # # ]: 0 : if ( aLeft.mnStartPos < aLeft.mnEndPos ) pLineSet->insert( aLeft );
2816 [ # # ][ # # ]: 0 : if ( aMiddle.mnStartPos < aMiddle.mnEndPos ) pLineSet->insert( aMiddle );
2817 : :
2818 : 0 : aIter = pLineSet->begin();
2819 : :
2820 : 0 : continue; // start over
2821 : : }
2822 [ + + ]: 70165 : else if ( SwLineEntry::OVERLAP2 == nOverlapType )
2823 : : {
2824 : : // new left segment
2825 : 12467 : const SwLineEntry aLeft( nKey, rOld.mnStartPos, rNew.mnStartPos, rOldAttr );
2826 : :
2827 : : // new middle segment
2828 : 12467 : const SwLineEntry aMiddle( nKey, rNew.mnStartPos, rNew.mnEndPos, rCmpAttr );
2829 : :
2830 : : // new right segment
2831 : 12467 : const SwLineEntry aRight( nKey, rNew.mnEndPos, rOld.mnEndPos, rOldAttr );
2832 : :
2833 : : // update current lines set
2834 [ + - ]: 12467 : pLineSet->erase( aIter );
2835 [ - + ][ # # ]: 12467 : if ( aLeft.mnStartPos < aLeft.mnEndPos ) pLineSet->insert( aLeft );
2836 [ + - ][ + - ]: 12467 : if ( aMiddle.mnStartPos < aMiddle.mnEndPos ) pLineSet->insert( aMiddle );
2837 [ - + ][ # # ]: 12467 : if ( aRight.mnStartPos < aRight.mnEndPos ) pLineSet->insert( aRight );
2838 : :
2839 : 12467 : rNew.mnStartPos = rNew.mnEndPos; // rNew should not be inserted!
2840 : :
2841 : : break; // we are finished
2842 : : }
2843 [ - + ]: 57698 : else if ( SwLineEntry::OVERLAP3 == nOverlapType )
2844 : : {
2845 : : // new left segment
2846 : 0 : const SwLineEntry aLeft( nKey, rNew.mnStartPos, rOld.mnStartPos, rNewAttr );
2847 : :
2848 : : // new middle segment
2849 : 0 : const SwLineEntry aMiddle( nKey, rOld.mnStartPos, rNew.mnEndPos, rCmpAttr );
2850 : :
2851 : : // new right segment
2852 : 0 : const SwLineEntry aRight( nKey, rNew.mnEndPos, rOld.mnEndPos, rOldAttr );
2853 : :
2854 : : // update current lines set
2855 [ # # ]: 0 : pLineSet->erase( aIter );
2856 [ # # ][ # # ]: 0 : if ( aLeft.mnStartPos < aLeft.mnEndPos ) pLineSet->insert( aLeft );
2857 [ # # ][ # # ]: 0 : if ( aMiddle.mnStartPos < aMiddle.mnEndPos ) pLineSet->insert( aMiddle );
2858 [ # # ][ # # ]: 0 : if ( aRight.mnStartPos < aRight.mnEndPos ) pLineSet->insert( aRight );
2859 : :
2860 : 0 : rNew.mnStartPos = rNew.mnEndPos; // rNew should not be inserted!
2861 : :
2862 : : break; // we are finished
2863 : : }
2864 : :
2865 : 57698 : ++aIter;
2866 : : }
2867 : :
2868 [ + + ]: 34356 : if ( rNew.mnStartPos < rNew.mnEndPos ) // insert rest
2869 [ + - ]: 21889 : pLineSet->insert( rNew );
2870 : 34356 : }
2871 : :
2872 : : //
2873 : : // FUNCTIONS USED FOR COLLAPSING TABLE BORDER LINES END
2874 : : //
2875 : :
2876 : : // --> OD #i76669#
2877 : : namespace
2878 : : {
2879 : : class SwViewObjectContactRedirector : public ::sdr::contact::ViewObjectContactRedirector
2880 : : {
2881 : : private:
2882 : : const ViewShell& mrViewShell;
2883 : :
2884 : : public:
2885 : 12540 : SwViewObjectContactRedirector( const ViewShell& rSh )
2886 : 12540 : : mrViewShell( rSh )
2887 : 12540 : {};
2888 : :
2889 : 12540 : virtual ~SwViewObjectContactRedirector()
2890 [ - + ]: 12540 : {}
2891 : :
2892 : 659 : virtual drawinglayer::primitive2d::Primitive2DSequence createRedirectedPrimitive2DSequence(
2893 : : const sdr::contact::ViewObjectContact& rOriginal,
2894 : : const sdr::contact::DisplayInfo& rDisplayInfo)
2895 : : {
2896 : 659 : sal_Bool bPaint( sal_True );
2897 : :
2898 : 659 : SdrObject* pObj = rOriginal.GetViewContact().TryToGetSdrObject();
2899 [ + - ]: 659 : if ( pObj )
2900 : : {
2901 : 659 : bPaint = SwFlyFrm::IsPaint( pObj, &mrViewShell );
2902 : : }
2903 : :
2904 [ - + ]: 659 : if ( !bPaint )
2905 : : {
2906 : 0 : return drawinglayer::primitive2d::Primitive2DSequence();
2907 : : }
2908 : :
2909 : : return sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(
2910 : 659 : rOriginal, rDisplayInfo );
2911 : : }
2912 : : };
2913 : :
2914 : : } // end of anonymous namespace
2915 : : // <--
2916 : : /*************************************************************************
2917 : : |*
2918 : : |* SwRootFrm::Paint()
2919 : : |*
2920 : : |* Description
2921 : : |* Paint once for every visible page which is touched by Rect.
2922 : : |* 1. Paint borders and backgrounds.
2923 : : |* 2. Paint the draw layer (frames and drawing objects) that is
2924 : : |* below the document (hell).
2925 : : |* 3. Paint the document content (text)
2926 : : |* 4. Paint the draw layer that is above the document.
2927 : : |*************************************************************************/
2928 : :
2929 : : void
2930 : 12421 : SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const
2931 : : {
2932 : : OSL_ENSURE( Lower() && Lower()->IsPageFrm(), "Lower of root is no page." );
2933 : :
2934 : : PROTOCOL( this, PROT_FILE_INIT, 0, 0)
2935 : :
2936 : 12421 : sal_Bool bResetRootPaint = sal_False;
2937 : 12421 : ViewShell *pSh = pCurrShell;
2938 : :
2939 [ + + ]: 12421 : if ( pSh->GetWin() )
2940 : : {
2941 [ - + ][ # # ]: 12402 : if ( pSh->GetOut() == pSh->GetWin() && !pSh->GetWin()->IsVisible() )
[ # # ][ + - ]
2942 : : {
2943 : : return;
2944 : : }
2945 [ - + ]: 12402 : if ( SwRootFrm::bInPaint )
2946 : : {
2947 [ # # ]: 0 : SwPaintQueue::Add( pSh, rRect );
2948 : : return;
2949 : : }
2950 : : }
2951 : : else
2952 : 19 : SwRootFrm::bInPaint = bResetRootPaint = sal_True;
2953 : :
2954 : 12421 : SwSavePaintStatics *pStatics = 0;
2955 [ - + ]: 12421 : if ( pGlobalShell )
2956 [ # # ]: 0 : pStatics = new SwSavePaintStatics();
2957 : 12421 : pGlobalShell = pSh;
2958 : :
2959 [ + + ]: 12421 : if( !pSh->GetWin() )
2960 [ + - ]: 19 : pProgress = SfxProgress::GetActiveProgress( (SfxObjectShell*) pSh->GetDoc()->GetDocShell() );
2961 : :
2962 [ + - ]: 12421 : ::SwCalcPixStatics( pSh->GetOut() );
2963 [ + - ]: 12421 : aGlobalRetoucheColor = pSh->Imp()->GetRetoucheColor();
2964 : :
2965 : : //Trigger an action to clear things up if needed.
2966 : : //Using this trick we can ensure that all values are valid in all paints -
2967 : : //no problems, no special case(s).
2968 : : // #i92745#
2969 : : // Extend check on certain states of the 'current' <ViewShell> instance to
2970 : : // all existing <ViewShell> instances.
2971 : 12421 : bool bPerformLayoutAction( true );
2972 : : {
2973 : 12421 : ViewShell* pTmpViewShell = pSh;
2974 [ + + ][ + + ]: 12440 : do {
[ + + ]
2975 [ + + + + : 17407 : if ( pTmpViewShell->IsInEndAction() ||
- + # # ]
[ + + ]
2976 : 4929 : pTmpViewShell->IsPaintInProgress() ||
2977 : 38 : ( pTmpViewShell->Imp()->IsAction() &&
2978 : 0 : pTmpViewShell->Imp()->GetLayAction().IsActionInProgress() ) )
2979 : : {
2980 : 12402 : bPerformLayoutAction = false;
2981 : : }
2982 : :
2983 : 12440 : pTmpViewShell = static_cast<ViewShell*>(pTmpViewShell->GetNext());
2984 : : } while ( bPerformLayoutAction && pTmpViewShell != pSh );
2985 : : }
2986 [ + + ]: 12421 : if ( bPerformLayoutAction )
2987 : : {
2988 : 19 : ((SwRootFrm*)this)->ResetTurbo();
2989 [ + - ]: 19 : SwLayAction aAction( (SwRootFrm*)this, pSh->Imp() );
2990 : 19 : aAction.SetPaint( sal_False );
2991 : 19 : aAction.SetComplete( sal_False );
2992 [ - + ]: 19 : aAction.SetReschedule( pProgress ? sal_True : sal_False );
2993 [ + - ]: 19 : aAction.Action();
2994 : 19 : ((SwRootFrm*)this)->ResetTurboFlag();
2995 [ + - ]: 19 : if ( !pSh->ActionPend() )
2996 [ + - ][ + - ]: 19 : pSh->Imp()->DelRegion();
2997 : : }
2998 : :
2999 : 12421 : SwRect aRect( rRect );
3000 [ + - ]: 12421 : aRect.Intersection( pSh->VisArea() );
3001 : :
3002 [ + - ][ + - ]: 12421 : const sal_Bool bExtraData = ::IsExtraData( GetFmt()->GetDoc() );
3003 : :
3004 [ + - ][ + - ]: 12421 : pLines = new SwLineRects; //Container for borders.
3005 : :
3006 : : // #104289#. During painting, something (OLE) can
3007 : : // load the linguistic, which in turn can cause a reformat
3008 : : // of the document. Dangerous! We better set this flag to
3009 : : // avoid the reformat.
3010 : 12421 : const sal_Bool bOldAction = IsCallbackActionEnabled();
3011 : 12421 : ((SwRootFrm*)this)->SetCallbackActionEnabled( sal_False );
3012 : :
3013 [ + - ]: 12421 : const SwPageFrm *pPage = pSh->Imp()->GetFirstVisPage();
3014 : :
3015 : 12421 : const bool bBookMode = pGlobalShell->GetViewOptions()->IsViewLayoutBookMode();
3016 [ # # ][ # # ]: 12421 : if ( bBookMode && pPage->GetPrev() && static_cast<const SwPageFrm*>(pPage->GetPrev())->IsEmptyPage() )
[ - + ][ - + ]
3017 : 0 : pPage = static_cast<const SwPageFrm*>(pPage->GetPrev());
3018 : :
3019 : : // #i68597#
3020 [ + + ][ + - ]: 12421 : const bool bGridPainting(pSh->GetWin() && pSh->Imp()->HasDrawView() && pSh->Imp()->GetDrawView()->IsGridVisible());
[ + + ]
3021 : :
3022 : : // Hide all page break controls before showing them again
3023 [ - + ]: 12421 : SwWrtShell* pWrtSh = dynamic_cast< SwWrtShell* >( pGlobalShell );
3024 [ + + ]: 12421 : if ( pWrtSh )
3025 : : {
3026 : 12402 : SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin();
3027 : 12402 : SwFrameControlsManager& rMngr = rEditWin.GetFrameControlsManager();
3028 : 12402 : const SwPageFrm* pHiddenPage = pPage;
3029 [ + + ]: 17844 : while ( pHiddenPage->GetPrev() != NULL )
3030 : : {
3031 : 5442 : pHiddenPage = static_cast< const SwPageFrm* >( pHiddenPage->GetPrev() );
3032 [ + - ]: 5442 : SwFrameControlPtr pControl = rMngr.GetControl( PageBreak, pHiddenPage );
3033 [ - + ]: 5442 : if ( pControl.get() )
3034 [ # # ]: 0 : pControl->ShowAll( false );
3035 [ + - ]: 5442 : }
3036 : : }
3037 : :
3038 : : // #i76669#
3039 [ + - ]: 12421 : SwViewObjectContactRedirector aSwRedirector( *pSh );
3040 : :
3041 [ + + ]: 25675 : while ( pPage )
3042 : : {
3043 [ + - ]: 13254 : const bool bPaintRightShadow = pPage->IsRightShadowNeeded();
3044 [ + - ]: 13254 : const bool bPaintLeftShadow = pPage->IsLeftShadowNeeded();
3045 [ + - ]: 13254 : const bool bRightSidebar = pPage->SidebarPosition() == sw::sidebarwindows::SIDEBAR_RIGHT;
3046 : :
3047 [ + - ]: 13254 : if ( !pPage->IsEmptyPage() )
3048 : : {
3049 : 13254 : SwRect aPaintRect;
3050 : 13254 : SwPageFrm::GetBorderAndShadowBoundRect( pPage->Frm(), pSh, aPaintRect,
3051 [ + - ]: 13254 : bPaintLeftShadow, bPaintRightShadow, bRightSidebar );
3052 : :
3053 [ + - ][ + + ]: 13254 : if ( aRect.IsOver( aPaintRect ) )
3054 : : {
3055 [ + + ]: 12259 : if ( pSh->GetWin() )
3056 : : {
3057 [ + - ][ + - ]: 12240 : pSubsLines = new SwSubsRects;
3058 [ + - ][ + - ]: 12240 : pSpecSubsLines = new SwSubsRects;
3059 : : }
3060 [ + - ][ + - ]: 12259 : g_pBorderLines = new BorderLines;
3061 : :
3062 [ + - ]: 12259 : aPaintRect._Intersection( aRect );
3063 : :
3064 [ + + + - : 12271 : if ( bExtraData &&
+ + ][ + + ]
3065 : 12 : pSh->GetWin() && pSh->IsInEndAction() )
3066 : : {
3067 : : // enlarge paint rectangle to complete page width, subtract
3068 : : // current paint area and invalidate the resulting region.
3069 [ + - ][ - + ]: 4 : SWRECTFN( pPage )
[ # # ][ # # ]
[ - + ]
3070 : 4 : SwRect aPageRectTemp( aPaintRect );
3071 : : (aPageRectTemp.*fnRect->fnSetLeftAndWidth)(
3072 : 4 : (pPage->Frm().*fnRect->fnGetLeft)(),
3073 [ + - ]: 8 : (pPage->Frm().*fnRect->fnGetWidth)() );
[ + - + - ]
[ + - ][ + - ]
[ + - ]
3074 [ + - ]: 4 : aPageRectTemp._Intersection( pSh->VisArea() );
3075 [ + - ][ + - ]: 4 : Region aPageRectRegion( aPageRectTemp.SVRect() );
3076 [ + - ][ + - ]: 4 : aPageRectRegion.Exclude( aPaintRect.SVRect() );
3077 [ + - ][ + - ]: 4 : pSh->GetWin()->Invalidate( aPageRectRegion, INVALIDATE_CHILDREN );
3078 : : }
3079 : :
3080 : : // #i80793#
3081 : : // enlarge paint rectangle for objects overlapping the same pixel
3082 : : // in all cases and before the DrawingLayer overlay is initialized.
3083 [ + - ]: 12259 : lcl_AdjustRectToPixelSize( aPaintRect, *(pSh->GetOut()) );
3084 : :
3085 : : // #i68597#
3086 : : // moved paint pre-process for DrawingLayer overlay here since the above
3087 : : // code dependent from bExtraData may expand the PaintRect
3088 : : {
3089 : : // #i75172# if called from ViewShell::ImplEndAction it sould no longer
3090 : : // really be used but handled by ViewShell::ImplEndAction already
3091 [ + - ][ + - ]: 12259 : const Region aDLRegion(aPaintRect.SVRect());
3092 [ + - ][ + - ]: 12259 : pSh->DLPrePaint2(aDLRegion);
3093 : : }
3094 : :
3095 [ - + ]: 12259 : if(OUTDEV_WINDOW == pGlobalShell->GetOut()->GetOutDevType())
3096 : : {
3097 : : /// OD 27.09.2002 #103636# - changed method SwLayVout::Enter(..)
3098 : : /// 2nd parameter is no longer <const> and will be set to the
3099 : : /// rectangle the virtual output device is calculated from <aPaintRect>,
3100 : : /// if the virtual output is used.
3101 [ # # ]: 0 : pVout->Enter( pSh, aPaintRect, !bNoVirDev );
3102 : :
3103 : : /// OD 27.09.2002 #103636# - adjust paint rectangle to pixel size
3104 : : /// Thus, all objects overlapping on pixel level with the unadjusted
3105 : : /// paint rectangle will be considered in the paint.
3106 [ # # ]: 0 : lcl_AdjustRectToPixelSize( aPaintRect, *(pSh->GetOut()) );
3107 : : }
3108 : :
3109 : : // maybe this can be put in the above scope. Since we are not sure, just leave it ATM
3110 : 12259 : pVout->SetOrgRect( aPaintRect );
3111 : :
3112 : : /// OD 29.08.2002 #102450#
3113 : : /// determine background color of page for <PaintLayer> method
3114 : : /// calls, paint <hell> or <heaven>
3115 [ + - ]: 12259 : const Color aPageBackgrdColor = pPage->GetDrawBackgrdColor();
3116 : :
3117 [ + - ]: 12259 : pPage->PaintBaBo( aPaintRect, pPage, sal_True );
3118 : :
3119 [ + - ]: 12259 : if ( pSh->Imp()->HasDrawView() )
3120 : : {
3121 [ + - ]: 12259 : pLines->LockLines( sal_True );
3122 [ + - ]: 12259 : const IDocumentDrawModelAccess* pIDDMA = pSh->getIDocumentDrawModelAccess();
3123 [ + - ]: 12259 : pSh->Imp()->PaintLayer( pIDDMA->GetHellId(),
3124 : : pPrintData,
3125 : : aPaintRect,
3126 : : &aPageBackgrdColor,
3127 [ + - ]: 12259 : (pPage->IsRightToLeft() ? true : false),
3128 [ + - ]: 12259 : &aSwRedirector );
3129 [ + - ]: 12259 : pLines->PaintLines( pSh->GetOut() );
3130 [ + - ]: 12259 : pLines->LockLines( sal_False );
3131 : : }
3132 : :
3133 [ + + ]: 12259 : if( pSh->GetWin() )
3134 : : {
3135 : : // collect sub-lines
3136 [ + - ]: 12240 : pPage->RefreshSubsidiary( aPaintRect );
3137 : : // paint special sub-lines
3138 [ + - ]: 12240 : pSpecSubsLines->PaintSubsidiary( pSh->GetOut(), NULL );
3139 : : }
3140 : :
3141 [ + - ]: 12259 : pPage->Paint( aPaintRect );
3142 : :
3143 : : // no paint of page border and shadow, if writer is in place mode.
3144 [ + + ][ + - ]: 24499 : if( pSh->GetWin() && pSh->GetDoc()->GetDocShell() &&
[ + - ][ + + ]
3145 [ + - ]: 12240 : !pSh->GetDoc()->GetDocShell()->IsInPlaceActive() )
3146 : : {
3147 [ + - ]: 12240 : SwPageFrm::PaintBorderAndShadow( pPage->Frm(), pSh, bPaintLeftShadow, bPaintRightShadow, bRightSidebar );
3148 [ + - ]: 12240 : SwPageFrm::PaintNotesSidebar( pPage->Frm(), pSh, pPage->GetPhyPageNum(), bRightSidebar);
3149 : : }
3150 : :
3151 [ + - ]: 12259 : pLines->PaintLines( pSh->GetOut() );
3152 [ + + ]: 12259 : if ( pSh->GetWin() )
3153 : : {
3154 [ + - ]: 12240 : pSubsLines->PaintSubsidiary( pSh->GetOut(), pLines );
3155 [ + - ]: 12240 : DELETEZ( pSubsLines );
3156 [ + - ]: 12240 : DELETEZ( pSpecSubsLines );
3157 : : }
3158 : : // fdo#42750: delay painting these until after subsidiary lines
3159 : : // fdo#45562: delay painting these until after hell layer
3160 : : // fdo#47717: but do it before heaven layer
3161 [ + - ][ + - ]: 12259 : ProcessPrimitives(g_pBorderLines->GetBorderLines_Clear());
[ + - ]
3162 : :
3163 [ + - ]: 12259 : if ( pSh->Imp()->HasDrawView() )
3164 : : {
3165 : : /// OD 29.08.2002 #102450# - add 3rd parameter
3166 : : // OD 09.12.2002 #103045# - add 4th parameter for horizontal text direction.
3167 [ + - ]: 12259 : pSh->Imp()->PaintLayer( pSh->GetDoc()->GetHeavenId(),
3168 : : pPrintData,
3169 : : aPaintRect,
3170 : : &aPageBackgrdColor,
3171 [ + - ]: 12259 : (pPage->IsRightToLeft() ? true : false),
3172 [ + - ]: 12259 : &aSwRedirector );
3173 : : }
3174 : :
3175 [ + + ]: 12259 : if ( bExtraData )
3176 [ + - ]: 6 : pPage->RefreshExtraData( aPaintRect );
3177 : :
3178 [ + - ][ + - ]: 12259 : DELETEZ(g_pBorderLines);
3179 [ + - ]: 12259 : pVout->Leave();
3180 : :
3181 : : // #i68597#
3182 : : // needed to move grid painting inside Begin/EndDrawLayer bounds and to change
3183 : : // output rect for it accordingly
3184 [ + + ]: 12259 : if(bGridPainting)
3185 : : {
3186 : 25 : SdrPaintView* pPaintView = pSh->Imp()->GetDrawView();
3187 : 25 : SdrPageView* pPageView = pPaintView->GetSdrPageView();
3188 [ + - ][ + - ]: 25 : pPageView->DrawPageViewGrid(*pSh->GetOut(), aPaintRect.SVRect(), SwViewOption::GetTextGridColor() );
[ + - ]
3189 : : }
3190 : :
3191 : : // #i68597#
3192 : : // moved paint post-process for DrawingLayer overlay here, see above
3193 : : {
3194 [ + - ]: 12259 : pSh->DLPostPaint2(true);
3195 : : }
3196 : : }
3197 : :
3198 [ + - ]: 13254 : pPage->PaintDecorators( );
3199 [ + - ]: 13254 : pPage->PaintBreak();
3200 : : }
3201 [ # # ][ # # ]: 0 : else if ( bBookMode && pSh->GetWin() && !pSh->GetDoc()->GetDocShell()->IsInPlaceActive() )
[ # # ][ # # ]
[ # # ]
3202 : : {
3203 : : // paint empty page
3204 : 0 : SwRect aPaintRect;
3205 : 0 : SwRect aEmptyPageRect( pPage->Frm() );
3206 : :
3207 : : // code from vprint.cxx
3208 [ # # ]: 0 : const SwPageFrm& rFormatPage = pPage->GetFormatPage();
3209 : 0 : aEmptyPageRect.SSize() = rFormatPage.Frm().SSize();
3210 : :
3211 : : SwPageFrm::GetBorderAndShadowBoundRect( aEmptyPageRect, pSh, aPaintRect,
3212 [ # # ]: 0 : bPaintLeftShadow, bPaintRightShadow, bRightSidebar );
3213 [ # # ]: 0 : aPaintRect._Intersection( aRect );
3214 : :
3215 [ # # ][ # # ]: 0 : if ( aRect.IsOver( aEmptyPageRect ) )
3216 : : {
3217 : : // #i75172# if called from ViewShell::ImplEndAction it sould no longer
3218 : : // really be used but handled by ViewShell::ImplEndAction already
3219 : : {
3220 [ # # ][ # # ]: 0 : const Region aDLRegion(aPaintRect.SVRect());
3221 [ # # ][ # # ]: 0 : pSh->DLPrePaint2(aDLRegion);
3222 : : }
3223 : :
3224 [ # # ]: 0 : if( pSh->GetOut()->GetFillColor() != aGlobalRetoucheColor )
3225 [ # # ]: 0 : pSh->GetOut()->SetFillColor( aGlobalRetoucheColor );
3226 : :
3227 [ # # ]: 0 : pSh->GetOut()->SetLineColor(); // OD 20.02.2003 #107369# - no line color
3228 : : // OD 20.02.2003 #107369# - use aligned page rectangle
3229 : : {
3230 : 0 : SwRect aTmpPageRect( aEmptyPageRect );
3231 [ # # ]: 0 : ::SwAlignRect( aTmpPageRect, pSh );
3232 : 0 : aEmptyPageRect = aTmpPageRect;
3233 : : }
3234 : :
3235 [ # # ][ # # ]: 0 : pSh->GetOut()->DrawRect( aEmptyPageRect.SVRect() );
3236 : :
3237 : : // paint empty page text
3238 [ # # ]: 0 : const Font& rEmptyPageFont = SwPageFrm::GetEmptyPageFont();
3239 [ # # ]: 0 : const Font aOldFont( pSh->GetOut()->GetFont() );
3240 : :
3241 [ # # ]: 0 : pSh->GetOut()->SetFont( rEmptyPageFont );
3242 : : pSh->GetOut()->DrawText( aEmptyPageRect.SVRect(), SW_RESSTR( STR_EMPTYPAGE ),
3243 : : TEXT_DRAW_VCENTER |
3244 : : TEXT_DRAW_CENTER |
3245 [ # # ][ # # ]: 0 : TEXT_DRAW_CLIP );
[ # # ][ # # ]
[ # # ]
3246 : :
3247 [ # # ]: 0 : pSh->GetOut()->SetFont( aOldFont );
3248 : : // paint shadow and border for empty page
3249 : : // OD 19.02.2003 #107369# - use new method to paint page border and
3250 : : // shadow
3251 [ # # ]: 0 : SwPageFrm::PaintBorderAndShadow( aEmptyPageRect, pSh, bPaintLeftShadow, bPaintRightShadow, bRightSidebar );
3252 [ # # ]: 0 : SwPageFrm::PaintNotesSidebar( aEmptyPageRect, pSh, pPage->GetPhyPageNum(), bRightSidebar);
3253 : :
3254 : : {
3255 [ # # ]: 0 : pSh->DLPostPaint2(true);
3256 [ # # ]: 0 : }
3257 : : }
3258 : : }
3259 : :
3260 : : OSL_ENSURE( !pPage->GetNext() || pPage->GetNext()->IsPageFrm(),
3261 : : "Neighbour of page is not a page." );
3262 : 13254 : pPage = (SwPageFrm*)pPage->GetNext();
3263 : : }
3264 : :
3265 [ + - ]: 12421 : DELETEZ( pLines );
3266 : :
3267 [ + + ]: 12421 : if ( bResetRootPaint )
3268 : 19 : SwRootFrm::bInPaint = sal_False;
3269 [ - + ]: 12421 : if ( pStatics )
3270 [ # # ]: 0 : delete pStatics;
3271 : : else
3272 : : {
3273 : 12421 : pProgress = 0;
3274 : 12421 : pGlobalShell = 0;
3275 : : }
3276 : :
3277 [ + - ]: 12421 : ((SwRootFrm*)this)->SetCallbackActionEnabled( bOldAction );
3278 : : }
3279 : :
3280 : : /*************************************************************************
3281 : : |*
3282 : : |* SwLayoutFrm::Paint()
3283 : : |*
3284 : : |*************************************************************************/
3285 : :
3286 : 107 : void lcl_EmergencyFormatFtnCont( SwFtnContFrm *pCont )
3287 : : {
3288 : : //It's possible that the Cont will get destroyed.
3289 : 107 : SwCntntFrm *pCnt = pCont->ContainsCntnt();
3290 [ + + ][ + - ]: 255 : while ( pCnt && pCnt->IsInFtn() )
[ + + ]
3291 : : {
3292 : 148 : pCnt->Calc();
3293 : 148 : pCnt = pCnt->GetNextCntntFrm();
3294 : : }
3295 : 107 : }
3296 : :
3297 : : class SwShortCut
3298 : : {
3299 : : SwRectDist fnCheck;
3300 : : long nLimit;
3301 : : public:
3302 : : SwShortCut( const SwFrm& rFrm, const SwRect& rRect );
3303 : 116292 : sal_Bool Stop( const SwRect& rRect ) const
3304 [ + - ]: 116292 : { return (rRect.*fnCheck)( nLimit ) > 0; }
3305 : : };
3306 : :
3307 : 100655 : SwShortCut::SwShortCut( const SwFrm& rFrm, const SwRect& rRect )
3308 : : {
3309 : 100655 : sal_Bool bVert = rFrm.IsVertical();
3310 : 100655 : sal_Bool bR2L = rFrm.IsRightToLeft();
3311 [ + - ][ + + ]: 100655 : if( rFrm.IsNeighbourFrm() && bVert == bR2L )
[ + + ]
3312 : : {
3313 [ - + ]: 7300 : if( bVert )
3314 : : {
3315 : 0 : fnCheck = &SwRect::GetBottomDistance;
3316 : 0 : nLimit = rRect.Top();
3317 : : }
3318 : : else
3319 : : {
3320 : 7300 : fnCheck = &SwRect::GetLeftDistance;
3321 : 7300 : nLimit = rRect.Left() + rRect.Width();
3322 : : }
3323 : : }
3324 [ + - ]: 93355 : else if( bVert == rFrm.IsNeighbourFrm() )
3325 : : {
3326 : 93355 : fnCheck = &SwRect::GetTopDistance;
3327 : 93355 : nLimit = rRect.Top() + rRect.Height();
3328 : : }
3329 : : else
3330 : : {
3331 : : //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
3332 [ # # ]: 0 : if ( rFrm.IsVertLR() )
3333 : : {
3334 : 0 : fnCheck = &SwRect::GetLeftDistance;
3335 : 0 : nLimit = rRect.Right();
3336 : : }
3337 : : else
3338 : : {
3339 : 0 : fnCheck = &SwRect::GetRightDistance;
3340 : 0 : nLimit = rRect.Left();
3341 : : }
3342 : : }
3343 : 100655 : }
3344 : :
3345 : 33830 : void SwLayoutFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
3346 : : {
3347 : 33830 : ViewShell *pSh = getRootFrm()->GetCurrShell();
3348 : :
3349 : : // #i16816# tagged pdf support
3350 : 33830 : Frm_Info aFrmInfo( *this );
3351 [ + - ]: 33830 : SwTaggedPDFHelper aTaggedPDFHelper( 0, &aFrmInfo, 0, *pSh->GetOut() );
3352 : :
3353 : 33830 : const SwFrm *pFrm = Lower();
3354 [ + + ]: 33830 : if ( !pFrm )
3355 : 33830 : return;
3356 : :
3357 [ + - ]: 33811 : SwShortCut aShortCut( *pFrm, rRect );
3358 : : sal_Bool bCnt;
3359 [ + + ]: 33811 : if ( sal_True == (bCnt = pFrm->IsCntntFrm()) )
3360 [ + - ]: 17197 : pFrm->Calc();
3361 : :
3362 [ - + ]: 33811 : if ( pFrm->IsFtnContFrm() )
3363 : : {
3364 [ # # ]: 0 : ::lcl_EmergencyFormatFtnCont( (SwFtnContFrm*)pFrm );
3365 : 0 : pFrm = Lower();
3366 : : }
3367 : :
3368 : 33811 : const SwPageFrm *pPage = 0;
3369 [ + + ]: 33811 : const sal_Bool bWin = pGlobalShell->GetWin() ? sal_True : sal_False;
3370 : :
3371 [ + - ][ + + ]: 84570 : while ( IsAnLower( pFrm ) )
3372 : : {
3373 [ + - ]: 50759 : SwRect aPaintRect( pFrm->PaintArea() );
3374 [ + - ][ + + ]: 50759 : if( aShortCut.Stop( aPaintRect ) )
3375 : : break;
3376 [ + + ][ - + ]: 49183 : if ( bCnt && pProgress )
3377 [ # # ]: 0 : pProgress->Reschedule();
3378 : :
3379 : : //We need to retouch if a frame explicitly requests it.
3380 : : //First do the retouch, because this could flatten the borders.
3381 [ + + ]: 49183 : if ( pFrm->IsRetouche() )
3382 : : {
3383 [ + - ][ + + ]: 3432 : if ( pFrm->IsRetoucheFrm() && bWin && !pFrm->GetNext() )
[ + + ][ + + ]
3384 [ + - ]: 2888 : { if ( !pPage )
3385 [ + - ]: 2888 : pPage = FindPageFrm();
3386 [ + - ]: 2888 : pFrm->Retouche( pPage, rRect );
3387 : : }
3388 : 3432 : pFrm->ResetRetouche();
3389 : : }
3390 : :
3391 [ + - ][ + + ]: 49183 : if ( rRect.IsOver( aPaintRect ) )
3392 : : {
3393 [ + + ][ + + ]: 50253 : if ( bCnt && pFrm->IsCompletePaint() &&
[ + + ][ - + ]
[ - + ]
3394 [ + - ][ + - ]: 8782 : !rRect.IsInside( aPaintRect ) && GetpApp()->AnyInput( VCL_INPUT_KEYBOARD ) )
[ + - ]
3395 : : {
3396 : : //fix(8104): It may happen, that the processing wasn't complete
3397 : : //but some parts of the paragraph were still repainted.
3398 : : //This could lead to the situation, that other parts of the
3399 : : //paragraph won't be repainted at all. The only solution seems
3400 : : //to be an invalidation of the window.
3401 : : //To not make it too severe the rectangle is limited by
3402 : : //painting the desired part and only invalidating the
3403 : : //remaining paragraph parts.
3404 [ # # # # ]: 0 : if ( aPaintRect.Left() == rRect.Left() &&
[ # # ]
3405 : 0 : aPaintRect.Right() == rRect.Right() )
3406 : : {
3407 : 0 : aPaintRect.Bottom( rRect.Top() - 1 );
3408 [ # # ]: 0 : if ( aPaintRect.Height() > 0 )
3409 [ # # ]: 0 : pGlobalShell->InvalidateWindows(aPaintRect);
3410 : 0 : aPaintRect.Top( rRect.Bottom() + 1 );
3411 : 0 : aPaintRect.Bottom( pFrm->Frm().Bottom() );
3412 [ # # ]: 0 : if ( aPaintRect.Height() > 0 )
3413 [ # # ]: 0 : pGlobalShell->InvalidateWindows(aPaintRect);
3414 : 0 : aPaintRect.Top( pFrm->Frm().Top() );
3415 : 0 : aPaintRect.Bottom( pFrm->Frm().Bottom() );
3416 : : }
3417 : : else
3418 : : {
3419 [ # # ]: 0 : pGlobalShell->InvalidateWindows( aPaintRect );
3420 : 0 : pFrm = pFrm->GetNext();
3421 [ # # ][ # # ]: 0 : if ( pFrm && (sal_True == (bCnt = pFrm->IsCntntFrm())) )
[ # # ]
3422 [ # # ]: 0 : pFrm->Calc();
3423 : 0 : continue;
3424 : : }
3425 : : }
3426 : 41471 : pFrm->ResetCompletePaint();
3427 [ + - ]: 41471 : aPaintRect._Intersection( rRect );
3428 : :
3429 [ + - ]: 41471 : pFrm->Paint( aPaintRect );
3430 : :
3431 [ + - ][ + + ]: 41471 : if ( Lower() && Lower()->IsColumnFrm() )
[ + + ]
3432 : : {
3433 : : //Paint the column separator line if needed. The page is
3434 : : //responsible for the page frame - not the upper.
3435 : 150 : const SwFrmFmt *pFmt = GetUpper() && GetUpper()->IsPageFrm()
3436 : 0 : ? GetUpper()->GetFmt()
3437 [ + - ][ + - : 150 : : GetFmt();
- + # # ]
3438 [ + - ]: 75 : const SwFmtCol &rCol = pFmt->GetCol();
3439 [ - + ]: 75 : if ( rCol.GetLineAdj() != COLADJ_NONE )
3440 : : {
3441 [ # # ]: 0 : if ( !pPage )
3442 [ # # ]: 0 : pPage = pFrm->FindPageFrm();
3443 : :
3444 [ # # ]: 0 : PaintColLines( aPaintRect, rCol, pPage );
3445 : : }
3446 : : }
3447 : : }
3448 [ + + ][ + + ]: 49183 : if ( !bCnt && pFrm->GetNext() && pFrm->GetNext()->IsFtnContFrm() )
[ + + ][ + + ]
3449 [ + - ]: 107 : ::lcl_EmergencyFormatFtnCont( (SwFtnContFrm*)pFrm->GetNext() );
3450 : :
3451 : 49183 : pFrm = pFrm->GetNext();
3452 : :
3453 [ + + ][ + + ]: 49183 : if ( pFrm && (sal_True == (bCnt = pFrm->IsCntntFrm())) )
[ + + ]
3454 [ + - ]: 50759 : pFrm->Calc();
3455 [ + - ][ + + ]: 33830 : }
3456 : : }
3457 : :
3458 : 0 : drawinglayer::primitive2d::Primitive2DSequence lcl_CreateDashedIndicatorPrimitive(
3459 : : basegfx::B2DPoint aStart, basegfx::B2DPoint aEnd,
3460 : : basegfx::BColor aColor )
3461 : : {
3462 [ # # ]: 0 : drawinglayer::primitive2d::Primitive2DSequence aSeq( 1 );
3463 : :
3464 [ # # ]: 0 : std::vector< double > aStrokePattern;
3465 [ # # ]: 0 : basegfx::B2DPolygon aLinePolygon;
3466 [ # # ]: 0 : aLinePolygon.append( aStart );
3467 [ # # ]: 0 : aLinePolygon.append( aEnd );
3468 : :
3469 [ # # ]: 0 : const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
3470 [ # # ]: 0 : if ( rSettings.GetHighContrastMode( ) )
3471 : : {
3472 : : // Only a solid line in high contrast mode
3473 [ # # ]: 0 : aColor = rSettings.GetDialogTextColor().getBColor();
3474 : : }
3475 : : else
3476 : : {
3477 : : // Get a color for the contrast
3478 [ # # ]: 0 : basegfx::BColor aHslLine = basegfx::tools::rgb2hsl( aColor );
3479 : 0 : double nLuminance = aHslLine.getZ() * 2.5;
3480 [ # # ]: 0 : if ( nLuminance == 0 )
3481 : 0 : nLuminance = 0.5;
3482 [ # # ]: 0 : else if ( nLuminance >= 1.0 )
3483 : 0 : nLuminance = aHslLine.getZ() * 0.4;
3484 : 0 : aHslLine.setZ( nLuminance );
3485 [ # # ]: 0 : const basegfx::BColor aOtherColor = basegfx::tools::hsl2rgb( aHslLine );
3486 : :
3487 : : // Compute the plain line
3488 : : drawinglayer::primitive2d::PolygonHairlinePrimitive2D * pPlainLine =
3489 : : new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
3490 [ # # ]: 0 : aLinePolygon, aOtherColor );
3491 : :
3492 [ # # ][ # # ]: 0 : aSeq[0] = drawinglayer::primitive2d::Primitive2DReference( pPlainLine );
[ # # ][ # # ]
3493 : :
3494 : :
3495 : : // Dashed line in twips
3496 [ # # ]: 0 : aStrokePattern.push_back( 40 );
3497 [ # # ]: 0 : aStrokePattern.push_back( 40 );
3498 : :
3499 [ # # ]: 0 : aSeq.realloc( 2 );
3500 : : }
3501 : :
3502 : : // Compute the dashed line primitive
3503 : : drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D * pLine =
3504 : : new drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D (
3505 : : basegfx::B2DPolyPolygon( aLinePolygon ),
3506 : : drawinglayer::attribute::LineAttribute( aColor ),
3507 [ # # ][ # # ]: 0 : drawinglayer::attribute::StrokeAttribute( aStrokePattern ) );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
3508 : :
3509 [ # # ][ # # ]: 0 : aSeq[ aSeq.getLength( ) - 1 ] = drawinglayer::primitive2d::Primitive2DReference( pLine );
[ # # ][ # # ]
3510 : :
3511 [ # # ]: 0 : return aSeq;
3512 : : }
3513 : :
3514 : 13254 : void SwPageFrm::PaintBreak( ) const
3515 : : {
3516 [ + - + - : 53008 : if ( pGlobalShell->GetOut()->GetOutDevType() != OUTDEV_PRINTER &&
+ + + - ]
[ + + ]
3517 : 13254 : !pGlobalShell->GetViewOptions()->IsPDFExport() &&
3518 : 13254 : !pGlobalShell->GetViewOptions()->IsReadonly() &&
3519 : 13246 : !pGlobalShell->IsPreView() )
3520 : : {
3521 : 13246 : const SwFrm* pBodyFrm = Lower();
3522 [ + - ][ + + ]: 13300 : while ( pBodyFrm && !pBodyFrm->IsBodyFrm() )
[ + + ]
3523 : 54 : pBodyFrm = pBodyFrm->GetNext();
3524 : :
3525 [ + - ]: 13246 : if ( pBodyFrm )
3526 : : {
3527 : 13246 : const SwLayoutFrm* pLayBody = static_cast< const SwLayoutFrm* >( pBodyFrm );
3528 [ + + ]: 13246 : const SwFlowFrm *pFlowFrm = pLayBody->ContainsCntnt();
3529 : :
3530 : : // Test if the first node is a table
3531 : 13246 : const SwFrm* pFirstFrm = pLayBody->Lower();
3532 [ + + ][ + + ]: 13246 : if ( pFirstFrm && pFirstFrm->IsTabFrm() )
[ + + ]
3533 [ + - ]: 667 : pFlowFrm = static_cast< const SwTabFrm* >( pFirstFrm );
3534 : :
3535 [ - + ]: 13246 : SwWrtShell* pWrtSh = dynamic_cast< SwWrtShell* >( pGlobalShell );
3536 [ + + ]: 13246 : if ( pWrtSh )
3537 : : {
3538 : 13219 : SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin();
3539 : 13219 : SwFrameControlsManager& rMngr = rEditWin.GetFrameControlsManager();
3540 : :
3541 [ + + ][ + + ]: 13219 : if ( pFlowFrm && pFlowFrm->IsPageBreak( sal_True ) )
[ + + ]
3542 : 30 : rMngr.SetPageBreakControl( this );
3543 : : else
3544 : 13189 : rMngr.RemoveControlsByType( PageBreak, this );
3545 : : }
3546 : : }
3547 : 13246 : SwLayoutFrm::PaintBreak( );
3548 : : }
3549 : 13254 : }
3550 : :
3551 : 79 : void SwColumnFrm::PaintBreak( ) const
3552 : : {
3553 [ + - + - : 316 : if ( pGlobalShell->GetOut()->GetOutDevType() != OUTDEV_PRINTER &&
+ - + - ]
[ + - ]
3554 : 79 : !pGlobalShell->GetViewOptions()->IsPDFExport() &&
3555 : 79 : !pGlobalShell->GetViewOptions()->IsReadonly() &&
3556 : 79 : !pGlobalShell->IsPreView() )
3557 : : {
3558 : 79 : const SwFrm* pBodyFrm = Lower();
3559 [ + - ][ - + ]: 79 : while ( pBodyFrm && !pBodyFrm->IsBodyFrm() )
[ - + ]
3560 : 0 : pBodyFrm = pBodyFrm->GetNext();
3561 : :
3562 [ + - ]: 79 : if ( pBodyFrm )
3563 : : {
3564 : 79 : const SwCntntFrm *pCnt = static_cast< const SwLayoutFrm* >( pBodyFrm )->ContainsCntnt();
3565 [ - + ][ - + ]: 79 : if ( pCnt && pCnt->IsColBreak( sal_True ) )
[ + + ]
3566 : : {
3567 : : // Paint the break only if:
3568 : : // * Not in header footer edition, to avoid conflicts with the
3569 : : // header/footer marker
3570 : : // * Non-printing characters are shown, as this is more consistent
3571 : : // with other formatting marks
3572 [ # # # # ]: 0 : if ( !pGlobalShell->IsShowHeaderFooterSeparator( Header ) &&
[ # # ]
3573 : 0 : !pGlobalShell->IsShowHeaderFooterSeparator( Footer ) )
3574 : : {
3575 : 0 : SwRect aRect( pCnt->Prt() );
3576 : 0 : aRect.Pos() += pCnt->Frm().Pos();
3577 : :
3578 : : // Draw the line
3579 : 0 : basegfx::B2DPoint aStart( double( aRect.Left() ), aRect.Top() );
3580 : 0 : basegfx::B2DPoint aEnd( double( aRect.Right() ), aRect.Top() );
3581 : 0 : double nWidth = aRect.Width();
3582 [ # # ][ # # ]: 0 : if ( IsVertical( ) )
3583 : : {
3584 : 0 : aStart = basegfx::B2DPoint( double( aRect.Right() ), double( aRect.Top() ) );
3585 : 0 : aEnd = basegfx::B2DPoint( double( aRect.Right() ), double( aRect.Bottom() ) );
3586 : 0 : nWidth = aRect.Height();
3587 : : }
3588 : :
3589 [ # # ]: 0 : basegfx::BColor aLineColor = SwViewOption::GetPageBreakColor().getBColor();
3590 : :
3591 : :
3592 : : drawinglayer::primitive2d::Primitive2DSequence aSeq =
3593 [ # # ]: 0 : lcl_CreateDashedIndicatorPrimitive( aStart, aEnd, aLineColor );
3594 [ # # ]: 0 : aSeq.realloc( aSeq.getLength( ) + 1 );
3595 : :
3596 : : // Add the text above
3597 [ # # ]: 0 : rtl::OUString aBreakText = SW_RESSTR(STR_COLUMN_BREAK);
3598 : :
3599 : 0 : basegfx::B2DVector aFontSize;
3600 : 0 : OutputDevice* pOut = pGlobalShell->GetOut();
3601 [ # # ]: 0 : Font aFont = pOut->GetSettings().GetStyleSettings().GetToolFont();
3602 [ # # ]: 0 : aFont.SetHeight( 8 * 20 );
3603 [ # # ]: 0 : pOut->SetFont( aFont );
3604 : : drawinglayer::attribute::FontAttribute aFontAttr = drawinglayer::primitive2d::getFontAttributeFromVclFont(
3605 [ # # ]: 0 : aFontSize, aFont, false, false );
3606 : :
3607 [ # # ]: 0 : Rectangle aTextRect;
3608 [ # # ][ # # ]: 0 : pOut->GetTextBoundRect( aTextRect, String( aBreakText ) );
[ # # ]
3609 [ # # ]: 0 : long nTextOff = ( nWidth - aTextRect.GetWidth() ) / 2;
3610 : :
3611 : : basegfx::B2DHomMatrix aTextMatrix( basegfx::tools::createScaleTranslateB2DHomMatrix(
3612 : : aFontSize.getX(), aFontSize.getY(),
3613 [ # # ]: 0 : aRect.Left() + nTextOff, aRect.Top() ) );
3614 [ # # ][ # # ]: 0 : if ( IsVertical() )
3615 : : {
3616 : : aTextMatrix = basegfx::B2DHomMatrix( basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix (
3617 : : aFontSize.getX(), aFontSize.getY(), 0.0, M_PI_2,
3618 [ # # ][ # # ]: 0 : aRect.Right(), aRect.Top() + nTextOff ) );
[ # # ]
3619 : : }
3620 : :
3621 : : drawinglayer::primitive2d::TextSimplePortionPrimitive2D * pText =
3622 : : new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
3623 : : aTextMatrix,
3624 : 0 : aBreakText, 0, aBreakText.getLength(),
3625 : : std::vector< double >(),
3626 : : aFontAttr,
3627 : : lang::Locale(),
3628 [ # # # # ]: 0 : aLineColor );
[ # # ][ # # ]
3629 [ # # ][ # # ]: 0 : aSeq[ aSeq.getLength() - 1 ] = drawinglayer::primitive2d::Primitive2DReference( pText );
[ # # ][ # # ]
3630 : :
3631 [ # # ][ # # ]: 0 : ProcessPrimitives( aSeq );
[ # # ][ # # ]
[ # # ]
3632 : : }
3633 : : }
3634 : : }
3635 : : }
3636 : 79 : }
3637 : :
3638 : 40425 : void SwLayoutFrm::PaintBreak( ) const
3639 : : {
3640 : 40425 : const SwFrm* pFrm = Lower();
3641 [ + + ]: 101150 : while ( pFrm )
3642 : : {
3643 [ + + ]: 60725 : if ( pFrm->IsLayoutFrm() )
3644 : 27258 : static_cast< const SwLayoutFrm*>( pFrm )->PaintBreak( );
3645 : 60725 : pFrm = pFrm->GetNext();
3646 : : }
3647 : 40425 : }
3648 : :
3649 : 13254 : void SwPageFrm::PaintDecorators( ) const
3650 : : {
3651 [ - + ]: 13254 : SwWrtShell* pWrtSh = dynamic_cast< SwWrtShell* >( pGlobalShell );
3652 [ + + ]: 13254 : if ( pWrtSh )
3653 : : {
3654 : 13227 : SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin();
3655 : :
3656 : 13227 : const SwLayoutFrm* pBody = FindBodyCont();
3657 [ + - ]: 13227 : if ( pBody )
3658 : : {
3659 : 13227 : SwRect aBodyRect( pBody->Frm() );
3660 : :
3661 [ - + ][ + - : 92421 : if ( pGlobalShell->GetOut()->GetOutDevType() != OUTDEV_PRINTER &&
+ - + - +
+ + + + -
- + ]
3662 : 13227 : !pGlobalShell->GetViewOptions()->IsPDFExport() &&
3663 : 13227 : !pGlobalShell->IsPreView() &&
3664 : 13227 : !pGlobalShell->GetViewOptions()->IsReadonly() &&
3665 : 13219 : !pGlobalShell->GetViewOptions()->getBrowseMode() &&
3666 : 13147 : ( pGlobalShell->IsShowHeaderFooterSeparator( Header ) ||
3667 : 13147 : pGlobalShell->IsShowHeaderFooterSeparator( Footer ) ) )
3668 : : {
3669 [ # # ][ # # ]: 0 : bool bRtl = Application::GetSettings().GetLayoutRTL();
3670 : 0 : const SwRect& rVisArea = pGlobalShell->VisArea();
3671 [ # # ]: 0 : long nXOff = std::min( aBodyRect.Right(), rVisArea.Right() );
3672 [ # # ]: 0 : if ( bRtl )
3673 [ # # ]: 0 : nXOff = std::max( aBodyRect.Left(), rVisArea.Left() );
3674 : :
3675 : : // Header
3676 [ # # ]: 0 : if ( pGlobalShell->IsShowHeaderFooterSeparator( Header ) )
3677 : : {
3678 : 0 : const SwFrm* pHeaderFrm = Lower();
3679 [ # # ]: 0 : if ( !pHeaderFrm->IsHeaderFrm() )
3680 : 0 : pHeaderFrm = NULL;
3681 : :
3682 : 0 : long nHeaderYOff = aBodyRect.Top();
3683 [ # # ]: 0 : Point nOutputOff = rEditWin.LogicToPixel( Point( nXOff, nHeaderYOff ) );
3684 [ # # ]: 0 : rEditWin.GetFrameControlsManager().SetHeaderFooterControl( this, Header, nOutputOff );
3685 : : }
3686 : :
3687 : : // Footer
3688 [ # # ]: 0 : if ( pGlobalShell->IsShowHeaderFooterSeparator( Footer ) )
3689 : : {
3690 : 0 : const SwFrm* pFtnContFrm = Lower();
3691 [ # # ]: 0 : while ( pFtnContFrm )
3692 : : {
3693 [ # # ]: 0 : if ( pFtnContFrm->IsFtnContFrm() )
3694 [ # # ]: 0 : aBodyRect.AddBottom( pFtnContFrm->Frm().Bottom() - aBodyRect.Bottom() );
3695 : 0 : pFtnContFrm = pFtnContFrm->GetNext();
3696 : : }
3697 : :
3698 : 0 : long nFooterYOff = aBodyRect.Bottom();
3699 [ # # ]: 0 : Point nOutputOff = rEditWin.LogicToPixel( Point( nXOff, nFooterYOff ) );
3700 [ # # ]: 13227 : rEditWin.GetFrameControlsManager().SetHeaderFooterControl( this, Footer, nOutputOff );
3701 : : }
3702 : : }
3703 : : }
3704 : : }
3705 : 13254 : }
3706 : :
3707 : : /** FlyFrm::IsBackgroundTransparent - for feature #99657#
3708 : :
3709 : : OD 12.08.2002
3710 : : determines, if background of fly frame has to be drawn transparent
3711 : : declaration found in /core/inc/flyfrm.cxx
3712 : : OD 08.10.2002 #103898# - If the background of the fly frame itself is not
3713 : : transparent and the background is inherited from its parent/grandparent,
3714 : : the background brush, used for drawing, has to be investigated for transparency.
3715 : :
3716 : : @author OD
3717 : :
3718 : : @return true, if background is transparent drawn.
3719 : : */
3720 : 1555 : sal_Bool SwFlyFrm::IsBackgroundTransparent() const
3721 : : {
3722 : 1555 : sal_Bool bBackgroundTransparent = GetFmt()->IsBackgroundTransparent();
3723 [ + - ]: 3110 : if ( !bBackgroundTransparent &&
[ + - + - ]
3724 : 1555 : static_cast<const SwFlyFrmFmt*>(GetFmt())->IsBackgroundBrushInherited() )
3725 : : {
3726 : 1555 : const SvxBrushItem* pBackgrdBrush = 0;
3727 : 1555 : const Color* pSectionTOXColor = 0;
3728 : 1555 : SwRect aDummyRect;
3729 [ - + ][ + - ]: 1555 : if ( GetBackgroundBrush( pBackgrdBrush, pSectionTOXColor, aDummyRect, false) )
3730 : : {
3731 [ # # # # : 0 : if ( pSectionTOXColor &&
# # ][ # # ]
3732 : 0 : (pSectionTOXColor->GetTransparency() != 0) &&
3733 : 0 : (pSectionTOXColor->GetColor() != COL_TRANSPARENT) )
3734 : : {
3735 : 0 : bBackgroundTransparent = sal_True;
3736 : : }
3737 [ # # ]: 0 : else if ( pBackgrdBrush )
3738 : : {
3739 [ # # # # ]: 0 : if ( (pBackgrdBrush->GetColor().GetTransparency() != 0) &&
[ # # ]
3740 [ # # ]: 0 : (pBackgrdBrush->GetColor() != COL_TRANSPARENT) )
3741 : : {
3742 : 0 : bBackgroundTransparent = sal_True;
3743 : : }
3744 : : else
3745 : : {
3746 : : const GraphicObject *pTmpGrf =
3747 [ # # ]: 0 : static_cast<const GraphicObject*>(pBackgrdBrush->GetGraphicObject());
3748 [ # # # # ]: 0 : if ( (pTmpGrf) &&
[ # # ]
3749 : 0 : (pTmpGrf->GetAttr().GetTransparency() != 0)
3750 : : )
3751 : : {
3752 : 1555 : bBackgroundTransparent = sal_True;
3753 : : }
3754 : : }
3755 : : }
3756 : : }
3757 : : }
3758 : :
3759 : 1555 : return bBackgroundTransparent;
3760 : : };
3761 : :
3762 : : /** FlyFrm::IsShadowTransparent - for feature #99657#
3763 : :
3764 : : OD 13.08.2002
3765 : : determine, if shadow color of fly frame has to be drawn transparent
3766 : : declaration found in /core/inc/flyfrm.cxx
3767 : :
3768 : : @author OD
3769 : :
3770 : : @return true, if shadow color is transparent.
3771 : : */
3772 : 739 : sal_Bool SwFlyFrm::IsShadowTransparent() const
3773 : : {
3774 : 739 : return GetFmt()->IsShadowTransparent();
3775 : : };
3776 : :
3777 : : /*************************************************************************
3778 : : |*
3779 : : |* SwFlyFrm::IsPaint()
3780 : : |*
3781 : : |*************************************************************************/
3782 : :
3783 : 1426 : sal_Bool SwFlyFrm::IsPaint( SdrObject *pObj, const ViewShell *pSh )
3784 : : {
3785 : : SdrObjUserCall *pUserCall;
3786 : :
3787 [ - + ]: 1426 : if ( 0 == ( pUserCall = GetUserCall(pObj) ) )
3788 : 0 : return sal_True;
3789 : :
3790 : : //Attribute dependant, don't paint for printer or PreView
3791 : : sal_Bool bPaint = pFlyOnlyDraw ||
3792 [ + - ][ + - ]: 1426 : ((SwContact*)pUserCall)->GetFmt()->GetPrint().GetValue();
3793 [ - + ]: 1426 : if ( !bPaint )
3794 [ # # ][ # # ]: 0 : bPaint = pSh->GetWin() && !pSh->IsPreView();
3795 : :
3796 [ + - ]: 1426 : if ( bPaint )
3797 : : {
3798 : : //The paint may be prevented by the superior Flys.
3799 : 1426 : SwFrm *pAnch = 0;
3800 [ + + ]: 1426 : if ( pObj->ISA(SwVirtFlyDrawObj) )
3801 : : {
3802 : 1368 : SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm();
3803 [ # # ][ - + ]: 1368 : if ( pFlyOnlyDraw && pFlyOnlyDraw == pFly )
3804 : 0 : return sal_True;
3805 : :
3806 : : //Try to avoid displaying the intermediate stage, Flys which don't
3807 : : //overlap with the page on which they are anchored won't be
3808 : : //painted.
3809 : : //HACK: exception: printing of frames in tables, those can overlap
3810 : : //a page once in a while when dealing with oversized tables (HTML).
3811 : 1368 : SwPageFrm *pPage = pFly->FindPageFrm();
3812 [ + - ]: 1368 : if ( pPage )
3813 : : {
3814 [ + - ]: 1368 : if ( pPage->Frm().IsOver( pFly->Frm() ) )
3815 : 1368 : pAnch = pFly->AnchorFrm();
3816 [ # # # # : 0 : else if ( bTableHack &&
# # # # ]
[ # # ]
3817 : 0 : pFly->Frm().Top() >= pFly->GetAnchorFrm()->Frm().Top() &&
3818 : 0 : pFly->Frm().Top() < pFly->GetAnchorFrm()->Frm().Bottom() &&
3819 : 0 : long(pSh->GetOut()) ==
3820 : 0 : long(pSh->getIDocumentDeviceAccess()->getPrinter( false ) ) )
3821 : : {
3822 : 0 : pAnch = pFly->AnchorFrm();
3823 : : }
3824 : : }
3825 : :
3826 : : }
3827 : : else
3828 : : {
3829 : : // OD 13.10.2003 #i19919# - consider 'virtual' drawing objects
3830 : : // OD 2004-03-29 #i26791#
3831 [ - + ]: 58 : SwDrawContact* pDrawContact = dynamic_cast<SwDrawContact*>(pUserCall);
3832 [ + - ]: 58 : pAnch = pDrawContact ? pDrawContact->GetAnchorFrm(pObj) : NULL;
3833 [ + - ]: 58 : if ( pAnch )
3834 : : {
3835 [ - + ]: 58 : if ( !pAnch->GetValidPosFlag() )
3836 : 0 : pAnch = 0;
3837 [ - + ]: 58 : else if ( long(pSh->GetOut()) == long(pSh->getIDocumentDeviceAccess()->getPrinter( false )))
3838 : : {
3839 : : //HACK: we have to omit some of the objects for printing,
3840 : : //otherwise they would be printed twice.
3841 : : //The objects should get printed if the TableHack is active
3842 : : //right now. Afterwards they must not be printed if the
3843 : : //page over which they float position wise gets printed.
3844 : 0 : const SwPageFrm *pPage = pAnch->FindPageFrm();
3845 [ # # ][ # # ]: 0 : if ( !bTableHack &&
[ # # ]
3846 [ # # ][ # # ]: 0 : !pPage->Frm().IsOver( pObj->GetCurrentBoundRect() ) )
[ # # ][ # # ]
[ # # ]
3847 : 0 : pAnch = 0;
3848 : : }
3849 : : }
3850 : : else
3851 : : {
3852 : : // OD 02.07.2003 #108784# - debug assert
3853 : 0 : if ( !pObj->ISA(SdrObjGroup) )
3854 : : {
3855 : : OSL_FAIL( "<SwFlyFrm::IsPaint(..)> - paint of drawing object without anchor frame!?" );
3856 : : }
3857 : : }
3858 : : }
3859 [ + - ]: 1426 : if ( pAnch )
3860 : : {
3861 [ - + ]: 1426 : if ( pAnch->IsInFly() )
3862 : 0 : bPaint = SwFlyFrm::IsPaint( pAnch->FindFlyFrm()->GetVirtDrawObj(),
3863 : 0 : pSh );
3864 [ - + ]: 1426 : else if ( pFlyOnlyDraw )
3865 : 0 : bPaint = sal_False;
3866 : : }
3867 : : else
3868 : 0 : bPaint = sal_False;
3869 : : }
3870 : 1426 : return bPaint;
3871 : : }
3872 : :
3873 : : /*************************************************************************
3874 : : |* SwCellFrm::Paint( const SwRect& ) const
3875 : : |*************************************************************************/
3876 : 4946 : void SwCellFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
3877 : : {
3878 [ + - ]: 4946 : if ( GetLayoutRowSpan() >= 1 )
3879 : 4946 : SwLayoutFrm::Paint( rRect );
3880 : 4946 : }
3881 : :
3882 : : /*************************************************************************
3883 : : |*
3884 : : |* SwFlyFrm::Paint()
3885 : : |*
3886 : : |*************************************************************************/
3887 : :
3888 : : struct BorderLinesGuard
3889 : : {
3890 : 534 : explicit BorderLinesGuard() : m_pBorderLines(g_pBorderLines)
3891 : : {
3892 [ + - ]: 534 : g_pBorderLines = new BorderLines;
3893 : 534 : }
3894 : 534 : ~BorderLinesGuard()
3895 : : {
3896 [ + - ]: 534 : delete g_pBorderLines;
3897 : 534 : g_pBorderLines = m_pBorderLines;
3898 : 534 : }
3899 : : private:
3900 : : BorderLines *const m_pBorderLines;
3901 : : };
3902 : :
3903 : 534 : void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
3904 : : {
3905 : : //because of the overlapping of frames and drawing objects the flys have to
3906 : : //paint their borders (and those of the internal ones) directly.
3907 : : //e.g. #33066#
3908 [ + - ]: 534 : pLines->LockLines(sal_True);
3909 [ + - ]: 534 : BorderLinesGuard blg; // this should not paint borders added from PaintBaBo
3910 : :
3911 : 534 : SwRect aRect( rRect );
3912 [ + - ]: 534 : aRect._Intersection( Frm() );
3913 : :
3914 : 534 : OutputDevice* pOut = pGlobalShell->GetOut();
3915 [ + - ]: 534 : pOut->Push( PUSH_CLIPREGION );
3916 [ + - ]: 534 : pOut->SetClipRegion();
3917 [ + - ]: 534 : const SwPageFrm* pPage = FindPageFrm();
3918 : :
3919 : 1068 : const SwNoTxtFrm *pNoTxt = Lower() && Lower()->IsNoTxtFrm()
3920 [ + - + + ]: 1068 : ? (SwNoTxtFrm*)Lower() : 0;
3921 : :
3922 : 534 : bool bIsChart = false; //#i102950# don't paint additional borders for charts
3923 : : //check whether we have a chart
3924 [ + + ]: 534 : if(pNoTxt)
3925 : : {
3926 [ - + ]: 263 : const SwNoTxtNode* pNoTNd = dynamic_cast<const SwNoTxtNode*>(pNoTxt->GetNode());
3927 [ + - ]: 263 : if( pNoTNd )
3928 : : {
3929 : 263 : SwOLENode* pOLENd = const_cast<SwOLENode*>(pNoTNd->GetOLENode());
3930 [ + - ][ + - ]: 263 : if( pOLENd && ChartPrettyPainter::IsChart( pOLENd->GetOLEObj().GetObject() ) )
[ + + ][ + + ]
[ + + ]
3931 : 29 : bIsChart = true;
3932 : : }
3933 : : }
3934 : :
3935 : : {
3936 [ + - ][ + - ]: 534 : bool bContour = GetFmt()->GetSurround().IsContour();
3937 [ + - ]: 534 : PolyPolygon aPoly;
3938 [ + + ]: 534 : if ( bContour )
3939 : : {
3940 : : // OD 16.04.2003 #i13147# - add 2nd parameter with value <sal_True>
3941 : : // to indicate that method is called for paint in order to avoid
3942 : : // load of the intrinsic graphic.
3943 [ + - ]: 8 : bContour = GetContour( aPoly, sal_True );
3944 : : }
3945 : :
3946 : : // #i47804# - distinguish complete background paint
3947 : : // and margin paint.
3948 : : // paint complete background for Writer text fly frames
3949 : 534 : bool bPaintCompleteBack( !pNoTxt );
3950 : : // paint complete background for transparent graphic and contour,
3951 : : // if own background color exists.
3952 [ + + ][ + - ]: 534 : const bool bIsGraphicTransparent = pNoTxt ? pNoTxt->IsTransparent() : false;
[ + - ]
3953 [ + + ][ - + ]: 534 : if ( !bPaintCompleteBack &&
[ # # ]
3954 : : ( bIsGraphicTransparent|| bContour ) )
3955 : : {
3956 [ + - ][ + - ]: 263 : const SvxBrushItem &rBack = GetFmt()->GetBackground();
3957 : : // OD 07.08.2002 #99657# #GetTransChg#
3958 : : // to determine, if background has to be painted, by checking, if
3959 : : // background color is not COL_TRANSPARENT ("no fill"/"auto fill")
3960 : : // or a background graphic exists.
3961 [ + - ]: 526 : bPaintCompleteBack = !(rBack.GetColor() == COL_TRANSPARENT) ||
3962 [ - + ][ + - ]: 263 : rBack.GetGraphicPos() != GPOS_NONE;
3963 : : }
3964 : : // paint of margin needed.
3965 : 534 : const bool bPaintMarginOnly( !bPaintCompleteBack &&
3966 [ + + ][ - + ]: 534 : Prt().SSize() != Frm().SSize() );
3967 : :
3968 : : // #i47804# - paint background of parent fly frame
3969 : : // for transparent graphics in layer Hell, if parent fly frame isn't
3970 : : // in layer Hell. It's only painted the intersection between the
3971 : : // parent fly frame area and the paint area <aRect>
3972 [ + - ][ + - ]: 534 : const IDocumentDrawModelAccess* pIDDMA = GetFmt()->getIDocumentDrawModelAccess();
3973 : :
3974 [ + + ][ + + ]: 800 : if ( bIsGraphicTransparent &&
[ - + ][ - + ]
3975 [ + - ][ + - ]: 263 : GetVirtDrawObj()->GetLayer() == pIDDMA->GetHellId() &&
[ + - ]
3976 [ + - ][ + - ]: 3 : GetAnchorFrm()->FindFlyFrm() )
3977 : : {
3978 [ # # ][ # # ]: 0 : const SwFlyFrm* pParentFlyFrm = GetAnchorFrm()->FindFlyFrm();
3979 [ # # ][ # # ]: 0 : if ( pParentFlyFrm->GetDrawObj()->GetLayer() !=
[ # # ]
3980 [ # # ]: 0 : pIDDMA->GetHellId() )
3981 : : {
3982 : 0 : SwFlyFrm* pOldRet = pRetoucheFly2;
3983 : 0 : pRetoucheFly2 = const_cast<SwFlyFrm*>(this);
3984 : :
3985 [ # # ]: 0 : SwBorderAttrAccess aAccess( SwFrm::GetCache(), pParentFlyFrm );
3986 [ # # ]: 0 : const SwBorderAttrs &rAttrs = *aAccess.Get();
3987 : 0 : SwRect aPaintRect( aRect );
3988 [ # # ]: 0 : aPaintRect._Intersection( pParentFlyFrm->Frm() );
3989 [ # # ]: 0 : pParentFlyFrm->PaintBackground( aPaintRect, pPage, rAttrs, sal_False, sal_False );
3990 : :
3991 [ # # ]: 0 : pRetoucheFly2 = pOldRet;
3992 : : }
3993 : : }
3994 : :
3995 [ + + ][ - + ]: 534 : if ( bPaintCompleteBack || bPaintMarginOnly )
3996 : : {
3997 : : //#24926# JP 01.02.96, PaintBaBo is here partially so PaintBorder
3998 : : //receives the original Rect but PaintBackground only the limited
3999 : : //one.
4000 : :
4001 : : // OD 2004-04-23 #116347#
4002 [ + - ]: 271 : pOut->Push( PUSH_FILLCOLOR|PUSH_LINECOLOR );
4003 [ + - ]: 271 : pOut->SetLineColor();
4004 : :
4005 [ + - ]: 271 : pPage = FindPageFrm();
4006 : :
4007 [ + - ]: 271 : SwBorderAttrAccess aAccess( SwFrm::GetCache(), (SwFrm*)this );
4008 [ + - ]: 271 : const SwBorderAttrs &rAttrs = *aAccess.Get();
4009 : :
4010 : : // paint background
4011 : : {
4012 [ + - ]: 271 : SwRegionRects aRegion( aRect );
4013 : : // #i80822#
4014 : : // suppress painting of background in printing area for
4015 : : // non-transparent graphics.
4016 [ + - ][ - + ]: 271 : if ( bPaintMarginOnly ||
[ # # ]
4017 : 0 : ( pNoTxt && !bIsGraphicTransparent ) )
4018 : : {
4019 : : //What we actually want to paint is the small stripe between
4020 : : //PrtArea and outer border.
4021 : 0 : SwRect aTmp( Prt() ); aTmp += Frm().Pos();
4022 [ # # ]: 0 : aRegion -= aTmp;
4023 : : }
4024 [ - + ]: 271 : if ( bContour )
4025 : : {
4026 [ # # ]: 0 : pOut->Push();
4027 : : // #i80822#
4028 : : // apply clip region under the same conditions, which are
4029 : : // used in <SwNoTxtFrm::Paint(..)> to set the clip region
4030 : : // for painting the graphic/OLE. Thus, the clip region is
4031 : : // also applied for the PDF export.
4032 : 0 : ViewShell *pSh = getRootFrm()->GetCurrShell();
4033 [ # # ][ # # ]: 0 : if ( !pOut->GetConnectMetaFile() || !pSh || !pSh->GetWin() )
[ # # ][ # # ]
4034 : : {
4035 [ # # ][ # # ]: 0 : pOut->SetClipRegion( aPoly );
[ # # ]
4036 : : }
4037 [ # # ]: 0 : for ( sal_uInt16 i = 0; i < aRegion.size(); ++i )
4038 [ # # ]: 0 : PaintBackground( aRegion[i], pPage, rAttrs, sal_False, sal_True );
4039 [ # # ]: 0 : pOut->Pop();
4040 : : }
4041 : : else
4042 [ + + ]: 542 : for ( sal_uInt16 i = 0; i < aRegion.size(); ++i )
4043 [ + - ]: 542 : PaintBackground( aRegion[i], pPage, rAttrs, sal_False, sal_True );
4044 : : }
4045 : :
4046 : : // OD 06.08.2002 #99657# - paint border before painting background
4047 : : // paint border
4048 : : {
4049 : 271 : SwRect aTmp( rRect );
4050 [ + - ]: 271 : PaintBorder( aTmp, pPage, rAttrs );
4051 : : }
4052 : :
4053 [ + - ][ + - ]: 271 : pOut->Pop();
4054 [ + - ]: 534 : }
4055 : : }
4056 : :
4057 : : // OD 19.12.2002 #106318# - fly frame will paint it's subsidiary lines and
4058 : : // the subsidiary lines of its lowers on its own, due to overlapping with
4059 : : // other fly frames or other objects.
4060 [ + - ][ + + ]: 534 : if( pGlobalShell->GetWin()
[ + + ]
4061 : 534 : && !bIsChart ) //#i102950# don't paint additional borders for charts
4062 : : {
4063 : : bool bSubsLineRectsCreated;
4064 [ + + ]: 505 : if ( pSubsLines )
4065 : : {
4066 : : // Lock already existing subsidiary lines
4067 [ + - ]: 233 : pSubsLines->LockLines( sal_True );
4068 : 233 : bSubsLineRectsCreated = false;
4069 : : }
4070 : : else
4071 : : {
4072 : : // create new subsidiardy lines
4073 [ + - ][ + - ]: 272 : pSubsLines = new SwSubsRects;
4074 : 272 : bSubsLineRectsCreated = true;
4075 : : }
4076 : :
4077 : : bool bSpecSubsLineRectsCreated;
4078 [ + + ]: 505 : if ( pSpecSubsLines )
4079 : : {
4080 : : // Lock already existing special subsidiary lines
4081 [ + - ]: 233 : pSpecSubsLines->LockLines( sal_True );
4082 : 233 : bSpecSubsLineRectsCreated = false;
4083 : : }
4084 : : else
4085 : : {
4086 : : // create new special subsidiardy lines
4087 [ + - ][ + - ]: 272 : pSpecSubsLines = new SwSubsRects;
4088 : 272 : bSpecSubsLineRectsCreated = true;
4089 : : }
4090 : : // Add subsidiary lines of fly frame and its lowers
4091 [ + - ]: 505 : RefreshLaySubsidiary( pPage, aRect );
4092 : : // paint subsidiary lines of fly frame and its lowers
4093 [ + - ]: 505 : pSpecSubsLines->PaintSubsidiary( pOut, NULL );
4094 [ + - ]: 505 : pSubsLines->PaintSubsidiary( pOut, pLines );
4095 [ + + ]: 505 : if ( !bSubsLineRectsCreated )
4096 : : // unlock subsidiary lines
4097 [ + - ]: 233 : pSubsLines->LockLines( sal_False );
4098 : : else
4099 : : // delete created subsidiary lines container
4100 [ + - ]: 272 : DELETEZ( pSubsLines );
4101 : :
4102 [ + + ]: 505 : if ( !bSpecSubsLineRectsCreated )
4103 : : // unlock special subsidiary lines
4104 [ + - ]: 233 : pSpecSubsLines->LockLines( sal_False );
4105 : : else
4106 : : {
4107 : : // delete created special subsidiary lines container
4108 [ + - ]: 272 : DELETEZ( pSpecSubsLines );
4109 : : }
4110 : : }
4111 : :
4112 [ + - ]: 534 : SwLayoutFrm::Paint( aRect );
4113 : :
4114 : 534 : Validate();
4115 : :
4116 : : // OD 19.12.2002 #106318# - first paint lines added by fly frame paint
4117 : : // and then unlock other lines.
4118 [ + - ]: 534 : pLines->PaintLines( pOut );
4119 [ + - ]: 534 : pLines->LockLines( sal_False );
4120 : : // have to paint frame borders added in heaven layer here...
4121 [ + - ][ + - ]: 534 : ProcessPrimitives(g_pBorderLines->GetBorderLines_Clear());
[ + - ]
4122 : :
4123 [ + - ]: 534 : pOut->Pop();
4124 : :
4125 [ - + ][ # # ]: 534 : if ( pProgress && pNoTxt )
4126 [ # # ][ + - ]: 534 : pProgress->Reschedule();
4127 : 534 : }
4128 : : /*************************************************************************
4129 : : |*
4130 : : |* SwTabFrm::Paint()
4131 : : |*
4132 : : |*************************************************************************/
4133 : :
4134 : 671 : void SwTabFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
4135 : : {
4136 [ + - ]: 671 : if ( pGlobalShell->GetViewOptions()->IsTable() )
4137 : : {
4138 : : // #i29550#
4139 [ + - ]: 671 : if ( IsCollapsingBorders() )
4140 : : {
4141 [ + - ]: 671 : SwBorderAttrAccess aAccess( SwFrm::GetCache(), (SwFrm*)this );
4142 [ + - ]: 671 : const SwBorderAttrs &rAttrs = *aAccess.Get();
4143 : :
4144 : : // paint shadow
4145 [ - + ]: 671 : if ( rAttrs.GetShadow().GetLocation() != SVX_SHADOW_NONE )
4146 : : {
4147 : 0 : SwRect aRect;
4148 [ # # ]: 0 : ::lcl_CalcBorderRect( aRect, this, rAttrs, sal_True );
4149 [ # # ]: 0 : PaintShadow( rRect, aRect, rAttrs );
4150 : : }
4151 : :
4152 : : // paint lines
4153 [ + - ]: 671 : SwTabFrmPainter aHelper( *this );
4154 [ + - ][ + - ]: 671 : aHelper.PaintLines( *pGlobalShell->GetOut(), rRect );
4155 : : }
4156 : : // <-- collapsing
4157 : :
4158 : 671 : SwLayoutFrm::Paint( rRect );
4159 : : }
4160 : : // OD 10.01.2003 #i6467# - no light grey rectangle for page preview
4161 [ # # ][ # # ]: 0 : else if ( pGlobalShell->GetWin() && !pGlobalShell->IsPreView() )
[ # # ]
4162 : : {
4163 : : // OD 10.01.2003 #i6467# - intersect output rectangle with table frame
4164 : 0 : SwRect aTabRect( Prt() );
4165 : 0 : aTabRect.Pos() += Frm().Pos();
4166 : 0 : SwRect aTabOutRect( rRect );
4167 [ # # ]: 0 : aTabOutRect.Intersection( aTabRect );
4168 : : pGlobalShell->GetViewOptions()->
4169 [ # # ]: 0 : DrawRect( pGlobalShell->GetOut(), aTabOutRect, COL_LIGHTGRAY );
4170 : : }
4171 : 671 : ((SwTabFrm*)this)->ResetComplete();
4172 : 671 : }
4173 : :
4174 : : /*************************************************************************
4175 : : |*
4176 : : |* SwFrm::PaintShadow()
4177 : : |*
4178 : : |* Description Paints a shadow if the format requests so.
4179 : : |* The shadow is always painted on the outer edge of the OutRect.
4180 : : |* If needed, the OutRect is shrunk so the painting of the border can be
4181 : : |* done on it.
4182 : : |*
4183 : : |*************************************************************************/
4184 : : /// OD 23.08.2002 #99657#
4185 : : /// draw full shadow rectangle for frames with transparent drawn backgrounds.
4186 : 0 : void SwFrm::PaintShadow( const SwRect& rRect, SwRect& rOutRect,
4187 : : const SwBorderAttrs &rAttrs ) const
4188 : : {
4189 : 0 : const SvxShadowItem &rShadow = rAttrs.GetShadow();
4190 [ # # ]: 0 : const long nWidth = ::lcl_AlignWidth ( rShadow.GetWidth() );
4191 [ # # ]: 0 : const long nHeight = ::lcl_AlignHeight( rShadow.GetWidth() );
4192 : :
4193 [ # # ]: 0 : SwRects aRegion( 2 );
4194 : 0 : SwRect aOut( rOutRect );
4195 : :
4196 : 0 : const sal_Bool bCnt = IsCntntFrm();
4197 [ # # ][ # # ]: 0 : const sal_Bool bTop = !bCnt || rAttrs.GetTopLine ( *(this) ) ? sal_True : sal_False;
[ # # ]
4198 [ # # ][ # # ]: 0 : const sal_Bool bBottom = !bCnt || rAttrs.GetBottomLine( *(this) ) ? sal_True : sal_False;
[ # # ]
4199 : :
4200 : 0 : SvxShadowLocation eLoc = rShadow.GetLocation();
4201 : :
4202 [ # # ][ # # ]: 0 : SWRECTFN( this )
[ # # ][ # # ]
[ # # ]
4203 [ # # ][ # # ]: 0 : if( IsVertical() )
4204 : : {
4205 [ # # # # : 0 : switch( eLoc )
# ]
4206 : : {
4207 : 0 : case SVX_SHADOW_BOTTOMRIGHT: eLoc = SVX_SHADOW_BOTTOMLEFT; break;
4208 : 0 : case SVX_SHADOW_TOPLEFT: eLoc = SVX_SHADOW_TOPRIGHT; break;
4209 : 0 : case SVX_SHADOW_TOPRIGHT: eLoc = SVX_SHADOW_BOTTOMRIGHT; break;
4210 : 0 : case SVX_SHADOW_BOTTOMLEFT: eLoc = SVX_SHADOW_TOPLEFT; break;
4211 : 0 : default: break;
4212 : : }
4213 : : }
4214 : :
4215 : : /// OD 23.08.2002 #99657# - determine, if full shadow rectangle have to
4216 : : /// be drawn or only two shadow rectangles beside the frame.
4217 : : /// draw full shadow rectangle, if frame background is drawn transparent.
4218 : : /// Status Quo:
4219 : : /// SwLayoutFrm can have transparent drawn backgrounds. Thus,
4220 : : /// "asked" their frame format.
4221 : : sal_Bool bDrawFullShadowRectangle =
4222 : 0 : ( IsLayoutFrm() &&
4223 [ # # ][ # # ]: 0 : (static_cast<const SwLayoutFrm*>(this))->GetFmt()->IsBackgroundTransparent()
4224 [ # # ][ # # ]: 0 : );
4225 [ # # # # : 0 : switch ( eLoc )
# ]
4226 : : {
4227 : : case SVX_SHADOW_BOTTOMRIGHT:
4228 : : {
4229 [ # # ]: 0 : if ( bDrawFullShadowRectangle )
4230 : : {
4231 : : /// OD 06.08.2002 #99657# - draw full shadow rectangle
4232 : 0 : aOut.Top( aOut.Top() + nHeight );
4233 : 0 : aOut.Left( aOut.Left() + nWidth );
4234 [ # # ]: 0 : aRegion.push_back( aOut );
4235 : : }
4236 : : else
4237 : : {
4238 : 0 : aOut.Top ( aOut.Bottom() - nHeight );
4239 : 0 : aOut.Left( aOut.Left() + nWidth );
4240 [ # # ]: 0 : if ( bBottom )
4241 [ # # ]: 0 : aRegion.push_back( aOut );
4242 : 0 : aOut.Left( aOut.Right() - nWidth );
4243 : 0 : aOut.Top ( rOutRect.Top() + nHeight );
4244 [ # # ]: 0 : if ( bBottom )
4245 : 0 : aOut.Bottom( aOut.Bottom() - nHeight );
4246 [ # # ][ # # ]: 0 : if ( bCnt && (!bTop || !bBottom) )
[ # # ]
4247 [ # # ]: 0 : ::lcl_ExtendLeftAndRight( aOut, *(this), rAttrs, fnRect );
4248 [ # # ]: 0 : aRegion.push_back( aOut );
4249 : : }
4250 : :
4251 : 0 : rOutRect.Right ( rOutRect.Right() - nWidth );
4252 : 0 : rOutRect.Bottom( rOutRect.Bottom()- nHeight );
4253 : : }
4254 : 0 : break;
4255 : : case SVX_SHADOW_TOPLEFT:
4256 : : {
4257 [ # # ]: 0 : if ( bDrawFullShadowRectangle )
4258 : : {
4259 : : /// OD 06.08.2002 #99657# - draw full shadow rectangle
4260 : 0 : aOut.Bottom( aOut.Bottom() - nHeight );
4261 : 0 : aOut.Right( aOut.Right() - nWidth );
4262 [ # # ]: 0 : aRegion.push_back( aOut );
4263 : : }
4264 : : else
4265 : : {
4266 : 0 : aOut.Bottom( aOut.Top() + nHeight );
4267 : 0 : aOut.Right ( aOut.Right() - nWidth );
4268 [ # # ]: 0 : if ( bTop )
4269 [ # # ]: 0 : aRegion.push_back( aOut );
4270 : 0 : aOut.Right ( aOut.Left() + nWidth );
4271 : 0 : aOut.Bottom( rOutRect.Bottom() - nHeight );
4272 [ # # ]: 0 : if ( bTop )
4273 : 0 : aOut.Top( aOut.Top() + nHeight );
4274 [ # # ][ # # ]: 0 : if ( bCnt && (!bBottom || !bTop) )
[ # # ]
4275 [ # # ]: 0 : ::lcl_ExtendLeftAndRight( aOut, *(this), rAttrs, fnRect );
4276 [ # # ]: 0 : aRegion.push_back( aOut );
4277 : : }
4278 : :
4279 : 0 : rOutRect.Left( rOutRect.Left() + nWidth );
4280 : 0 : rOutRect.Top( rOutRect.Top() + nHeight );
4281 : : }
4282 : 0 : break;
4283 : : case SVX_SHADOW_TOPRIGHT:
4284 : : {
4285 [ # # ]: 0 : if ( bDrawFullShadowRectangle )
4286 : : {
4287 : : /// OD 06.08.2002 #99657# - draw full shadow rectangle
4288 : 0 : aOut.Bottom( aOut.Bottom() - nHeight);
4289 : 0 : aOut.Left( aOut.Left() + nWidth );
4290 [ # # ]: 0 : aRegion.push_back( aOut );
4291 : : }
4292 : : else
4293 : : {
4294 : 0 : aOut.Bottom( aOut.Top() + nHeight );
4295 : 0 : aOut.Left ( aOut.Left()+ nWidth );
4296 [ # # ]: 0 : if ( bTop )
4297 [ # # ]: 0 : aRegion.push_back( aOut );
4298 : 0 : aOut.Left ( aOut.Right() - nWidth );
4299 : 0 : aOut.Bottom( rOutRect.Bottom() - nHeight );
4300 [ # # ]: 0 : if ( bTop )
4301 : 0 : aOut.Top( aOut.Top() + nHeight );
4302 [ # # ][ # # ]: 0 : if ( bCnt && (!bBottom || bTop) )
[ # # ]
4303 [ # # ]: 0 : ::lcl_ExtendLeftAndRight( aOut, *(this), rAttrs, fnRect );
4304 [ # # ]: 0 : aRegion.push_back( aOut );
4305 : : }
4306 : :
4307 : 0 : rOutRect.Right( rOutRect.Right() - nWidth );
4308 : 0 : rOutRect.Top( rOutRect.Top() + nHeight );
4309 : : }
4310 : 0 : break;
4311 : : case SVX_SHADOW_BOTTOMLEFT:
4312 : : {
4313 [ # # ]: 0 : if ( bDrawFullShadowRectangle )
4314 : : {
4315 : : /// OD 06.08.2002 #99657# - draw full shadow rectangle
4316 : 0 : aOut.Top( aOut.Top() + nHeight );
4317 : 0 : aOut.Right( aOut.Right() - nWidth );
4318 [ # # ]: 0 : aRegion.push_back( aOut );
4319 : : }
4320 : : else
4321 : : {
4322 : 0 : aOut.Top ( aOut.Bottom()- nHeight );
4323 : 0 : aOut.Right( aOut.Right() - nWidth );
4324 [ # # ]: 0 : if ( bBottom )
4325 [ # # ]: 0 : aRegion.push_back( aOut );
4326 : 0 : aOut.Right( aOut.Left() + nWidth );
4327 : 0 : aOut.Top( rOutRect.Top() + nHeight );
4328 [ # # ]: 0 : if ( bBottom )
4329 : 0 : aOut.Bottom( aOut.Bottom() - nHeight );
4330 [ # # ][ # # ]: 0 : if ( bCnt && (!bTop || !bBottom) )
[ # # ]
4331 [ # # ]: 0 : ::lcl_ExtendLeftAndRight( aOut, *(this), rAttrs, fnRect );
4332 [ # # ]: 0 : aRegion.push_back( aOut );
4333 : : }
4334 : :
4335 : 0 : rOutRect.Left( rOutRect.Left() + nWidth );
4336 : 0 : rOutRect.Bottom( rOutRect.Bottom() - nHeight );
4337 : : }
4338 : 0 : break;
4339 : : default:
4340 : : OSL_ENSURE( !this, "new ShadowLocation() ?" );
4341 : 0 : break;
4342 : : }
4343 : :
4344 : 0 : OutputDevice *pOut = pGlobalShell->GetOut();
4345 : :
4346 : 0 : sal_uLong nOldDrawMode = pOut->GetDrawMode();
4347 : 0 : Color aShadowColor( rShadow.GetColor() );
4348 [ # # # # ]: 0 : if( !aRegion.empty() && pGlobalShell->GetWin() &&
[ # # ][ # # ]
4349 [ # # ]: 0 : Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
4350 : : {
4351 : : // Is heigh contrast mode, the output device has already set the
4352 : : // DRAWMODE_SETTINGSFILL flag. This causes the SetFillColor function
4353 : : // to ignore the setting of a new color. Therefore we have to reset
4354 : : // the drawing mode
4355 [ # # ]: 0 : pOut->SetDrawMode( 0 );
4356 [ # # ]: 0 : aShadowColor = SwViewOption::GetFontColor();
4357 : : }
4358 : :
4359 [ # # ]: 0 : if ( pOut->GetFillColor() != aShadowColor )
4360 [ # # ]: 0 : pOut->SetFillColor( aShadowColor );
4361 : :
4362 [ # # ]: 0 : pOut->SetDrawMode( nOldDrawMode );
4363 : :
4364 [ # # ]: 0 : for ( sal_uInt16 i = 0; i < aRegion.size(); ++i )
4365 : : {
4366 : 0 : SwRect &rOut = aRegion[i];
4367 : 0 : aOut = rOut;
4368 : : // OD 30.09.2002 #103636# - no SwAlign of shadow rectangle
4369 : : // no alignment necessary, because (1) <rRect> is already aligned
4370 : : // and because (2) paint of border and background will occur later.
4371 : : // Thus, (1) assures that no conflicts with neighbour object will occure
4372 : : // and (2) assures that border and background is not affected by the
4373 : : // shadow paint.
4374 : : /*
4375 : : ::SwAlignRect( aOut, pGlobalShell );
4376 : : */
4377 [ # # ][ # # ]: 0 : if ( rRect.IsOver( aOut ) && aOut.Height() > 0 && aOut.Width() > 0 )
[ # # ][ # # ]
[ # # ]
4378 : : {
4379 [ # # ]: 0 : aOut._Intersection( rRect );
4380 [ # # ][ # # ]: 0 : pOut->DrawRect( aOut.SVRect() );
4381 : : }
4382 : 0 : }
4383 : 0 : }
4384 : :
4385 : : /*************************************************************************
4386 : : |*
4387 : : |* SwFrm::PaintBorderLine()
4388 : : |*
4389 : : |*************************************************************************/
4390 : :
4391 : 0 : void SwFrm::PaintBorderLine( const SwRect& rRect,
4392 : : const SwRect& rOutRect,
4393 : : const SwPageFrm *pPage,
4394 : : const Color *pColor,
4395 : : const SvxBorderStyle nStyle ) const
4396 : : {
4397 [ # # ][ # # ]: 0 : if ( !rOutRect.IsOver( rRect ) )
4398 : 0 : return;
4399 : :
4400 : 0 : SwRect aOut( rOutRect );
4401 [ # # ]: 0 : aOut._Intersection( rRect );
4402 : :
4403 [ # # ][ # # ]: 0 : const SwTabFrm *pTab = IsCellFrm() ? FindTabFrm() : 0;
4404 : 0 : sal_uInt8 nSubCol = ( IsCellFrm() || IsRowFrm() ) ? SUBCOL_TAB :
4405 [ # # ]: 0 : ( IsInSct() ? SUBCOL_SECT :
4406 [ # # ][ # # ]: 0 : ( IsInFly() ? SUBCOL_FLY : SUBCOL_PAGE ) );
[ # # ]
[ # # # # ]
4407 [ # # ]: 0 : if( pColor && pGlobalShell->GetWin() &&
[ # # # # ]
[ # # ]
4408 [ # # ]: 0 : Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
4409 : : {
4410 [ # # ]: 0 : pColor = &SwViewOption::GetFontColor();
4411 : : }
4412 : :
4413 [ # # ]: 0 : if ( pPage->GetSortedObjs() )
4414 : : {
4415 [ # # ]: 0 : SwRegionRects aRegion( aOut, 4 );
4416 [ # # ]: 0 : ::lcl_SubtractFlys( this, pPage, aOut, aRegion );
4417 [ # # ]: 0 : for ( sal_uInt16 i = 0; i < aRegion.size(); ++i )
4418 [ # # ]: 0 : pLines->AddLineRect( aRegion[i], pColor, nStyle, pTab, nSubCol );
4419 : : }
4420 : : else
4421 [ # # ]: 0 : pLines->AddLineRect( aOut, pColor, nStyle, pTab, nSubCol );
4422 : : }
4423 : :
4424 : : /*************************************************************************
4425 : : |*
4426 : : |* SwFrm::PaintBorderLines()
4427 : : |*
4428 : : |* Descrtiption Only all lines once or all lines twice!
4429 : : |*
4430 : : |*************************************************************************/
4431 : :
4432 : : // OD 29.04.2003 #107169# - method called for left and right border rectangles.
4433 : : // For a printer output device perform adjustment for non-overlapping top and
4434 : : // bottom border rectangles. Thus, add parameter <_bPrtOutputDev> to indicate
4435 : : // printer output device.
4436 : : // NOTE: For printer output device left/right border rectangle <_iorRect>
4437 : : // has to be already non-overlapping the outer top/bottom border rectangle.
4438 : 524 : void lcl_SubTopBottom( SwRect& _iorRect,
4439 : : const SvxBoxItem& _rBox,
4440 : : const SwBorderAttrs& _rAttrs,
4441 : : const SwFrm& _rFrm,
4442 : : const SwRectFn& _rRectFn,
4443 : : const sal_Bool _bPrtOutputDev )
4444 : : {
4445 : 524 : const sal_Bool bCnt = _rFrm.IsCntntFrm();
4446 [ - + ]: 524 : if ( _rBox.GetTop() && _rBox.GetTop()->GetInWidth() &&
[ # # # # ]
[ - + ][ + - ]
4447 : 0 : ( !bCnt || _rAttrs.GetTopLine( _rFrm ) )
4448 : : )
4449 : : {
4450 : : // substract distance between outer and inner line.
4451 : 0 : SwTwips nDist = ::lcl_MinHeightDist( _rBox.GetTop()->GetDistance() );
4452 : : // OD 19.05.2003 #109667# - non-overlapping border rectangles:
4453 : : // adjust x-/y-position, if inner top line is a hair line (width = 1)
4454 : 0 : sal_Bool bIsInnerTopLineHairline = sal_False;
4455 [ # # ]: 0 : if ( !_bPrtOutputDev )
4456 : : {
4457 : : // additionally substract width of top outer line
4458 : : // --> left/right inner/outer line doesn't overlap top outer line.
4459 : 0 : nDist += ::lcl_AlignHeight( _rBox.GetTop()->GetOutWidth() );
4460 : : }
4461 : : else
4462 : : {
4463 : : // OD 29.04.2003 #107169# - additionally substract width of top inner line
4464 : : // --> left/right inner/outer line doesn't overlap top inner line.
4465 : 0 : nDist += ::lcl_AlignHeight( _rBox.GetTop()->GetInWidth() );
4466 : 0 : bIsInnerTopLineHairline = _rBox.GetTop()->GetInWidth() == 1;
4467 : : }
4468 [ # # ]: 0 : (_iorRect.*_rRectFn->fnSubTop)( -nDist );
4469 : : // OD 19.05.2003 #109667# - adjust calculated border top, if inner top line
4470 : : // is a hair line
4471 [ # # ]: 0 : if ( bIsInnerTopLineHairline )
4472 : : {
4473 [ # # ]: 0 : if ( _rFrm.IsVertical() )
4474 : : {
4475 : : // right of border rectangle has to be checked and adjusted
4476 : 0 : Point aCompPt( _iorRect.Right(), 0 );
4477 : 0 : Point aRefPt( aCompPt.X() + 1, aCompPt.Y() );
4478 : 0 : lcl_CompPxPosAndAdjustPos( *(pGlobalShell->GetOut()),
4479 : : aRefPt, aCompPt,
4480 [ # # ]: 0 : sal_True, -1 );
4481 : 0 : _iorRect.Right( aCompPt.X() );
4482 : : }
4483 : : else
4484 : : {
4485 : : // top of border rectangle has to be checked and adjusted
4486 : 0 : Point aCompPt( 0, _iorRect.Top() );
4487 : 0 : Point aRefPt( aCompPt.X(), aCompPt.Y() - 1 );
4488 : 0 : lcl_CompPxPosAndAdjustPos( *(pGlobalShell->GetOut()),
4489 : : aRefPt, aCompPt,
4490 [ # # ]: 0 : sal_False, +1 );
4491 : 0 : _iorRect.Top( aCompPt.Y() );
4492 : : }
4493 : : }
4494 : : }
4495 : :
4496 [ + - ][ - + ]: 524 : if ( _rBox.GetBottom() && _rBox.GetBottom()->GetInWidth() &&
[ # # # # ]
[ - + ]
4497 : 0 : ( !bCnt || _rAttrs.GetBottomLine( _rFrm ) )
4498 : : )
4499 : : {
4500 : : // substract distance between outer and inner line.
4501 : 0 : SwTwips nDist = ::lcl_MinHeightDist( _rBox.GetBottom()->GetDistance() );
4502 : : // OD 19.05.2003 #109667# - non-overlapping border rectangles:
4503 : : // adjust x-/y-position, if inner bottom line is a hair line (width = 1)
4504 : 0 : sal_Bool bIsInnerBottomLineHairline = sal_False;
4505 [ # # ]: 0 : if ( !_bPrtOutputDev )
4506 : : {
4507 : : // additionally substract width of bottom outer line
4508 : : // --> left/right inner/outer line doesn't overlap bottom outer line.
4509 : 0 : nDist += ::lcl_AlignHeight( _rBox.GetBottom()->GetOutWidth() );
4510 : : }
4511 : : else
4512 : : {
4513 : : // OD 29.04.2003 #107169# - additionally substract width of bottom inner line
4514 : : // --> left/right inner/outer line doesn't overlap bottom inner line.
4515 : 0 : nDist += ::lcl_AlignHeight( _rBox.GetBottom()->GetInWidth() );
4516 : 0 : bIsInnerBottomLineHairline = _rBox.GetBottom()->GetInWidth() == 1;
4517 : : }
4518 [ # # ]: 0 : (_iorRect.*_rRectFn->fnAddBottom)( -nDist );
4519 : : // OD 19.05.2003 #109667# - adjust calculated border bottom, if inner
4520 : : // bottom line is a hair line.
4521 [ # # ]: 0 : if ( bIsInnerBottomLineHairline )
4522 : : {
4523 [ # # ]: 0 : if ( _rFrm.IsVertical() )
4524 : : {
4525 : : // left of border rectangle has to be checked and adjusted
4526 : 0 : Point aCompPt( _iorRect.Left(), 0 );
4527 : 0 : Point aRefPt( aCompPt.X() - 1, aCompPt.Y() );
4528 : 0 : lcl_CompPxPosAndAdjustPos( *(pGlobalShell->GetOut()),
4529 : : aRefPt, aCompPt,
4530 [ # # ]: 0 : sal_True, +1 );
4531 : 0 : _iorRect.Left( aCompPt.X() );
4532 : : }
4533 : : else
4534 : : {
4535 : : // bottom of border rectangle has to be checked and adjusted
4536 : 0 : Point aCompPt( 0, _iorRect.Bottom() );
4537 : 0 : Point aRefPt( aCompPt.X(), aCompPt.Y() + 1 );
4538 : 0 : lcl_CompPxPosAndAdjustPos( *(pGlobalShell->GetOut()),
4539 : : aRefPt, aCompPt,
4540 [ # # ]: 0 : sal_False, -1 );
4541 : 0 : _iorRect.Bottom( aCompPt.Y() );
4542 : : }
4543 : : }
4544 : : }
4545 : 524 : }
4546 : :
4547 : 8408 : sal_uInt16 lcl_GetLineWidth( const SvxBorderLine* pLine )
4548 : : {
4549 : 8408 : sal_uInt16 result = 0;
4550 : :
4551 [ + + ]: 8408 : if ( pLine != NULL )
4552 : 8396 : result = pLine->GetScaledWidth();
4553 : :
4554 : 8408 : return result;
4555 : : }
4556 : :
4557 : 4216 : double lcl_GetExtent( const SvxBorderLine* pSideLine, const SvxBorderLine* pOppositeLine )
4558 : : {
4559 : 4216 : double nExtent = 0.0;
4560 : :
4561 [ + + ][ + - ]: 4216 : if ( pSideLine && !pSideLine->isEmpty() )
[ + + ]
4562 : 2096 : nExtent = -lcl_GetLineWidth( pSideLine ) / 2.0;
4563 [ + + ]: 2120 : else if ( pOppositeLine )
4564 : 2096 : nExtent = lcl_GetLineWidth( pOppositeLine ) / 2.0;
4565 : :
4566 : 4216 : return nExtent;
4567 : : }
4568 : :
4569 : : static void
4570 : 1054 : lcl_MakeBorderLine(SwRect const& rRect,
4571 : : bool const isVerticalInModel,
4572 : : bool const isLeftOrTopBorderInModel,
4573 : : SvxBorderLine const& rBorder,
4574 : : SvxBorderLine const*const pLeftOrTopNeighbour,
4575 : : SvxBorderLine const*const pRightOrBottomNeighbour)
4576 : : {
4577 : : // fdo#44010: for vertical text lcl_PaintTopBottomLine produces vertical
4578 : : // borders and lcl_PaintLeftRightLine horizontal ones.
4579 : 1054 : bool const isVertical(rRect.Height() > rRect.Width());
4580 : : bool const isLeftOrTopBorder((isVerticalInModel == isVertical)
4581 : : ? isLeftOrTopBorderInModel
4582 [ - + ]: 1054 : : (isLeftOrTopBorderInModel != isVertical));
4583 : : SvxBorderLine const*const pStartNeighbour(
4584 : 1054 : (!isVertical && isVerticalInModel)
4585 [ + + ][ - + ]: 1054 : ? pRightOrBottomNeighbour : pLeftOrTopNeighbour);
4586 : : SvxBorderLine const*const pEndNeighbour(
4587 : : (pStartNeighbour == pLeftOrTopNeighbour)
4588 [ + - ]: 1054 : ? pRightOrBottomNeighbour : pLeftOrTopNeighbour);
4589 : :
4590 : 1054 : basegfx::B2DPoint aStart;
4591 : 1054 : basegfx::B2DPoint aEnd;
4592 [ + + ]: 1054 : if (isVertical)
4593 : : { // fdo#38635: always from outer edge
4594 : : double const fStartX( (isLeftOrTopBorder)
4595 : 262 : ? rRect.Left() + (rRect.Width() / 2.0)
4596 [ + + ]: 786 : : rRect.Right() - (rRect.Width() / 2.0));
4597 : 524 : aStart.setX(fStartX);
4598 : 524 : aStart.setY(rRect.Top() +
4599 [ + - ][ + - ]: 524 : lcl_AlignHeight(lcl_GetLineWidth(pStartNeighbour))/2.0);
4600 : 524 : aEnd.setX(fStartX);
4601 : 524 : aEnd.setY(rRect.Bottom() -
4602 [ + - ][ + - ]: 524 : lcl_AlignHeight(lcl_GetLineWidth(pEndNeighbour))/2.0);
4603 : : }
4604 : : else
4605 : : { // fdo#38635: always from outer edge
4606 : : double const fStartY( (isLeftOrTopBorder)
4607 : 262 : ? rRect.Top() + (rRect.Height() / 2.0)
4608 [ + + ]: 792 : : rRect.Bottom() - (rRect.Height() / 2.0));
4609 : 530 : aStart.setX(rRect.Left() +
4610 [ + - ][ + - ]: 530 : lcl_AlignWidth(lcl_GetLineWidth(pStartNeighbour))/2.0);
4611 : 530 : aStart.setY(fStartY);
4612 : 530 : aEnd.setX(rRect.Right() -
4613 [ + - ][ + - ]: 530 : lcl_AlignWidth(lcl_GetLineWidth(pEndNeighbour))/2.0);
4614 : 530 : aEnd.setY(fStartY);
4615 : : }
4616 : :
4617 : : double const nExtentLeftStart = (isLeftOrTopBorder == isVertical)
4618 : : ? lcl_GetExtent(pStartNeighbour, 0)
4619 [ + + ][ + - ]: 1054 : : lcl_GetExtent(0, pStartNeighbour);
[ + - ]
4620 : : double const nExtentLeftEnd = (isLeftOrTopBorder == isVertical)
4621 : : ? lcl_GetExtent(pEndNeighbour, 0)
4622 [ + + ][ + - ]: 1054 : : lcl_GetExtent(0, pEndNeighbour);
[ + - ]
4623 : : double const nExtentRightStart = (isLeftOrTopBorder == isVertical)
4624 : : ? lcl_GetExtent(0, pStartNeighbour)
4625 [ + + ][ + - ]: 1054 : : lcl_GetExtent(pStartNeighbour, 0);
[ + - ]
4626 : : double const nExtentRightEnd = (isLeftOrTopBorder == isVertical)
4627 : : ? lcl_GetExtent(0, pEndNeighbour)
4628 [ + + ][ + - ]: 1054 : : lcl_GetExtent(pEndNeighbour, 0);
[ + - ]
4629 : :
4630 : : double const nLeftWidth = (isLeftOrTopBorder == isVertical)
4631 [ + + ][ + - ]: 1054 : ? rBorder.GetInWidth() : rBorder.GetOutWidth();
[ + - ]
4632 : : double const nRightWidth = (isLeftOrTopBorder == isVertical)
4633 [ + + ][ + - ]: 1054 : ? rBorder.GetOutWidth() : rBorder.GetInWidth();
[ + - ]
4634 : : Color const aLeftColor = (isLeftOrTopBorder == isVertical)
4635 : 530 : ? rBorder.GetColorIn(isLeftOrTopBorder)
4636 [ + + ][ + - ]: 1054 : : rBorder.GetColorOut(isLeftOrTopBorder);
[ + - ]
4637 : : Color const aRightColor = (isLeftOrTopBorder == isVertical)
4638 : 530 : ? rBorder.GetColorOut(isLeftOrTopBorder)
4639 [ + + ][ + - ]: 1054 : : rBorder.GetColorIn(isLeftOrTopBorder);
[ + - ]
4640 : :
4641 : : ::rtl::Reference<BorderLinePrimitive2D> const xLine =
4642 : : new BorderLinePrimitive2D(
4643 [ + - ]: 1054 : aStart, aEnd, nLeftWidth, rBorder.GetDistance(), nRightWidth,
4644 : : nExtentLeftStart, nExtentLeftEnd,
4645 : : nExtentRightStart, nExtentRightEnd,
4646 : : aLeftColor.getBColor(), aRightColor.getBColor(),
4647 : 1054 : rBorder.GetColorGap().getBColor(), rBorder.HasGapColor(),
4648 [ + - ][ + - ]: 2108 : rBorder.GetBorderLineStyle() );
4649 [ + - ]: 1054 : g_pBorderLines->AddBorderLine(xLine);
4650 : 1054 : }
4651 : :
4652 : : // OD 19.05.2003 #109667# - merge <lcl_PaintLeftLine> and <lcl_PaintRightLine>
4653 : : // into new method <lcl_PaintLeftRightLine(..)>
4654 : 542 : void lcl_PaintLeftRightLine( const sal_Bool _bLeft,
4655 : : const SwFrm& _rFrm,
4656 : : const SwPageFrm& /*_rPage*/,
4657 : : const SwRect& _rOutRect,
4658 : : const SwRect& /*_rRect*/,
4659 : : const SwBorderAttrs& _rAttrs,
4660 : : const SwRectFn& _rRectFn )
4661 : : {
4662 : 542 : const SvxBoxItem& rBox = _rAttrs.GetBox();
4663 [ # # ][ # # ]: 542 : const sal_Bool bR2L = _rFrm.IsCellFrm() && _rFrm.IsRightToLeft();
[ - + ]
4664 : 542 : const SvxBorderLine* pLeftRightBorder = 0;
4665 : 542 : const SvxBorderLine* pTopBorder = rBox.GetTop();
4666 : 542 : const SvxBorderLine* pBottomBorder = rBox.GetBottom();
4667 : :
4668 [ + + ]: 542 : if ( _bLeft )
4669 : : {
4670 [ - + ]: 271 : pLeftRightBorder = bR2L ? rBox.GetRight() : rBox.GetLeft();
4671 : : }
4672 : : else
4673 : : {
4674 [ - + ]: 271 : pLeftRightBorder = bR2L ? rBox.GetLeft() : rBox.GetRight();
4675 : : }
4676 : : // OD 06.05.2003 #107169# - init boolean indicating printer output device.
4677 : : const sal_Bool bPrtOutputDev =
4678 : 542 : ( OUTDEV_PRINTER == pGlobalShell->GetOut()->GetOutDevType() );
4679 : :
4680 [ + + ]: 542 : if ( !pLeftRightBorder )
4681 : : {
4682 : 542 : return;
4683 : : }
4684 : :
4685 : 524 : SwRect aRect( _rOutRect );
4686 [ + + ]: 524 : if ( _bLeft )
4687 : : {
4688 [ + - ][ + - ]: 262 : (aRect.*_rRectFn->fnAddRight)( ::lcl_AlignWidth( lcl_GetLineWidth( pLeftRightBorder ) ) -
4689 [ + - ][ + - ]: 524 : (aRect.*_rRectFn->fnGetWidth)() );
[ + - ][ + - ]
4690 : : }
4691 : : else
4692 : : {
4693 [ + - ][ + - ]: 262 : (aRect.*_rRectFn->fnSubLeft)( ::lcl_AlignWidth( lcl_GetLineWidth( pLeftRightBorder ) ) -
4694 [ + - ][ + - ]: 524 : (aRect.*_rRectFn->fnGetWidth)() );
[ + - ][ + - ]
4695 : : }
4696 : :
4697 : 524 : const sal_Bool bCnt = _rFrm.IsCntntFrm();
4698 : :
4699 [ - + ]: 524 : if ( bCnt )
4700 : : {
4701 [ # # ]: 0 : ::lcl_ExtendLeftAndRight( aRect, _rFrm, _rAttrs, _rRectFn );
4702 : :
4703 : : // No Top / bottom borders for joint borders
4704 [ # # ][ # # ]: 0 : if ( _rAttrs.JoinedWithPrev( _rFrm ) ) pTopBorder = NULL;
4705 [ # # ][ # # ]: 0 : if ( _rAttrs.JoinedWithNext( _rFrm ) ) pBottomBorder = NULL;
4706 : : }
4707 : :
4708 [ + - ][ + - ]: 524 : if ( !pLeftRightBorder->GetInWidth() )
4709 : : {
4710 : : // OD 06.05.2003 #107169# - add 6th parameter
4711 [ + - ]: 524 : ::lcl_SubTopBottom( aRect, rBox, _rAttrs, _rFrm, _rRectFn, bPrtOutputDev );
4712 : : }
4713 : :
4714 [ + - ][ + - ]: 524 : if ( lcl_GetLineWidth( pLeftRightBorder ) > 0 )
4715 : : {
4716 : : lcl_MakeBorderLine(
4717 [ + - ]: 542 : aRect, true, _bLeft, *pLeftRightBorder, pTopBorder, pBottomBorder);
4718 : : }
4719 : : }
4720 : :
4721 : : // OD 19.05.2003 #109667# - merge <lcl_PaintTopLine> and <lcl_PaintBottomLine>
4722 : : // into <lcl_PaintTopLine>
4723 : 533 : void lcl_PaintTopBottomLine( const sal_Bool _bTop,
4724 : : const SwFrm& ,
4725 : : const SwPageFrm& /*_rPage*/,
4726 : : const SwRect& _rOutRect,
4727 : : const SwRect& /*_rRect*/,
4728 : : const SwBorderAttrs& _rAttrs,
4729 : : const SwRectFn& _rRectFn )
4730 : : {
4731 : 533 : const SvxBoxItem& rBox = _rAttrs.GetBox();
4732 : 533 : const SvxBorderLine* pTopBottomBorder = 0;
4733 : 533 : const SvxBorderLine* pLeftBorder = rBox.GetLeft();
4734 : 533 : const SvxBorderLine* pRightBorder = rBox.GetRight();
4735 [ + + ]: 533 : if ( _bTop )
4736 : : {
4737 : 265 : pTopBottomBorder = rBox.GetTop();
4738 : : }
4739 : : else
4740 : : {
4741 : 268 : pTopBottomBorder = rBox.GetBottom();
4742 : : }
4743 : :
4744 [ + + ]: 533 : if ( !pTopBottomBorder )
4745 : : {
4746 : 533 : return;
4747 : : }
4748 : :
4749 : 530 : SwRect aRect( _rOutRect );
4750 [ + + ]: 530 : if ( _bTop )
4751 : : {
4752 [ + - ][ + - ]: 262 : (aRect.*_rRectFn->fnAddBottom)( ::lcl_AlignHeight( lcl_GetLineWidth( pTopBottomBorder ) ) -
4753 [ + - ][ + - ]: 524 : (aRect.*_rRectFn->fnGetHeight)() );
[ + - ][ + - ]
4754 : : }
4755 : : else
4756 : : {
4757 [ + - ][ + - ]: 268 : (aRect.*_rRectFn->fnSubTop)( ::lcl_AlignHeight( lcl_GetLineWidth( pTopBottomBorder ) ) -
4758 [ + - ][ + - ]: 536 : (aRect.*_rRectFn->fnGetHeight)() );
[ + - ][ + - ]
4759 : : }
4760 : :
4761 [ + - ][ + - ]: 530 : if ( lcl_GetLineWidth( pTopBottomBorder ) > 0 )
4762 : : {
4763 : : lcl_MakeBorderLine(
4764 [ + - ]: 533 : aRect, false, _bTop, *pTopBottomBorder, pLeftBorder, pRightBorder);
4765 : : }
4766 : : }
4767 : :
4768 : : /*************************************************************************
4769 : : |*
4770 : : |* const SwFrm* lcl_HasNextCell( const SwFrm& rFrm )
4771 : : |*
4772 : : |* No comment. #i15844#
4773 : : |*
4774 : : |*************************************************************************/
4775 : :
4776 : 0 : const SwFrm* lcl_HasNextCell( const SwFrm& rFrm )
4777 : : {
4778 : : OSL_ENSURE( rFrm.IsCellFrm(),
4779 : : "lcl_HasNextCell( const SwFrm& rFrm ) should be called with SwCellFrm" );
4780 : :
4781 : 0 : const SwFrm* pTmpFrm = &rFrm;
4782 [ # # ]: 0 : do
4783 : : {
4784 [ # # ]: 0 : if ( pTmpFrm->GetNext() )
4785 : 0 : return pTmpFrm->GetNext();
4786 : :
4787 : 0 : pTmpFrm = pTmpFrm->GetUpper()->GetUpper();
4788 : : }
4789 : 0 : while ( pTmpFrm->IsCellFrm() );
4790 : :
4791 : 0 : return 0;
4792 : : }
4793 : :
4794 : : /*************************************************************************
4795 : : |*
4796 : : |* SwFrm::PaintBorder()
4797 : : |*
4798 : : |* Description Paints shadows and borders
4799 : : |*
4800 : : |*************************************************************************/
4801 : :
4802 : : /** local method to determine cell frame, from which the border attributes
4803 : : for paint of top/bottom border has to be used.
4804 : :
4805 : : OD 21.02.2003 #b4779636#, #107692#
4806 : :
4807 : : @author OD
4808 : :
4809 : : @param _pCellFrm
4810 : : input parameter - constant pointer to cell frame for which the cell frame
4811 : : for the border attributes has to be determined.
4812 : :
4813 : : @param _rCellBorderAttrs
4814 : : input parameter - constant reference to the border attributes of cell frame
4815 : : <_pCellFrm>.
4816 : :
4817 : : @param _bTop
4818 : : input parameter - boolean, that controls, if cell frame for top border or
4819 : : for bottom border has to be determined.
4820 : :
4821 : : @return constant pointer to cell frame, for which the border attributes has
4822 : : to be used
4823 : : */
4824 : 0 : const SwFrm* lcl_GetCellFrmForBorderAttrs( const SwFrm* _pCellFrm,
4825 : : const SwBorderAttrs& _rCellBorderAttrs,
4826 : : const bool _bTop )
4827 : : {
4828 : : OSL_ENSURE( _pCellFrm, "No cell frame available, dying soon" );
4829 : :
4830 : : // determine, if cell frame is at bottom/top border of a table frame and
4831 : : // the table frame has/is a follow.
4832 : 0 : const SwFrm* pTmpFrm = _pCellFrm;
4833 : 0 : bool bCellAtBorder = true;
4834 : 0 : bool bCellAtLeftBorder = !_pCellFrm->GetPrev();
4835 : 0 : bool bCellAtRightBorder = !_pCellFrm->GetNext();
4836 [ # # ][ # # ]: 0 : while( !pTmpFrm->IsRowFrm() || !pTmpFrm->GetUpper()->IsTabFrm() )
[ # # ]
4837 : : {
4838 : 0 : pTmpFrm = pTmpFrm->GetUpper();
4839 [ # # # # ]: 0 : if ( pTmpFrm->IsRowFrm() &&
[ # # ][ # # ]
4840 [ # # ]: 0 : (_bTop ? pTmpFrm->GetPrev() : pTmpFrm->GetNext())
4841 : : )
4842 : : {
4843 : 0 : bCellAtBorder = false;
4844 : : }
4845 [ # # ]: 0 : if ( pTmpFrm->IsCellFrm() )
4846 : : {
4847 [ # # ]: 0 : if ( pTmpFrm->GetPrev() )
4848 : : {
4849 : 0 : bCellAtLeftBorder = false;
4850 : : }
4851 [ # # ]: 0 : if ( pTmpFrm->GetNext() )
4852 : : {
4853 : 0 : bCellAtRightBorder = false;
4854 : : }
4855 : : }
4856 : : }
4857 : : OSL_ENSURE( pTmpFrm && pTmpFrm->IsRowFrm(), "No RowFrm available" );
4858 : :
4859 : 0 : const SwLayoutFrm* pParentRowFrm = static_cast<const SwLayoutFrm*>(pTmpFrm);
4860 : : const SwTabFrm* pParentTabFrm =
4861 : 0 : static_cast<const SwTabFrm*>(pParentRowFrm->GetUpper());
4862 : :
4863 : : const bool bCellNeedsAttribute = bCellAtBorder &&
4864 : : ( _bTop ?
4865 : : // bCellInFirstRowWithMaster
4866 : 0 : ( !pParentRowFrm->GetPrev() &&
4867 : 0 : pParentTabFrm->IsFollow() &&
4868 : 0 : 0 == pParentTabFrm->GetTable()->GetRowsToRepeat() ) :
4869 : : // bCellInLastRowWithFollow
4870 : 0 : ( !pParentRowFrm->GetNext() &&
4871 : 0 : pParentTabFrm->GetFollow() )
4872 [ # # # # : 0 : );
# # # # #
# # # ]
[ # # ]
4873 : :
4874 : 0 : const SwFrm* pRet = _pCellFrm;
4875 [ # # ]: 0 : if ( bCellNeedsAttribute )
4876 : : {
4877 : : // determine, if cell frame has no borders inside the table.
4878 : 0 : const SwFrm* pNextCell = 0;
4879 : 0 : bool bNoBordersInside = false;
4880 : :
4881 [ # # ][ # # ]: 0 : if ( bCellAtLeftBorder && ( 0 != ( pNextCell = lcl_HasNextCell( *_pCellFrm ) ) ) )
[ # # ]
4882 : : {
4883 [ # # ]: 0 : SwBorderAttrAccess aAccess( SwFrm::GetCache(), pNextCell );
4884 [ # # ]: 0 : const SwBorderAttrs &rBorderAttrs = *aAccess.Get();
4885 : 0 : const SvxBoxItem& rBorderBox = rBorderAttrs.GetBox();
4886 : 0 : bCellAtRightBorder = !lcl_HasNextCell( *pNextCell );
4887 : : bNoBordersInside =
4888 : 0 : ( !rBorderBox.GetTop() || !pParentRowFrm->GetPrev() ) &&
4889 : 0 : !rBorderBox.GetLeft() &&
4890 : 0 : ( !rBorderBox.GetRight() || bCellAtRightBorder ) &&
4891 [ # # ][ # # ]: 0 : ( !rBorderBox.GetBottom() || !pParentRowFrm->GetNext() );
[ # # ][ # # ]
[ # # # #
# # # # ]
4892 : : }
4893 : : else
4894 : : {
4895 : 0 : const SvxBoxItem& rBorderBox = _rCellBorderAttrs.GetBox();
4896 : : bNoBordersInside =
4897 : 0 : ( !rBorderBox.GetTop() || !pParentRowFrm->GetPrev() ) &&
4898 : 0 : ( !rBorderBox.GetLeft() || bCellAtLeftBorder ) &&
4899 : 0 : ( !rBorderBox.GetRight() || bCellAtRightBorder ) &&
4900 [ # # # # ]: 0 : ( !rBorderBox.GetBottom() || !pParentRowFrm->GetNext() );
[ # # ][ # # ]
[ # # ][ # #
# # # # ]
4901 : : }
4902 : :
4903 [ # # ]: 0 : if ( bNoBordersInside )
4904 : : {
4905 [ # # ][ # # ]: 0 : if ( _bTop && !_rCellBorderAttrs.GetBox().GetTop() )
[ # # ]
4906 : : {
4907 : : //-hack
4908 : : // Cell frame has no top border and no border inside the table, but
4909 : : // it is at the top border of a table frame, which is a follow.
4910 : : // Thus, use border attributes of cell frame in first row of complete table.
4911 : : // First, determine first table frame of complete table.
4912 : 0 : SwTabFrm* pMasterTabFrm = pParentTabFrm->FindMaster( true );
4913 : : // determine first row of complete table.
4914 : 0 : const SwFrm* pFirstRow = pMasterTabFrm->GetLower();
4915 : : // return first cell in first row
4916 : 0 : SwFrm* pLowerCell = const_cast<SwFrm*>(pFirstRow->GetLower());
4917 [ # # # # : 0 : while ( !pLowerCell->IsCellFrm() ||
# # ][ # # ]
4918 : 0 : ( pLowerCell->GetLower() && pLowerCell->GetLower()->IsRowFrm() )
4919 : : )
4920 : : {
4921 : 0 : pLowerCell = pLowerCell->GetLower();
4922 : : }
4923 : : OSL_ENSURE( pLowerCell && pLowerCell->IsCellFrm(), "No CellFrm available" );
4924 : 0 : pRet = pLowerCell;
4925 : : }
4926 [ # # ][ # # ]: 0 : else if ( !_bTop && !_rCellBorderAttrs.GetBox().GetBottom() )
[ # # ]
4927 : : {
4928 : : //-hack
4929 : : // Cell frame has no bottom border and no border inside the table,
4930 : : // but it is at the bottom border of a table frame, which has a follow.
4931 : : // Thus, use border attributes of cell frame in last row of complete table.
4932 : : // First, determine last table frame of complete table.
4933 : 0 : SwTabFrm* pLastTabFrm = const_cast<SwTabFrm*>(pParentTabFrm->GetFollow());
4934 [ # # ]: 0 : while ( pLastTabFrm->GetFollow() )
4935 : : {
4936 : 0 : pLastTabFrm = pLastTabFrm->GetFollow();
4937 : : }
4938 : : // determine last row of complete table.
4939 : 0 : SwFrm* pLastRow = pLastTabFrm->GetLastLower();
4940 : : // return first bottom border cell in last row
4941 : 0 : SwFrm* pLowerCell = const_cast<SwFrm*>(pLastRow->GetLower());
4942 [ # # # # : 0 : while ( !pLowerCell->IsCellFrm() ||
# # ][ # # ]
4943 : 0 : ( pLowerCell->GetLower() && pLowerCell->GetLower()->IsRowFrm() )
4944 : : )
4945 : : {
4946 [ # # ]: 0 : if ( pLowerCell->IsRowFrm() )
4947 : : {
4948 [ # # ]: 0 : while ( pLowerCell->GetNext() )
4949 : : {
4950 : 0 : pLowerCell = pLowerCell->GetNext();
4951 : : }
4952 : : }
4953 : 0 : pLowerCell = pLowerCell->GetLower();
4954 : : }
4955 : : OSL_ENSURE( pLowerCell && pLowerCell->IsCellFrm(), "No CellFrm available" );
4956 : 0 : pRet = pLowerCell;
4957 : : }
4958 : : }
4959 : : }
4960 : :
4961 : 0 : return pRet;
4962 : : }
4963 : :
4964 : 34496 : drawinglayer::processor2d::BaseProcessor2D * SwFrm::CreateProcessor2D( ) const
4965 : : {
4966 [ + - ]: 34496 : basegfx::B2DRange aViewRange;
4967 : :
4968 : 34496 : SdrPage *pDrawPage = getRootFrm()->GetCurrShell()->Imp()->GetPageView()->GetPage();
4969 : : const drawinglayer::geometry::ViewInformation2D aNewViewInfos(
4970 : : basegfx::B2DHomMatrix( ),
4971 : : getRootFrm()->GetCurrShell()->GetOut()->GetViewTransformation(),
4972 : : aViewRange,
4973 : : GetXDrawPageForSdrPage( pDrawPage ),
4974 : : 0.0,
4975 [ + - ][ + - ]: 34496 : uno::Sequence< beans::PropertyValue >() );
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ]
4976 : :
4977 : : return drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice(
4978 : 34496 : *getRootFrm()->GetCurrShell()->GetOut(),
4979 [ + - ][ + - ]: 34496 : aNewViewInfos );
4980 : : }
4981 : :
4982 : 34496 : void SwFrm::ProcessPrimitives( const drawinglayer::primitive2d::Primitive2DSequence& rSequence ) const
4983 : : {
4984 : 34496 : drawinglayer::processor2d::BaseProcessor2D * pProcessor2D = CreateProcessor2D();
4985 : :
4986 [ + - ]: 34496 : if ( pProcessor2D )
4987 : : {
4988 : 34496 : pProcessor2D->process( rSequence );
4989 [ + - ]: 34496 : delete pProcessor2D;
4990 : : }
4991 : 34496 : }
4992 : :
4993 : 53854 : void SwFrm::PaintBorder( const SwRect& rRect, const SwPageFrm *pPage,
4994 : : const SwBorderAttrs &rAttrs ) const
4995 : : {
4996 : : //fuer (Row,Body,Ftn,Root,Column,NoTxt) gibt's hier nix zu tun
4997 [ + + ]: 53854 : if ( (GetType() & 0x90C5) )
4998 : 15155 : return;
4999 : :
5000 [ + + - + ]: 43721 : if ( (GetType() & 0x2000) && //Cell
[ - + ]
5001 : 5022 : !pGlobalShell->GetViewOptions()->IsTable() )
5002 : 0 : return;
5003 : :
5004 : : // #i29550#
5005 [ + + ][ + + ]: 38699 : if ( IsTabFrm() || IsCellFrm() || IsRowFrm() )
[ - + ][ + + ]
5006 : : {
5007 : 5693 : const SwTabFrm* pTabFrm = FindTabFrm();
5008 [ + - ]: 5693 : if ( pTabFrm->IsCollapsingBorders() )
5009 : 5693 : return;
5010 : :
5011 [ # # ][ # # ]: 0 : if ( pTabFrm->GetTable()->IsNewModel() && ( !IsCellFrm() || IsCoveredCell() ) )
[ # # ][ # # ]
5012 : 0 : return;
5013 : : }
5014 : :
5015 : 33006 : const bool bLine = rAttrs.IsLine() ? true : false;
5016 : 33006 : const bool bShadow = rAttrs.GetShadow().GetLocation() != SVX_SHADOW_NONE;
5017 : :
5018 : : // - flag to control,
5019 : : //-hack has to be used.
5020 : 33006 : const bool bb4779636HackActive = true;
5021 : : //
5022 : 33006 : const SwFrm* pCellFrmForBottomBorderAttrs = 0;
5023 : 33006 : const SwFrm* pCellFrmForTopBorderAttrs = 0;
5024 : 33006 : bool bFoundCellForTopOrBorderAttrs = false;
5025 [ - + ]: 33006 : if ( bb4779636HackActive && IsCellFrm() )
5026 : : {
5027 : 0 : pCellFrmForBottomBorderAttrs = lcl_GetCellFrmForBorderAttrs( this, rAttrs, false );
5028 [ # # ]: 0 : if ( pCellFrmForBottomBorderAttrs != this )
5029 : 0 : bFoundCellForTopOrBorderAttrs = true;
5030 : 0 : pCellFrmForTopBorderAttrs = lcl_GetCellFrmForBorderAttrs( this, rAttrs, true );
5031 [ # # ]: 0 : if ( pCellFrmForTopBorderAttrs != this )
5032 : 0 : bFoundCellForTopOrBorderAttrs = true;
5033 : : }
5034 : :
5035 : : // - add condition <bFoundCellForTopOrBorderAttrs>
5036 : : //-hack
5037 [ + + ][ + - ]: 33006 : if ( bLine || bShadow || bFoundCellForTopOrBorderAttrs )
[ - + ]
5038 : : {
5039 : : //If the rectangle is completely inside the PrtArea, no border needs to
5040 : : //be painted.
5041 : : //For the PrtArea the aligned value needs to be used, otherwise it could
5042 : : //happen, that some parts won't be processed.
5043 : 271 : SwRect aRect( Prt() );
5044 : 271 : aRect += Frm().Pos();
5045 [ + - ]: 271 : ::SwAlignRect( aRect, pGlobalShell );
5046 : : // OD 27.09.2002 #103636# - new local boolean variable in order to
5047 : : // suspend border paint under special cases - see below.
5048 : : // NOTE: This is a fix for the implementation of feature #99657#.
5049 : 271 : bool bDrawOnlyShadowForTransparentFrame = false;
5050 [ + - ][ - + ]: 271 : if ( aRect.IsInside( rRect ) )
5051 : : {
5052 : : // OD 27.09.2002 #103636# - paint shadow, if background is transparent.
5053 : : // Because of introduced transparent background for fly frame #99657#,
5054 : : // the shadow have to be drawn if the background is transparent,
5055 : : // in spite the fact that the paint rectangle <rRect> lies fully
5056 : : // in the printing area.
5057 : : // NOTE to chosen solution:
5058 : : // On transparent background, continue processing, but suspend
5059 : : // drawing of border by setting <bDrawOnlyShadowForTransparentFrame>
5060 : : // to true.
5061 [ # # ][ # # ]: 0 : if ( IsLayoutFrm() &&
[ # # ]
5062 [ # # ][ # # ]: 0 : static_cast<const SwLayoutFrm*>(this)->GetFmt()->IsBackgroundTransparent() )
5063 : : {
5064 : 0 : bDrawOnlyShadowForTransparentFrame = true;
5065 : : }
5066 : : else
5067 : : {
5068 : : return;
5069 : : }
5070 : : }
5071 : :
5072 [ - + ]: 271 : if ( !pPage )
5073 [ # # ]: 0 : pPage = FindPageFrm();
5074 : :
5075 [ + - ]: 271 : ::lcl_CalcBorderRect( aRect, this, rAttrs, sal_True );
5076 : 271 : rAttrs.SetGetCacheLine( sal_True );
5077 [ - + ]: 271 : if ( bShadow )
5078 [ # # ]: 0 : PaintShadow( rRect, aRect, rAttrs );
5079 : : // OD 27.09.2002 #103636# - suspend drawing of border
5080 : : // add condition < NOT bDrawOnlyShadowForTransparentFrame > - see above
5081 : : // - add condition <bFoundCellForTopOrBorderAttrs>
5082 : : //-hack.
5083 [ - + ][ # # ]: 271 : if ( ( bLine || bFoundCellForTopOrBorderAttrs ) &&
[ + - ]
5084 : 271 : !bDrawOnlyShadowForTransparentFrame )
5085 : : {
5086 [ - + ][ # # ]: 271 : const SwFrm* pDirRefFrm = IsCellFrm() ? FindTabFrm() : this;
5087 [ + - ][ - + ]: 271 : SWRECTFN( pDirRefFrm )
[ # # ][ # # ]
[ - + ]
5088 [ + - ]: 271 : ::lcl_PaintLeftRightLine ( sal_True, *(this), *(pPage), aRect, rRect, rAttrs, fnRect );
5089 [ + - ]: 271 : ::lcl_PaintLeftRightLine ( sal_False, *(this), *(pPage), aRect, rRect, rAttrs, fnRect );
5090 [ + + ][ + - ]: 271 : if ( !IsCntntFrm() || rAttrs.GetTopLine( *(this) ) )
[ - + ][ + + ]
5091 : : {
5092 : : // -
5093 : : //-hack
5094 : : // paint is found, paint its top border.
5095 [ - + ][ # # ]: 265 : if ( IsCellFrm() && pCellFrmForTopBorderAttrs != this )
[ - + ]
5096 : : {
5097 : 0 : SwBorderAttrAccess aAccess( SwFrm::GetCache(),
5098 [ # # ]: 0 : pCellFrmForTopBorderAttrs );
5099 [ # # ]: 0 : const SwBorderAttrs &rTopAttrs = *aAccess.Get();
5100 [ # # ][ # # ]: 0 : ::lcl_PaintTopBottomLine( sal_True, *(this), *(pPage), aRect, rRect, rTopAttrs, fnRect );
5101 : : }
5102 : : else
5103 : : {
5104 [ + - ]: 265 : ::lcl_PaintTopBottomLine( sal_True, *(this), *(pPage), aRect, rRect, rAttrs, fnRect );
5105 : : }
5106 : : }
5107 [ + + ][ + - ]: 271 : if ( !IsCntntFrm() || rAttrs.GetBottomLine( *(this) ) )
[ + + ][ + + ]
5108 : : {
5109 : : // -
5110 : : //-hack
5111 : : // paint is found, paint its bottom border.
5112 [ - + ][ # # ]: 268 : if ( IsCellFrm() && pCellFrmForBottomBorderAttrs != this )
[ - + ]
5113 : : {
5114 : 0 : SwBorderAttrAccess aAccess( SwFrm::GetCache(),
5115 [ # # ]: 0 : pCellFrmForBottomBorderAttrs );
5116 [ # # ]: 0 : const SwBorderAttrs &rBottomAttrs = *aAccess.Get();
5117 [ # # ][ # # ]: 0 : ::lcl_PaintTopBottomLine(sal_False, *(this), *(pPage), aRect, rRect, rBottomAttrs, fnRect);
5118 : : }
5119 : : else
5120 : : {
5121 [ + - ]: 271 : ::lcl_PaintTopBottomLine(sal_False, *(this), *(pPage), aRect, rRect, rAttrs, fnRect);
5122 : : }
5123 : : }
5124 : : }
5125 : 53854 : rAttrs.SetGetCacheLine( sal_False );
5126 : : }
5127 : : }
5128 : : /*************************************************************************
5129 : : |*
5130 : : |* SwFtnContFrm::PaintBorder()
5131 : : |*
5132 : : |* Description Special implementation because of the footnote line.
5133 : : |* Currently only the top frame needs to be taken into account.
5134 : : |* Other lines and shadows are set aside.
5135 : : |*************************************************************************/
5136 : :
5137 : 11 : void SwFtnContFrm::PaintBorder( const SwRect& rRect, const SwPageFrm *pPage,
5138 : : const SwBorderAttrs & ) const
5139 : : {
5140 : : //If the rectangle is completely inside the PrtArea, no border needs to
5141 : : //be painted.
5142 : 11 : SwRect aRect( Prt() );
5143 : 11 : aRect.Pos() += Frm().Pos();
5144 [ + - ][ + - ]: 11 : if ( !aRect.IsInside( rRect ) )
5145 [ + - ]: 11 : PaintLine( rRect, pPage );
5146 : 11 : }
5147 : : /*************************************************************************
5148 : : |*
5149 : : |* SwFtnContFrm::PaintLine()
5150 : : |*
5151 : : |* Description Paint footnote lines.
5152 : : |*
5153 : : |*************************************************************************/
5154 : :
5155 : 11 : void SwFtnContFrm::PaintLine( const SwRect& rRect,
5156 : : const SwPageFrm *pPage ) const
5157 : : {
5158 : : //The length of the line is derived from the percentual indication on the
5159 : : //PageDesc. The position is also stated on the PageDesc.
5160 : : //The pen can directly be taken from the PageDesc.
5161 : :
5162 [ - + ]: 11 : if ( !pPage )
5163 [ # # ]: 0 : pPage = FindPageFrm();
5164 : 11 : const SwPageFtnInfo &rInf = pPage->GetPageDesc()->GetFtnInfo();
5165 : :
5166 [ - + ][ # # ]: 11 : SWRECTFN( this )
[ # # ][ - + ]
[ + - ]
5167 [ + - ][ + - ]: 11 : SwTwips nPrtWidth = (Prt().*fnRect->fnGetWidth)();
5168 [ + - ]: 11 : Fraction aFract( nPrtWidth, 1 );
5169 [ + - ][ + - ]: 11 : const SwTwips nWidth = (long)(aFract *= rInf.GetWidth());
5170 : :
5171 [ + - ][ + - ]: 11 : SwTwips nX = (this->*fnRect->fnGetPrtLeft)();
5172 [ - - + - ]: 11 : switch ( rInf.GetAdj() )
5173 : : {
5174 : : case FTNADJ_CENTER:
5175 : 0 : nX += nPrtWidth/2 - nWidth/2; break;
5176 : : case FTNADJ_RIGHT:
5177 : 0 : nX += nPrtWidth - nWidth; break;
5178 : : case FTNADJ_LEFT:
5179 : 11 : /* do nothing */; break;
5180 : : default:
5181 : : OSL_ENSURE( !this, "New adjustment for footnote lines?" );
5182 : : }
5183 : 11 : SwTwips nLineWidth = rInf.GetLineWidth();
5184 : : const SwRect aLineRect = bVert ?
5185 : 0 : SwRect( Point(Frm().Left()+Frm().Width()-rInf.GetTopDist()-nLineWidth,
5186 : : nX), Size( nLineWidth, nWidth ) )
5187 : 11 : : SwRect( Point( nX, Frm().Pos().Y() + rInf.GetTopDist() ),
5188 [ + - ][ + - ]: 22 : Size( nWidth, rInf.GetLineWidth()));
[ - + ][ - + ]
[ - + ]
5189 [ + - ][ - + ]: 11 : if ( aLineRect.HasArea() )
5190 : 0 : PaintBorderLine( rRect, aLineRect , pPage, &rInf.GetLineColor(),
5191 [ # # ]: 0 : rInf.GetLineStyle() );
5192 : 11 : }
5193 : :
5194 : : /*************************************************************************
5195 : : |*
5196 : : |* SwLayoutFrm::PaintColLines()
5197 : : |*
5198 : : |* Description Paints the separator line for inside columns
5199 : : |*
5200 : : |*************************************************************************/
5201 : :
5202 : 0 : void SwLayoutFrm::PaintColLines( const SwRect &rRect, const SwFmtCol &rFmtCol,
5203 : : const SwPageFrm *pPage ) const
5204 : : {
5205 : 0 : const SwFrm *pCol = Lower();
5206 [ # # ][ # # ]: 0 : if ( !pCol || !pCol->IsColumnFrm() )
[ # # ]
5207 : 0 : return;
5208 : : //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
5209 [ # # ][ # # ]: 0 : SwRectFn fnRect = pCol->IsVertical() ? ( pCol->IsVertLR() ? fnRectVertL2R : fnRectVert ) : fnRectHori;
[ # # ]
5210 : :
5211 : 0 : SwRect aLineRect = Prt();
5212 : 0 : aLineRect += Frm().Pos();
5213 : :
5214 [ # # ][ # # ]: 0 : SwTwips nTop = ((aLineRect.*fnRect->fnGetHeight)()*rFmtCol.GetLineHeight())
5215 [ # # ][ # # ]: 0 : / 100 - (aLineRect.*fnRect->fnGetHeight)();
5216 : 0 : SwTwips nBottom = 0;
5217 : :
5218 [ # # # # ]: 0 : switch ( rFmtCol.GetLineAdj() )
5219 : : {
5220 : : case COLADJ_CENTER:
5221 : 0 : nBottom = nTop / 2; nTop -= nBottom; break;
5222 : : case COLADJ_TOP:
5223 : 0 : nBottom = nTop; nTop = 0; break;
5224 : : case COLADJ_BOTTOM:
5225 : 0 : break;
5226 : : default:
5227 : : OSL_ENSURE( !this, "New adjustment for column lines?" );
5228 : : }
5229 : :
5230 [ # # ]: 0 : if( nTop )
5231 [ # # ][ # # ]: 0 : (aLineRect.*fnRect->fnSubTop)( nTop );
5232 [ # # ]: 0 : if( nBottom )
5233 [ # # ][ # # ]: 0 : (aLineRect.*fnRect->fnAddBottom)( nBottom );
5234 : :
5235 : 0 : SwTwips nPenHalf = rFmtCol.GetLineWidth();
5236 [ # # ][ # # ]: 0 : (aLineRect.*fnRect->fnSetWidth)( nPenHalf );
5237 : 0 : nPenHalf /= 2;
5238 : :
5239 : : //We need to be a bit generous here, to not lose something.
5240 : 0 : SwRect aRect( rRect );
5241 [ # # ][ # # ]: 0 : (aRect.*fnRect->fnSubLeft)( nPenHalf + nPixelSzW );
5242 [ # # ][ # # ]: 0 : (aRect.*fnRect->fnAddRight)( nPenHalf + nPixelSzW );
5243 [ # # ][ # # ]: 0 : SwRectGet fnGetX = IsRightToLeft() ? fnRect->fnGetLeft : fnRect->fnGetRight;
5244 [ # # ]: 0 : while ( pCol->GetNext() )
5245 : : {
5246 : : (aLineRect.*fnRect->fnSetPosX)
5247 [ # # ][ # # ]: 0 : ( (pCol->Frm().*fnGetX)() - nPenHalf );
[ # # ][ # # ]
5248 [ # # ][ # # ]: 0 : if ( aRect.IsOver( aLineRect ) )
5249 : 0 : PaintBorderLine( aRect, aLineRect , pPage, &rFmtCol.GetLineColor(),
5250 [ # # ]: 0 : rFmtCol.GetLineStyle() );
5251 : 0 : pCol = pCol->GetNext();
5252 : : }
5253 : : }
5254 : :
5255 : 12259 : void SwPageFrm::PaintGrid( OutputDevice* pOut, SwRect &rRect ) const
5256 : : {
5257 [ - + ][ # # ]: 12259 : if( !bHasGrid || pRetoucheFly || pRetoucheFly2 )
[ # # ]
5258 : 12259 : return;
5259 [ # # ][ # # ]: 0 : GETGRID( this )
[ # # ][ # # ]
5260 [ # # ]: 0 : if( pGrid && ( OUTDEV_PRINTER != pOut->GetOutDevType() ?
[ # # # # ]
[ # # ]
5261 [ # # ]: 0 : pGrid->GetDisplayGrid() : pGrid->GetPrintGrid() ) )
5262 : : {
5263 : 0 : const SwLayoutFrm* pBody = FindBodyCont();
5264 [ # # ]: 0 : if( pBody )
5265 : : {
5266 : 0 : SwRect aGrid( pBody->Prt() );
5267 : 0 : aGrid += pBody->Frm().Pos();
5268 : :
5269 : 0 : SwRect aInter( aGrid );
5270 [ # # ]: 0 : aInter.Intersection( rRect );
5271 [ # # ][ # # ]: 0 : if( aInter.HasArea() )
5272 : : {
5273 : 0 : sal_Bool bGrid = pGrid->GetRubyTextBelow();
5274 : 0 : sal_Bool bCell = GRID_LINES_CHARS == pGrid->GetGridType();
5275 : 0 : long nGrid = pGrid->GetBaseHeight();
5276 [ # # ]: 0 : const SwDoc* pDoc = GetFmt()->GetDoc();
5277 [ # # ][ # # ]: 0 : long nGridWidth = GETGRIDWIDTH(pGrid,pDoc); //for textgrid refactor
5278 : 0 : long nRuby = pGrid->GetRubyHeight();
5279 : 0 : long nSum = nGrid + nRuby;
5280 : 0 : const Color *pCol = &pGrid->GetColor();
5281 : :
5282 : 0 : SwTwips nRight = aInter.Left() + aInter.Width();
5283 : 0 : SwTwips nBottom = aInter.Top() + aInter.Height();
5284 [ # # ][ # # ]: 0 : if( IsVertical() )
5285 : : {
5286 : 0 : SwTwips nOrig = aGrid.Left() + aGrid.Width();
5287 : : SwTwips nY = nOrig + nSum *
5288 : 0 : ( ( nOrig - aInter.Left() ) / nSum );
5289 : : SwRect aTmp( Point( nY, aInter.Top() ),
5290 : 0 : Size( 1, aInter.Height() ) );
5291 : 0 : SwTwips nX = aGrid.Top() + nGrid *
5292 : 0 : ( ( aInter.Top() - aGrid.Top() )/ nGrid );
5293 [ # # ]: 0 : if( nX < aInter.Top() )
5294 : 0 : nX += nGrid;
5295 : 0 : SwTwips nGridBottom = aGrid.Top() + aGrid.Height();
5296 : 0 : sal_Bool bLeft = aGrid.Top() >= aInter.Top();
5297 : 0 : sal_Bool bRight = nGridBottom <= nBottom;
5298 [ # # ][ # # ]: 0 : sal_Bool bBorder = bLeft || bRight;
5299 [ # # ]: 0 : while( nY > nRight )
5300 : : {
5301 : 0 : aTmp.Pos().X() = nY;
5302 [ # # ]: 0 : if( bGrid )
5303 : : {
5304 : 0 : nY -= nGrid;
5305 : 0 : SwTwips nPosY = Max( aInter.Left(), nY );
5306 : 0 : SwTwips nHeight = Min(nRight, aTmp.Pos().X())-nPosY;
5307 [ # # ]: 0 : if( nHeight > 0 )
5308 : : {
5309 [ # # ]: 0 : if( bCell )
5310 : : {
5311 : : SwRect aVert( Point( nPosY, nX ),
5312 : 0 : Size( nHeight, 1 ) );
5313 [ # # ]: 0 : while( aVert.Top() <= nBottom )
5314 : : {
5315 [ # # ]: 0 : PaintBorderLine(rRect,aVert,this,pCol);
5316 : 0 : aVert.Pos().Y() += nGrid;
5317 : : }
5318 : : }
5319 [ # # ]: 0 : else if( bBorder )
5320 : : {
5321 : : SwRect aVert( Point( nPosY, aGrid.Top() ),
5322 : 0 : Size( nHeight, 1 ) );
5323 [ # # ]: 0 : if( bLeft )
5324 [ # # ]: 0 : PaintBorderLine(rRect,aVert,this,pCol);
5325 [ # # ]: 0 : if( bRight )
5326 : : {
5327 : 0 : aVert.Pos().Y() = nGridBottom;
5328 [ # # ]: 0 : PaintBorderLine(rRect,aVert,this,pCol);
5329 : : }
5330 : : }
5331 : : }
5332 : : }
5333 : : else
5334 : : {
5335 : 0 : nY -= nRuby;
5336 [ # # ]: 0 : if( bBorder )
5337 : : {
5338 : 0 : SwTwips nPos = Max( aInter.Left(), nY );
5339 : 0 : SwTwips nW = Min(nRight, aTmp.Pos().X()) - nPos;
5340 : : SwRect aVert( Point( nPos, aGrid.Top() ),
5341 : 0 : Size( nW, 1 ) );
5342 [ # # ]: 0 : if( nW > 0 )
5343 : : {
5344 [ # # ]: 0 : if( bLeft )
5345 [ # # ]: 0 : PaintBorderLine(rRect,aVert,this,pCol);
5346 [ # # ]: 0 : if( bRight )
5347 : : {
5348 : 0 : aVert.Pos().Y() = nGridBottom;
5349 [ # # ]: 0 : PaintBorderLine(rRect,aVert,this,pCol);
5350 : : }
5351 : : }
5352 : : }
5353 : : }
5354 : 0 : bGrid = !bGrid;
5355 : : }
5356 [ # # ]: 0 : while( nY >= aInter.Left() )
5357 : : {
5358 : 0 : aTmp.Pos().X() = nY;
5359 [ # # ]: 0 : PaintBorderLine( rRect, aTmp, this, pCol);
5360 [ # # ]: 0 : if( bGrid )
5361 : : {
5362 : 0 : nY -= nGrid;
5363 : 0 : SwTwips nHeight = aTmp.Pos().X()
5364 : 0 : - Max(aInter.Left(), nY );
5365 [ # # ]: 0 : if( nHeight > 0 )
5366 : : {
5367 [ # # ]: 0 : if( bCell )
5368 : : {
5369 : 0 : SwRect aVert( Point(aTmp.Pos().X()-nHeight,
5370 : 0 : nX ), Size( nHeight, 1 ) );
5371 [ # # ]: 0 : while( aVert.Top() <= nBottom )
5372 : : {
5373 [ # # ]: 0 : PaintBorderLine(rRect,aVert,this,pCol);
5374 : 0 : aVert.Pos().Y() += nGrid;
5375 : : }
5376 : : }
5377 [ # # ]: 0 : else if( bBorder )
5378 : : {
5379 : 0 : SwRect aVert( Point(aTmp.Pos().X()-nHeight,
5380 : 0 : aGrid.Top() ), Size( nHeight, 1 ) );
5381 [ # # ]: 0 : if( bLeft )
5382 [ # # ]: 0 : PaintBorderLine(rRect,aVert,this,pCol);
5383 [ # # ]: 0 : if( bRight )
5384 : : {
5385 : 0 : aVert.Pos().Y() = nGridBottom;
5386 [ # # ]: 0 : PaintBorderLine(rRect,aVert,this,pCol);
5387 : : }
5388 : : }
5389 : : }
5390 : : }
5391 : : else
5392 : : {
5393 : 0 : nY -= nRuby;
5394 [ # # ]: 0 : if( bBorder )
5395 : : {
5396 : 0 : SwTwips nPos = Max( aInter.Left(), nY );
5397 : 0 : SwTwips nW = Min(nRight, aTmp.Pos().X()) - nPos;
5398 : : SwRect aVert( Point( nPos, aGrid.Top() ),
5399 : 0 : Size( nW, 1 ) );
5400 [ # # ]: 0 : if( nW > 0 )
5401 : : {
5402 [ # # ]: 0 : if( bLeft )
5403 [ # # ]: 0 : PaintBorderLine(rRect,aVert,this,pCol);
5404 [ # # ]: 0 : if( bRight )
5405 : : {
5406 : 0 : aVert.Pos().Y() = nGridBottom;
5407 [ # # ]: 0 : PaintBorderLine(rRect,aVert,this,pCol);
5408 : : }
5409 : : }
5410 : : }
5411 : : }
5412 : 0 : bGrid = !bGrid;
5413 : : }
5414 : : }
5415 : : else
5416 : : {
5417 : 0 : SwTwips nOrig = aGrid.Top();
5418 : 0 : SwTwips nY = nOrig + nSum *( (aInter.Top()-nOrig)/nSum );
5419 : : SwRect aTmp( Point( aInter.Left(), nY ),
5420 : 0 : Size( aInter.Width(), 1 ) );
5421 : : //for textgrid refactor
5422 : 0 : SwTwips nX = aGrid.Left() + nGridWidth *
5423 : 0 : ( ( aInter.Left() - aGrid.Left() )/ nGridWidth );
5424 [ # # ]: 0 : if( nX < aInter.Left() )
5425 : 0 : nX += nGridWidth;
5426 : 0 : SwTwips nGridRight = aGrid.Left() + aGrid.Width();
5427 : 0 : sal_Bool bLeft = aGrid.Left() >= aInter.Left();
5428 : 0 : sal_Bool bRight = nGridRight <= nRight;
5429 [ # # ][ # # ]: 0 : sal_Bool bBorder = bLeft || bRight;
5430 [ # # ]: 0 : while( nY < aInter.Top() )
5431 : : {
5432 : 0 : aTmp.Pos().Y() = nY;
5433 [ # # ]: 0 : if( bGrid )
5434 : : {
5435 : 0 : nY += nGrid;
5436 : 0 : SwTwips nPosY = Max( aInter.Top(), aTmp.Pos().Y() );
5437 : 0 : SwTwips nHeight = Min(nBottom, nY ) - nPosY;
5438 [ # # ]: 0 : if( nHeight )
5439 : : {
5440 [ # # ]: 0 : if( bCell )
5441 : : {
5442 : : SwRect aVert( Point( nX, nPosY ),
5443 : 0 : Size( 1, nHeight ) );
5444 [ # # ]: 0 : while( aVert.Left() <= nRight )
5445 : : {
5446 [ # # ]: 0 : PaintBorderLine(rRect,aVert,this,pCol);
5447 : 0 : aVert.Pos().X() += nGridWidth; //for textgrid refactor
5448 : : }
5449 : : }
5450 [ # # ]: 0 : else if ( bBorder )
5451 : : {
5452 : : SwRect aVert( Point( aGrid.Left(), nPosY ),
5453 : 0 : Size( 1, nHeight ) );
5454 [ # # ]: 0 : if( bLeft )
5455 [ # # ]: 0 : PaintBorderLine(rRect,aVert,this,pCol);
5456 [ # # ]: 0 : if( bRight )
5457 : : {
5458 : 0 : aVert.Pos().X() = nGridRight;
5459 [ # # ]: 0 : PaintBorderLine(rRect,aVert,this,pCol);
5460 : : }
5461 : : }
5462 : : }
5463 : : }
5464 : : else
5465 : : {
5466 : 0 : nY += nRuby;
5467 [ # # ]: 0 : if( bBorder )
5468 : : {
5469 : 0 : SwTwips nPos = Max(aInter.Top(),aTmp.Pos().Y());
5470 : 0 : SwTwips nH = Min( nBottom, nY ) - nPos;
5471 : : SwRect aVert( Point( aGrid.Left(), nPos ),
5472 : 0 : Size( 1, nH ) );
5473 [ # # ]: 0 : if( nH > 0 )
5474 : : {
5475 [ # # ]: 0 : if( bLeft )
5476 [ # # ]: 0 : PaintBorderLine(rRect,aVert,this,pCol);
5477 [ # # ]: 0 : if( bRight )
5478 : : {
5479 : 0 : aVert.Pos().X() = nGridRight;
5480 [ # # ]: 0 : PaintBorderLine(rRect,aVert,this,pCol);
5481 : : }
5482 : : }
5483 : : }
5484 : : }
5485 : 0 : bGrid = !bGrid;
5486 : : }
5487 [ # # ]: 0 : while( nY <= nBottom )
5488 : : {
5489 : 0 : aTmp.Pos().Y() = nY;
5490 [ # # ]: 0 : PaintBorderLine( rRect, aTmp, this, pCol);
5491 [ # # ]: 0 : if( bGrid )
5492 : : {
5493 : 0 : nY += nGrid;
5494 : 0 : SwTwips nHeight = Min(nBottom, nY) - aTmp.Pos().Y();
5495 [ # # ]: 0 : if( nHeight )
5496 : : {
5497 [ # # ]: 0 : if( bCell )
5498 : : {
5499 : 0 : SwRect aVert( Point( nX, aTmp.Pos().Y() ),
5500 : 0 : Size( 1, nHeight ) );
5501 [ # # ]: 0 : while( aVert.Left() <= nRight )
5502 : : {
5503 [ # # ]: 0 : PaintBorderLine( rRect, aVert, this, pCol);
5504 : 0 : aVert.Pos().X() += nGridWidth; //for textgrid refactor
5505 : : }
5506 : : }
5507 [ # # ]: 0 : else if( bBorder )
5508 : : {
5509 : : SwRect aVert( Point( aGrid.Left(),
5510 : 0 : aTmp.Pos().Y() ), Size( 1, nHeight ) );
5511 [ # # ]: 0 : if( bLeft )
5512 [ # # ]: 0 : PaintBorderLine(rRect,aVert,this,pCol);
5513 [ # # ]: 0 : if( bRight )
5514 : : {
5515 : 0 : aVert.Pos().X() = nGridRight;
5516 [ # # ]: 0 : PaintBorderLine(rRect,aVert,this,pCol);
5517 : : }
5518 : : }
5519 : : }
5520 : : }
5521 : : else
5522 : : {
5523 : 0 : nY += nRuby;
5524 [ # # ]: 0 : if( bBorder )
5525 : : {
5526 : 0 : SwTwips nPos = Max(aInter.Top(),aTmp.Pos().Y());
5527 : 0 : SwTwips nH = Min( nBottom, nY ) - nPos;
5528 : : SwRect aVert( Point( aGrid.Left(), nPos ),
5529 : 0 : Size( 1, nH ) );
5530 [ # # ]: 0 : if( nH > 0 )
5531 : : {
5532 [ # # ]: 0 : if( bLeft )
5533 [ # # ]: 0 : PaintBorderLine(rRect,aVert,this,pCol);
5534 [ # # ]: 0 : if( bRight )
5535 : : {
5536 : 0 : aVert.Pos().X() = nGridRight;
5537 [ # # ]: 0 : PaintBorderLine(rRect,aVert,this,pCol);
5538 : : }
5539 : : }
5540 : : }
5541 : : }
5542 : 0 : bGrid = !bGrid;
5543 : : }
5544 : : }
5545 : : }
5546 : : }
5547 : : }
5548 : : }
5549 : :
5550 : : /** paint margin area of a page
5551 : :
5552 : : OD 20.11.2002 for #104598#:
5553 : : implement paint of margin area; margin area will be painted for a
5554 : : view shell with a window and if the document is not in online layout.
5555 : :
5556 : : @author OD
5557 : :
5558 : : @param _rOutputRect
5559 : : input parameter - constant instance reference of the rectangle, for
5560 : : which an output has to be generated.
5561 : :
5562 : : @param _pViewShell
5563 : : input parameter - instance of the view shell, on which the output
5564 : : has to be generated.
5565 : : */
5566 : 12259 : void SwPageFrm::PaintMarginArea( const SwRect& _rOutputRect,
5567 : : ViewShell* _pViewShell ) const
5568 : : {
5569 [ + + + + ]: 24499 : if ( _pViewShell->GetWin() &&
[ + + ]
5570 : 12240 : !_pViewShell->GetViewOptions()->getBrowseMode() )
5571 : : {
5572 : 12168 : SwRect aPgPrtRect( Prt() );
5573 : 12168 : aPgPrtRect.Pos() += Frm().Pos();
5574 [ + + ][ + - ]: 12168 : if ( !aPgPrtRect.IsInside( _rOutputRect ) )
5575 : : {
5576 : 10974 : SwRect aPgRect = Frm();
5577 [ + - ]: 10974 : aPgRect._Intersection( _rOutputRect );
5578 [ + + ][ + + ]: 10974 : if(aPgRect.Height() < 0 || aPgRect.Width() <= 0) // No intersection
[ + + ]
5579 : 12259 : return;
5580 [ + - ]: 10955 : SwRegionRects aPgRegion( aPgRect );
5581 [ + - ]: 10955 : aPgRegion -= aPgPrtRect;
5582 : 10955 : const SwPageFrm* pPage = static_cast<const SwPageFrm*>(this);
5583 [ + + ]: 10955 : if ( pPage->GetSortedObjs() )
5584 [ + - ]: 267 : ::lcl_SubtractFlys( this, pPage, aPgRect, aPgRegion );
5585 [ + - ]: 10955 : if ( !aPgRegion.empty() )
5586 : : {
5587 : 10955 : OutputDevice *pOut = _pViewShell->GetOut();
5588 [ + + ]: 10955 : if ( pOut->GetFillColor() != aGlobalRetoucheColor )
5589 [ + - ]: 10102 : pOut->SetFillColor( aGlobalRetoucheColor );
5590 [ + + ]: 32897 : for ( sal_uInt16 i = 0; i < aPgRegion.size(); ++i )
5591 : : {
5592 [ + + ]: 21942 : if ( 1 < aPgRegion.size() )
5593 : : {
5594 [ + - ]: 17916 : ::SwAlignRect( aPgRegion[i], pGlobalShell );
5595 [ + - ][ + + ]: 17916 : if( !aPgRegion[i].HasArea() )
5596 : 4170 : continue;
5597 : : }
5598 [ + - ][ + - ]: 17772 : pOut->DrawRect(aPgRegion[i].SVRect());
5599 : : }
5600 : 12168 : }
5601 : : }
5602 : : }
5603 : : }
5604 : :
5605 : : const sal_Int8 SwPageFrm::mnShadowPxWidth = 9;
5606 : :
5607 : 23338 : sal_Bool SwPageFrm::IsRightShadowNeeded() const
5608 : : {
5609 : 23338 : const ViewShell *pSh = getRootFrm()->GetCurrShell();
5610 : 23338 : const bool bIsLTR = getRootFrm()->IsLeftToRightViewLayout();
5611 : :
5612 : : // We paint the right shadow if we're not in book mode
5613 : : // or if we've no sibling or are the last page of the "row"
5614 : 23338 : return !pSh || (!pSh->GetViewOptions()->IsViewLayoutBookMode()) || !GetNext()
5615 : 0 : || (this == Lower()) || (bIsLTR && OnRightPage())
5616 [ # # # # ]: 46676 : || (!bIsLTR && !OnRightPage());
[ # # ][ # # ]
[ + - - +
# # # # ]
5617 : :
5618 : : }
5619 : :
5620 : 23338 : sal_Bool SwPageFrm::IsLeftShadowNeeded() const
5621 : : {
5622 : 23338 : const ViewShell *pSh = getRootFrm()->GetCurrShell();
5623 : 23338 : const bool bIsLTR = getRootFrm()->IsLeftToRightViewLayout();
5624 : :
5625 : : // We paint the left shadow if we're not in book mode
5626 : : // or if we've no sibling or are the last page of the "row"
5627 : 23338 : return !pSh || (!pSh->GetViewOptions()->IsViewLayoutBookMode()) || !GetPrev()
5628 : 0 : || (bIsLTR && !OnRightPage())
5629 [ # # # # ]: 46676 : || (!bIsLTR && OnRightPage());
[ # # ][ # # ]
[ + - - +
# # ]
5630 : : }
5631 : :
5632 : : /** determine rectangle for bottom page shadow
5633 : :
5634 : : OD 12.02.2003 for #i9719# and #105645#
5635 : :
5636 : : @author OD
5637 : : */
5638 : 35578 : /*static*/ void SwPageFrm::GetHorizontalShadowRect( const SwRect& _rPageRect,
5639 : : const ViewShell* _pViewShell,
5640 : : SwRect& _orHorizontalShadowRect,
5641 : : bool bPaintLeftShadow,
5642 : : bool bPaintRightShadow,
5643 : : bool bRightSidebar )
5644 : : {
5645 [ + - ][ + - ]: 35578 : const SwPostItMgr *pMgr = _pViewShell ? _pViewShell->GetPostItMgr() : 0;
5646 : 35578 : SwRect aAlignedPageRect( _rPageRect );
5647 [ + - ]: 35578 : ::SwAlignRect( aAlignedPageRect, _pViewShell );
5648 : : SwRect aPagePxRect =
5649 [ + - ][ + - ]: 35578 : _pViewShell->GetOut()->LogicToPixel( aAlignedPageRect.SVRect() );
[ + - ]
5650 : :
5651 : 35578 : long lShadowAdjustment = mnShadowPxWidth - 1; // TODO extract this
5652 : :
5653 : : _orHorizontalShadowRect.Chg(
5654 : 35578 : Point( aPagePxRect.Left() + (bPaintLeftShadow ? lShadowAdjustment : 0), 0 ),
5655 : 35578 : Size( aPagePxRect.Width() - ( (bPaintLeftShadow ? lShadowAdjustment : 0) + (bPaintRightShadow ? lShadowAdjustment : 0) ),
5656 [ + + ][ + + ]: 71156 : mnShadowPxWidth ) );
[ + + ]
5657 : :
5658 [ + - ][ + + ]: 35578 : if(pMgr && pMgr->ShowNotes() && pMgr->HasNotes())
[ + - ][ + + ]
[ + + ][ + + ]
5659 : : {
5660 : : // Notes are displayed, we've to extend borders
5661 [ + - ][ + - ]: 132 : SwTwips aSidebarTotalWidth = pMgr->GetSidebarWidth(true) + pMgr->GetSidebarBorderWidth(true);
5662 [ + - ]: 132 : if(bRightSidebar)
5663 : 132 : _orHorizontalShadowRect.Right( _orHorizontalShadowRect.Right() + aSidebarTotalWidth );
5664 : : else
5665 : 0 : _orHorizontalShadowRect.Left( _orHorizontalShadowRect.Left() - aSidebarTotalWidth );
5666 : : }
5667 : 35578 : }
5668 : :
5669 : : enum PaintArea {LEFT, RIGHT, TOP, BOTTOM};
5670 : :
5671 : : /// Wrapper around pOut->DrawBitmapEx.
5672 : 48960 : void lcl_paintBitmapExToRect(OutputDevice *pOut, Point aPoint, BitmapEx& rBitmapEx, PaintArea eArea)
5673 : : {
5674 : : // The problem is that if we get called multiple times and the color is
5675 : : // partly transparent, then the result will get darker and darker. To avoid
5676 : : // this, always paint the background color before doing the real paint.
5677 [ + - ]: 48960 : Rectangle aRect(aPoint, rBitmapEx.GetSizePixel());
5678 : :
5679 [ + + + + : 48960 : switch (eArea)
- ]
5680 : : {
5681 : 12240 : case LEFT: aRect.Left() = aRect.Right() - 1; break;
5682 : 12240 : case RIGHT: aRect.Right() = aRect.Left() + 1; break;
5683 : 12240 : case TOP: aRect.Top() = aRect.Bottom() - 1; break;
5684 : 12240 : case BOTTOM: aRect.Bottom() = aRect.Top() + 1; break;
5685 : : }
5686 : :
5687 [ + - ][ + - ]: 48960 : pOut->SetFillColor( SwViewOption::GetAppBackgroundColor());
5688 [ + - ]: 48960 : pOut->SetLineColor();
5689 [ + - ][ + - ]: 48960 : pOut->DrawRect(pOut->PixelToLogic(aRect));
5690 : :
5691 [ + - ][ + - ]: 48960 : pOut->DrawBitmapEx(pOut->PixelToLogic(aPoint), rBitmapEx);
5692 : 48960 : }
5693 : :
5694 : : /** paint page border and shadow
5695 : :
5696 : : OD 12.02.2003 for #i9719# and #105645#
5697 : : implement paint of page border and shadow
5698 : :
5699 : : @author OD
5700 : : */
5701 : 12240 : /*static*/ void SwPageFrm::PaintBorderAndShadow( const SwRect& _rPageRect,
5702 : : const ViewShell* _pViewShell,
5703 : : bool bPaintLeftShadow,
5704 : : bool bPaintRightShadow,
5705 : : bool bRightSidebar )
5706 : : {
5707 : : // No shadow in prefs
5708 [ + - ][ + - ]: 24480 : if( !SwViewOption::IsShadow() ) return;
5709 : :
5710 : : // #i16816# tagged pdf support
5711 [ + - ]: 12240 : SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, *_pViewShell->GetOut() );
5712 : :
5713 : : static vcl::DeleteOnDeinit< drawinglayer::primitive2d::DiscreteShadow > shadowMaskObj
5714 [ + + ][ + - ]: 12240 : ( new drawinglayer::primitive2d::DiscreteShadow( SW_RES( BMP_PAGE_SHADOW_MASK ) ));
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ # # ]
5715 [ + + ][ + - ]: 12240 : static drawinglayer::primitive2d::DiscreteShadow& shadowMask = *shadowMaskObj.get();
5716 [ + + ][ + - ]: 12240 : static vcl::DeleteOnDeinit< BitmapEx > aPageTopRightShadowObj( new BitmapEx );
[ + - ][ + - ]
[ + - ][ # # ]
5717 [ + + ][ + - ]: 12240 : static vcl::DeleteOnDeinit< BitmapEx > aPageBottomRightShadowObj( new BitmapEx );
[ + - ][ + - ]
[ + - ][ # # ]
5718 [ + + ][ + - ]: 12240 : static vcl::DeleteOnDeinit< BitmapEx > aPageBottomLeftShadowObj( new BitmapEx );
[ + - ][ + - ]
[ + - ][ # # ]
5719 [ + + ][ + - ]: 12240 : static vcl::DeleteOnDeinit< BitmapEx > aPageBottomShadowBaseObj( new BitmapEx );
[ + - ][ + - ]
[ + - ][ # # ]
5720 [ + + ][ + - ]: 12240 : static vcl::DeleteOnDeinit< BitmapEx > aPageRightShadowBaseObj( new BitmapEx );
[ + - ][ + - ]
[ + - ][ # # ]
5721 [ + + ][ + - ]: 12240 : static vcl::DeleteOnDeinit< BitmapEx > aPageTopShadowBaseObj( new BitmapEx );
[ + - ][ + - ]
[ + - ][ # # ]
5722 [ + + ][ + - ]: 12240 : static vcl::DeleteOnDeinit< BitmapEx > aPageTopLeftShadowObj( new BitmapEx );
[ + - ][ + - ]
[ + - ][ # # ]
5723 [ + + ][ + - ]: 12240 : static vcl::DeleteOnDeinit< BitmapEx > aPageLeftShadowBaseObj( new BitmapEx );
[ + - ][ + - ]
[ + - ][ # # ]
5724 [ + + ][ + - ]: 12240 : static BitmapEx& aPageTopRightShadow = *aPageTopRightShadowObj.get();
5725 [ + + ][ + - ]: 12240 : static BitmapEx& aPageBottomRightShadow = *aPageBottomRightShadowObj.get();
5726 [ + + ][ + - ]: 12240 : static BitmapEx& aPageBottomLeftShadow = *aPageBottomLeftShadowObj.get();
5727 [ + + ][ + - ]: 12240 : static BitmapEx& aPageBottomShadowBase = *aPageBottomShadowBaseObj.get();
5728 [ + + ][ + - ]: 12240 : static BitmapEx& aPageRightShadowBase = *aPageRightShadowBaseObj.get();
5729 [ + + ][ + - ]: 12240 : static BitmapEx& aPageTopShadowBase = *aPageTopShadowBaseObj.get();
5730 [ + + ][ + - ]: 12240 : static BitmapEx& aPageTopLeftShadow = *aPageTopLeftShadowObj.get();
5731 [ + + ][ + - ]: 12240 : static BitmapEx& aPageLeftShadowBase = *aPageLeftShadowBaseObj.get();
5732 [ + + ][ + - ]: 12240 : static Color aShadowColor( COL_AUTO );
5733 : :
5734 : 12240 : SwRect aAlignedPageRect( _rPageRect );
5735 [ + - ]: 12240 : ::SwAlignRect( aAlignedPageRect, _pViewShell );
5736 : : SwRect aPagePxRect =
5737 [ + - ][ + - ]: 12240 : _pViewShell->GetOut()->LogicToPixel( aAlignedPageRect.SVRect() );
[ + - ]
5738 : :
5739 : :
5740 [ + - ][ + + ]: 12240 : if(aShadowColor != SwViewOption::GetShadowColor() ) {
5741 [ + - ]: 56 : aShadowColor = SwViewOption::GetShadowColor();
5742 : :
5743 [ + - ][ + - ]: 56 : AlphaMask aMask( shadowMask.getBottomRight().GetBitmap() );
[ + - ][ + - ]
5744 [ + - ][ + - ]: 56 : Bitmap aFilledSquare( aMask.GetSizePixel(), 24 );
5745 [ + - ]: 56 : aFilledSquare.Erase( aShadowColor );
5746 [ + - ][ + - ]: 56 : aPageBottomRightShadow = BitmapEx( aFilledSquare, aMask );
[ + - ]
5747 : :
5748 [ + - ][ + - ]: 56 : aMask = AlphaMask( shadowMask.getBottomLeft().GetBitmap() );
[ + - ][ + - ]
[ + - ][ + - ]
5749 [ + - ][ + - ]: 56 : aFilledSquare = Bitmap( aMask.GetSizePixel(), 24 );
[ + - ][ + - ]
5750 [ + - ]: 56 : aFilledSquare.Erase( aShadowColor );
5751 [ + - ][ + - ]: 56 : aPageBottomLeftShadow = BitmapEx( aFilledSquare, aMask );
[ + - ]
5752 : :
5753 [ + - ][ + - ]: 56 : aMask = AlphaMask( shadowMask.getBottom().GetBitmap() );
[ + - ][ + - ]
[ + - ][ + - ]
5754 [ + - ][ + - ]: 56 : aFilledSquare = Bitmap( aMask.GetSizePixel(), 24 );
[ + - ][ + - ]
5755 [ + - ]: 56 : aFilledSquare.Erase( aShadowColor );
5756 [ + - ][ + - ]: 56 : aPageBottomShadowBase = BitmapEx( aFilledSquare, aMask );
[ + - ]
5757 : :
5758 [ + - ][ + - ]: 56 : aMask = AlphaMask( shadowMask.getTop().GetBitmap() );
[ + - ][ + - ]
[ + - ][ + - ]
5759 [ + - ][ + - ]: 56 : aFilledSquare = Bitmap( aMask.GetSizePixel(), 24 );
[ + - ][ + - ]
5760 [ + - ]: 56 : aFilledSquare.Erase( aShadowColor );
5761 [ + - ][ + - ]: 56 : aPageTopShadowBase = BitmapEx( aFilledSquare, aMask );
[ + - ]
5762 : :
5763 [ + - ][ + - ]: 56 : aMask = AlphaMask( shadowMask.getTopRight().GetBitmap() );
[ + - ][ + - ]
[ + - ][ + - ]
5764 [ + - ][ + - ]: 56 : aFilledSquare = Bitmap( aMask.GetSizePixel(), 24 );
[ + - ][ + - ]
5765 [ + - ]: 56 : aFilledSquare.Erase( aShadowColor );
5766 [ + - ][ + - ]: 56 : aPageTopRightShadow = BitmapEx( aFilledSquare, aMask );
[ + - ]
5767 : :
5768 [ + - ][ + - ]: 56 : aMask = AlphaMask( shadowMask.getRight().GetBitmap() );
[ + - ][ + - ]
[ + - ][ + - ]
5769 [ + - ][ + - ]: 56 : aFilledSquare = Bitmap( aMask.GetSizePixel(), 24 );
[ + - ][ + - ]
5770 [ + - ]: 56 : aFilledSquare.Erase( aShadowColor );
5771 [ + - ][ + - ]: 56 : aPageRightShadowBase = BitmapEx( aFilledSquare, aMask );
[ + - ]
5772 : :
5773 [ + - ][ + - ]: 56 : aMask = AlphaMask( shadowMask.getTopLeft().GetBitmap() );
[ + - ][ + - ]
[ + - ][ + - ]
5774 [ + - ][ + - ]: 56 : aFilledSquare = Bitmap( aMask.GetSizePixel(), 24 );
[ + - ][ + - ]
5775 [ + - ]: 56 : aFilledSquare.Erase( aShadowColor );
5776 [ + - ][ + - ]: 56 : aPageTopLeftShadow = BitmapEx( aFilledSquare, aMask );
[ + - ]
5777 : :
5778 [ + - ][ + - ]: 56 : aMask = AlphaMask( shadowMask.getLeft().GetBitmap() );
[ + - ][ + - ]
[ + - ][ + - ]
5779 [ + - ][ + - ]: 56 : aFilledSquare = Bitmap( aMask.GetSizePixel(), 24 );
[ + - ][ + - ]
5780 [ + - ]: 56 : aFilledSquare.Erase( aShadowColor );
5781 [ + - ][ + - ]: 56 : aPageLeftShadowBase = BitmapEx( aFilledSquare, aMask );
[ + - ][ + - ]
[ + - ]
5782 : : }
5783 : :
5784 : 12240 : SwRect aPaintRect;
5785 : 12240 : OutputDevice *pOut = _pViewShell->GetOut();
5786 : :
5787 [ + - ]: 12240 : SwPageFrm::GetHorizontalShadowRect( _rPageRect, _pViewShell, aPaintRect, bPaintLeftShadow, bPaintRightShadow, bRightSidebar );
5788 : :
5789 : : // Right shadow & corners
5790 [ + - ]: 12240 : if ( bPaintRightShadow )
5791 : : {
5792 : 12240 : pOut->DrawBitmapEx( pOut->PixelToLogic( Point( aPaintRect.Right() + 1, aPagePxRect.Bottom() + 1 - (aPageBottomRightShadow.GetSizePixel().Height() - mnShadowPxWidth) ) ),
5793 [ + - ][ + - ]: 12240 : aPageBottomRightShadow );
5794 : 12240 : pOut->DrawBitmapEx( pOut->PixelToLogic( Point( aPaintRect.Right() + 1, aPagePxRect.Top() - mnShadowPxWidth ) ),
5795 [ + - ][ + - ]: 12240 : aPageTopRightShadow );
5796 [ + - ]: 12240 : BitmapEx aPageRightShadow = aPageRightShadowBase;
5797 [ + - ]: 12240 : aPageRightShadow.Scale( 1, aPagePxRect.Height() - 2 * (mnShadowPxWidth - 1) );
5798 [ + - ][ + - ]: 12240 : lcl_paintBitmapExToRect(pOut, Point( aPaintRect.Right() + mnShadowPxWidth, aPagePxRect.Top() + mnShadowPxWidth - 1), aPageRightShadow, RIGHT );
5799 : : }
5800 : :
5801 : : // Left shadows and corners
5802 [ + - ]: 12240 : if(bPaintLeftShadow)
5803 : : {
5804 : 12240 : const long lLeft = aPaintRect.Left() - aPageBottomLeftShadow.GetSizePixel().Width();
5805 : : pOut->DrawBitmapEx( pOut->PixelToLogic( Point( lLeft,
5806 [ + - ][ + - ]: 12240 : aPagePxRect.Bottom() + 1 + mnShadowPxWidth - aPageBottomLeftShadow.GetSizePixel().Height() ) ), aPageBottomLeftShadow );
5807 [ + - ][ + - ]: 12240 : pOut->DrawBitmapEx( pOut->PixelToLogic( Point( lLeft, aPagePxRect.Top() - mnShadowPxWidth ) ), aPageTopLeftShadow );
5808 [ + - ]: 12240 : BitmapEx aPageLeftShadow = aPageLeftShadowBase;
5809 [ + - ]: 12240 : aPageLeftShadow.Scale( 1, aPagePxRect.Height() - 2 * (mnShadowPxWidth - 1) );
5810 [ + - ][ + - ]: 12240 : lcl_paintBitmapExToRect(pOut, Point( lLeft, aPagePxRect.Top() + mnShadowPxWidth - 1), aPageLeftShadow, LEFT);
5811 : : }
5812 : :
5813 [ + - ]: 12240 : BitmapEx aPageBottomShadow = aPageBottomShadowBase;
5814 [ + - ]: 12240 : aPageBottomShadow.Scale( aPaintRect.Width(), 1 );
5815 [ + - ]: 12240 : lcl_paintBitmapExToRect(pOut, Point( aPaintRect.Left(), aPagePxRect.Bottom() + 1 ), aPageBottomShadow, BOTTOM);
5816 [ + - ]: 12240 : BitmapEx aPageTopShadow = aPageTopShadowBase;
5817 [ + - ]: 12240 : aPageTopShadow.Scale( aPaintRect.Width(), 1 );
5818 [ + - ][ + - ]: 12240 : lcl_paintBitmapExToRect(pOut, Point( aPaintRect.Left(), aPagePxRect.Top() - mnShadowPxWidth ), aPageTopShadow, TOP);
[ + - ][ + - ]
5819 : : }
5820 : :
5821 : : //mod #i6193# paint sidebar for notes
5822 : : //IMPORTANT: if you change the rects here, also change SwPostItMgr::ScrollbarHit
5823 : 12240 : /*static*/void SwPageFrm::PaintNotesSidebar(const SwRect& _rPageRect, ViewShell* _pViewShell, sal_uInt16 nPageNum, bool bRight)
5824 : : {
5825 : : //TOOD: cut out scrollbar area and arrows out of sidepane rect, otherwise it could flicker when pressing arrow buttons
5826 [ + - ]: 12240 : if (!_pViewShell )
5827 : 12240 : return;
5828 : :
5829 : 12240 : SwRect aPageRect( _rPageRect );
5830 [ + - ]: 12240 : SwAlignRect( aPageRect, _pViewShell );
5831 : :
5832 [ + - ]: 12240 : const SwPostItMgr *pMgr = _pViewShell->GetPostItMgr();
5833 [ + - ][ + - ]: 12240 : if (pMgr && pMgr->ShowNotes() && pMgr->HasNotes()) // do not show anything in print preview
[ + + ][ + - ]
[ + + ][ + + ]
5834 : : {
5835 [ + - ]: 3 : sal_Int32 nScrollerHeight = pMgr->GetSidebarScrollerHeight();
5836 [ + - ]: 3 : const Rectangle &aVisRect = _pViewShell->VisArea().SVRect();
5837 : : //draw border and sidepane
5838 [ + - ]: 3 : _pViewShell->GetOut()->SetLineColor();
5839 [ - + ]: 3 : if (!bRight)
5840 : : {
5841 [ # # ]: 0 : _pViewShell->GetOut()->SetFillColor(COL_NOTES_SIDEPANE_BORDER);
5842 [ # # ][ # # ]: 0 : _pViewShell->GetOut()->DrawRect(Rectangle(Point(aPageRect.Left()-pMgr->GetSidebarBorderWidth(),aPageRect.Top()),Size(pMgr->GetSidebarBorderWidth(),aPageRect.Height()))) ;
[ # # ][ # # ]
5843 [ # # ][ # # ]: 0 : if (Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
5844 [ # # ]: 0 : _pViewShell->GetOut()->SetFillColor(COL_BLACK);
5845 : : else
5846 [ # # ]: 0 : _pViewShell->GetOut()->SetFillColor(COL_NOTES_SIDEPANE);
5847 [ # # ][ # # ]: 0 : _pViewShell->GetOut()->DrawRect(Rectangle(Point(aPageRect.Left()-pMgr->GetSidebarWidth()-pMgr->GetSidebarBorderWidth(),aPageRect.Top()),Size(pMgr->GetSidebarWidth(),aPageRect.Height()))) ;
[ # # ][ # # ]
[ # # ]
5848 : : }
5849 : : else
5850 : : {
5851 [ + - ]: 3 : _pViewShell->GetOut()->SetFillColor(COL_NOTES_SIDEPANE_BORDER);
5852 [ + - ][ + - ]: 3 : SwRect aSidebarBorder(aPageRect.TopRight(),Size(pMgr->GetSidebarBorderWidth(),aPageRect.Height()));
5853 [ + - ][ + - ]: 3 : _pViewShell->GetOut()->DrawRect(aSidebarBorder.SVRect());
5854 [ + - ][ - + ]: 3 : if (Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
5855 [ # # ]: 0 : _pViewShell->GetOut()->SetFillColor(COL_BLACK);
5856 : : else
5857 [ + - ]: 3 : _pViewShell->GetOut()->SetFillColor(COL_NOTES_SIDEPANE);
5858 [ + - ][ + - ]: 3 : SwRect aSidebar(Point(aPageRect.Right()+pMgr->GetSidebarBorderWidth(),aPageRect.Top()),Size(pMgr->GetSidebarWidth(),aPageRect.Height()));
5859 [ + - ][ + - ]: 3 : _pViewShell->GetOut()->DrawRect(aSidebar.SVRect());
5860 : : }
5861 [ + - ][ - + ]: 3 : if (pMgr->ShowScrollbar(nPageNum))
5862 : : {
5863 : : // draw scrollbar area and arrows
5864 : 0 : Point aPointBottom;
5865 : 0 : Point aPointTop;
5866 [ # # ][ # # ]: 0 : aPointBottom = !bRight ? Point(aPageRect.Left() - pMgr->GetSidebarWidth() - pMgr->GetSidebarBorderWidth() + _pViewShell->GetOut()->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- _pViewShell->GetOut()->PixelToLogic(Size(0,2+pMgr->GetSidebarScrollerHeight())).Height()) :
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # #
# # # # #
# ]
5867 [ # # ][ # # ]: 0 : Point(aPageRect.Right() + pMgr->GetSidebarBorderWidth() + _pViewShell->GetOut()->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- _pViewShell->GetOut()->PixelToLogic(Size(0,2+pMgr->GetSidebarScrollerHeight())).Height());
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # # #
# # # # #
# # # ]
[ # # ]
5868 [ # # ][ # # ]: 0 : aPointTop = !bRight ? Point(aPageRect.Left() - pMgr->GetSidebarWidth() + _pViewShell->GetOut()->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + _pViewShell->GetOut()->PixelToLogic(Size(0,2)).Height()) :
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # #
# # # # #
# ]
5869 [ # # ][ # # ]: 0 : Point(aPageRect.Right() + pMgr->GetSidebarBorderWidth() + _pViewShell->GetOut()->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + _pViewShell->GetOut()->PixelToLogic(Size(0,2)).Height());
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # # #
# # # # #
# # # ]
5870 [ # # ][ # # ]: 0 : Size aSize(pMgr->GetSidebarWidth() - _pViewShell->GetOut()->PixelToLogic(Size(4,0)).Width(), _pViewShell->GetOut()->PixelToLogic(Size(0,nScrollerHeight)).Height()) ;
[ # # ]
5871 [ # # ]: 0 : Rectangle aRectBottom(aPointBottom,aSize);
5872 [ # # ]: 0 : Rectangle aRectTop(aPointTop,aSize);
5873 : :
5874 [ # # ][ # # ]: 0 : if (aRectBottom.IsOver(aVisRect))
5875 : : {
5876 : :
5877 [ # # ][ # # ]: 0 : if (Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
5878 : : {
5879 [ # # ]: 0 : _pViewShell->GetOut()->SetLineColor(COL_WHITE);
5880 [ # # ]: 0 : _pViewShell->GetOut()->SetFillColor(COL_BLACK);
5881 : : }
5882 : : else
5883 : : {
5884 [ # # ]: 0 : _pViewShell->GetOut()->SetLineColor(COL_BLACK);
5885 [ # # ]: 0 : _pViewShell->GetOut()->SetFillColor(COL_NOTES_SIDEPANE_SCROLLAREA);
5886 : : }
5887 [ # # ]: 0 : _pViewShell->GetOut()->DrawRect(aRectBottom);
5888 [ # # ][ # # ]: 0 : _pViewShell->GetOut()->DrawLine(aPointBottom + Point(pMgr->GetSidebarWidth()/3,0), aPointBottom + Point(pMgr->GetSidebarWidth()/3 , _pViewShell->GetOut()->PixelToLogic(Size(0,nScrollerHeight)).Height()));
[ # # ][ # # ]
5889 : :
5890 [ # # ]: 0 : _pViewShell->GetOut()->SetLineColor();
5891 [ # # ][ # # ]: 0 : Point aMiddleFirst(aPointBottom + Point(pMgr->GetSidebarWidth()/6,_pViewShell->GetOut()->PixelToLogic(Size(0,nScrollerHeight)).Height()/2));
5892 [ # # ][ # # ]: 0 : Point aMiddleSecond(aPointBottom + Point(pMgr->GetSidebarWidth()/3*2,_pViewShell->GetOut()->PixelToLogic(Size(0,nScrollerHeight)).Height()/2));
5893 [ # # ][ # # ]: 0 : PaintNotesSidebarArrows(aMiddleFirst,aMiddleSecond,_pViewShell,pMgr->GetArrowColor(KEY_PAGEUP,nPageNum), pMgr->GetArrowColor(KEY_PAGEDOWN,nPageNum));
[ # # ]
5894 : : }
5895 [ # # ][ # # ]: 0 : if (aRectTop.IsOver(aVisRect))
5896 : : {
5897 [ # # ][ # # ]: 0 : if (Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
5898 : : {
5899 [ # # ]: 0 : _pViewShell->GetOut()->SetLineColor(COL_WHITE);
5900 [ # # ]: 0 : _pViewShell->GetOut()->SetFillColor(COL_BLACK);
5901 : : }
5902 : : else
5903 : : {
5904 [ # # ]: 0 : _pViewShell->GetOut()->SetLineColor(COL_BLACK);
5905 [ # # ]: 0 : _pViewShell->GetOut()->SetFillColor(COL_NOTES_SIDEPANE_SCROLLAREA);
5906 : : }
5907 [ # # ]: 0 : _pViewShell->GetOut()->DrawRect(aRectTop);
5908 [ # # ][ # # ]: 0 : _pViewShell->GetOut()->DrawLine(aPointTop + Point(pMgr->GetSidebarWidth()/3*2,0), aPointTop + Point(pMgr->GetSidebarWidth()/3*2 , _pViewShell->GetOut()->PixelToLogic(Size(0,nScrollerHeight)).Height()));
[ # # ][ # # ]
5909 : :
5910 [ # # ]: 0 : _pViewShell->GetOut()->SetLineColor();
5911 [ # # ][ # # ]: 0 : Point aMiddleFirst(aPointTop + Point(pMgr->GetSidebarWidth()/3,_pViewShell->GetOut()->PixelToLogic(Size(0,nScrollerHeight)).Height()/2));
5912 [ # # ][ # # ]: 0 : Point aMiddleSecond(aPointTop + Point(pMgr->GetSidebarWidth()/6*5,_pViewShell->GetOut()->PixelToLogic(Size(0,nScrollerHeight)).Height()/2));
5913 [ # # ][ # # ]: 12240 : PaintNotesSidebarArrows(aMiddleFirst,aMiddleSecond,_pViewShell, pMgr->GetArrowColor(KEY_PAGEUP,nPageNum), pMgr->GetArrowColor(KEY_PAGEDOWN,nPageNum));
[ # # ]
5914 : : }
5915 : : }
5916 : : }
5917 : : }
5918 : :
5919 : 0 : /*static*/ void SwPageFrm::PaintNotesSidebarArrows(const Point &aMiddleFirst, const Point &aMiddleSecond, ViewShell* _pViewShell, const Color aColorUp, const Color aColorDown)
5920 : : {
5921 [ # # ]: 0 : Polygon aTriangleUp(3);
5922 [ # # ]: 0 : Polygon aTriangleDown(3);
5923 : :
5924 [ # # ][ # # ]: 0 : aTriangleUp.SetPoint(aMiddleFirst + Point(0,_pViewShell->GetOut()->PixelToLogic(Size(0,-3)).Height()),0);
5925 [ # # ][ # # ]: 0 : aTriangleUp.SetPoint(aMiddleFirst + Point(_pViewShell->GetOut()->PixelToLogic(Size(-3,0)).Width(),_pViewShell->GetOut()->PixelToLogic(Size(0,3)).Height()),1);
[ # # ]
5926 [ # # ][ # # ]: 0 : aTriangleUp.SetPoint(aMiddleFirst + Point(_pViewShell->GetOut()->PixelToLogic(Size(3,0)).Width(),_pViewShell->GetOut()->PixelToLogic(Size(0,3)).Height()),2);
[ # # ]
5927 : :
5928 [ # # ][ # # ]: 0 : aTriangleDown.SetPoint(aMiddleSecond + Point(_pViewShell->GetOut()->PixelToLogic(Size(-3,0)).Width(),_pViewShell->GetOut()->PixelToLogic(Size(0,-3)).Height()),0);
[ # # ]
5929 [ # # ][ # # ]: 0 : aTriangleDown.SetPoint(aMiddleSecond + Point(_pViewShell->GetOut()->PixelToLogic(Size(+3,0)).Width(),_pViewShell->GetOut()->PixelToLogic(Size(0,-3)).Height()),1);
[ # # ]
5930 [ # # ][ # # ]: 0 : aTriangleDown.SetPoint(aMiddleSecond + Point(0,_pViewShell->GetOut()->PixelToLogic(Size(0,3)).Height()),2);
5931 : :
5932 [ # # ]: 0 : _pViewShell->GetOut()->SetFillColor(aColorUp);
5933 [ # # ]: 0 : _pViewShell->GetOut()->DrawPolygon(aTriangleUp);
5934 [ # # ]: 0 : _pViewShell->GetOut()->SetFillColor(aColorDown);
5935 [ # # ][ # # ]: 0 : _pViewShell->GetOut()->DrawPolygon(aTriangleDown);
[ # # ]
5936 : 0 : }
5937 : :
5938 : : /** get bound rectangle of border and shadow for repaints
5939 : :
5940 : : OD 12.02.2003 for #i9719# and #105645#
5941 : :
5942 : : author OD
5943 : : */
5944 : 23338 : /*static*/ void SwPageFrm::GetBorderAndShadowBoundRect( const SwRect& _rPageRect,
5945 : : const ViewShell* _pViewShell,
5946 : : SwRect& _orBorderAndShadowBoundRect,
5947 : : bool bLeftShadow,
5948 : : bool bRightShadow,
5949 : : bool bRightSidebar
5950 : : )
5951 : : {
5952 : 23338 : SwRect aAlignedPageRect( _rPageRect );
5953 [ + - ]: 23338 : ::SwAlignRect( aAlignedPageRect, _pViewShell );
5954 : : SwRect aPagePxRect =
5955 [ + - ][ + - ]: 23338 : _pViewShell->GetOut()->LogicToPixel( aAlignedPageRect.SVRect() );
[ + - ]
5956 : 23338 : aPagePxRect.Bottom( aPagePxRect.Bottom() + mnShadowPxWidth + 1 );
5957 : 23338 : aPagePxRect.Top( aPagePxRect.Top() - mnShadowPxWidth - 1 );
5958 : :
5959 : 23338 : SwRect aTmpRect;
5960 : :
5961 : : // Always ask for full shadow since we want a bounding rect
5962 : : // including at least the page frame
5963 [ + - ]: 23338 : SwPageFrm::GetHorizontalShadowRect( _rPageRect, _pViewShell, aTmpRect, false, false, bRightSidebar );
5964 : :
5965 [ + - ]: 23338 : if(bLeftShadow) aPagePxRect.Left( aTmpRect.Left() - mnShadowPxWidth - 1);
5966 [ + - ]: 23338 : if(bRightShadow) aPagePxRect.Right( aTmpRect.Right() + mnShadowPxWidth + 1);
5967 : :
5968 [ + - ][ + - ]: 23338 : _orBorderAndShadowBoundRect = _pViewShell->GetOut()->PixelToLogic( aPagePxRect.SVRect() );
[ + - ]
5969 : 23338 : }
5970 : :
5971 : 9870 : SwRect SwPageFrm::GetBoundRect() const
5972 : : {
5973 : 9870 : const ViewShell *pSh = getRootFrm()->GetCurrShell();
5974 : 9870 : SwRect aPageRect( Frm() );
5975 : 9870 : SwRect aResult;
5976 : :
5977 [ - + ]: 9870 : if(!pSh) {
5978 : 0 : return SwRect( Point(0, 0), Size(0, 0) );
5979 : : }
5980 : :
5981 : : SwPageFrm::GetBorderAndShadowBoundRect( aPageRect, pSh, aResult,
5982 [ + - ][ + - ]: 9870 : IsLeftShadowNeeded(), IsRightShadowNeeded(), SidebarPosition() == sw::sidebarwindows::SIDEBAR_RIGHT );
[ + - ][ + - ]
5983 : 9870 : return aResult;
5984 : : }
5985 : :
5986 : 3574 : /*static*/ SwTwips SwPageFrm::GetSidebarBorderWidth( const ViewShell* _pViewShell )
5987 : : {
5988 [ + + ]: 3574 : const SwPostItMgr* pPostItMgr = _pViewShell ? _pViewShell->GetPostItMgr() : 0;
5989 [ + + ][ + + ]: 3574 : const SwTwips nRet = pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() ? pPostItMgr->GetSidebarWidth() + pPostItMgr->GetSidebarBorderWidth() : 0;
[ + - ]
5990 : 3574 : return nRet;
5991 : : }
5992 : :
5993 : : /*************************************************************************
5994 : : |*
5995 : : |* SwFrm::PaintBaBo()
5996 : : |*
5997 : : |*************************************************************************/
5998 : :
5999 : 12378 : void SwFrm::PaintBaBo( const SwRect& rRect, const SwPageFrm *pPage,
6000 : : const sal_Bool bLowerBorder ) const
6001 : : {
6002 [ - + ]: 12378 : if ( !pPage )
6003 [ # # ]: 0 : pPage = FindPageFrm();
6004 : :
6005 : 12378 : OutputDevice *pOut = pGlobalShell->GetOut();
6006 : :
6007 : : // #i16816# tagged pdf support
6008 [ + - ]: 12378 : SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, *pOut );
6009 : :
6010 : : // OD 2004-04-23 #116347#
6011 [ + - ]: 12378 : pOut->Push( PUSH_FILLCOLOR|PUSH_LINECOLOR );
6012 [ + - ]: 12378 : pOut->SetLineColor();
6013 : :
6014 [ + - ]: 12378 : SwBorderAttrAccess aAccess( SwFrm::GetCache(), (SwFrm*)this );
6015 [ + - ]: 12378 : const SwBorderAttrs &rAttrs = *aAccess.Get();
6016 : :
6017 : : // OD 20.11.2002 #104598# - take care of page margin area
6018 : : // Note: code move from <SwFrm::PaintBackground(..)> to new method
6019 : : // <SwPageFrm::Paintmargin(..)>.
6020 [ + + ]: 12378 : if ( IsPageFrm() )
6021 : : {
6022 [ + - ]: 12259 : static_cast<const SwPageFrm*>(this)->PaintMarginArea( rRect, pGlobalShell );
6023 : : }
6024 : :
6025 : : // paint background
6026 : : {
6027 [ + - ]: 12378 : PaintBackground( rRect, pPage, rAttrs, sal_False, bLowerBorder );
6028 : : }
6029 : :
6030 : : // OD 06.08.2002 #99657# - paint border before painting background
6031 : : // paint grid for page frame and paint border
6032 : : {
6033 : 12378 : SwRect aRect( rRect );
6034 [ + + ]: 12378 : if( IsPageFrm() )
6035 [ + - ]: 12259 : ((SwPageFrm*)this)->PaintGrid( pOut, aRect );
6036 [ + - ]: 12378 : PaintBorder( aRect, pPage, rAttrs );
6037 : : }
6038 : :
6039 [ + - ][ + - ]: 12378 : pOut->Pop();
[ + - ]
6040 : 12378 : }
6041 : :
6042 : : /*************************************************************************
6043 : : |*
6044 : : |* SwFrm::PaintBackground()
6045 : : |*
6046 : : |*************************************************************************/
6047 : : /// OD 05.09.2002 #102912#
6048 : : /// Do not paint background for fly frames without a background brush by
6049 : : /// calling <PaintBaBo> at the page or at the fly frame its anchored
6050 : 53865 : void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage,
6051 : : const SwBorderAttrs & rAttrs,
6052 : : const sal_Bool bLowerMode,
6053 : : const sal_Bool bLowerBorder ) const
6054 : : {
6055 : : // OD 20.01.2003 #i1837# - no paint of table background, if corresponding
6056 : : // option is *not* set.
6057 [ + + - + ]: 54536 : if( IsTabFrm() &&
[ + - ]
6058 : 671 : !pGlobalShell->GetViewOptions()->IsTable() )
6059 : : {
6060 : : return;
6061 : : }
6062 : :
6063 : : // nothing to do for covered table cells:
6064 [ + + ][ + - ]: 53865 : if( IsCellFrm() && IsCoveredCell() )
[ - + ][ + - ]
6065 : : return;
6066 : :
6067 : 53865 : ViewShell *pSh = pGlobalShell;
6068 : :
6069 : : // #i16816# tagged pdf support
6070 [ + - ]: 53865 : SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, *pSh->GetOut() );
6071 : :
6072 : : const SvxBrushItem* pItem;
6073 : : /// OD 05.09.2002 #102912#
6074 : : /// temporary background brush for a fly frame without a background brush
6075 : 53865 : SvxBrushItem* pTmpBackBrush = 0;
6076 : : const Color* pCol;
6077 : 53865 : SwRect aOrigBackRect;
6078 : 53865 : const sal_Bool bPageFrm = IsPageFrm();
6079 : 53865 : sal_Bool bLowMode = sal_True;
6080 : :
6081 [ + - ]: 53865 : sal_Bool bBack = GetBackgroundBrush( pItem, pCol, aOrigBackRect, bLowerMode );
6082 : : //- Output if a separate background is used.
6083 [ + - ][ + + ]: 53865 : bool bNoFlyBackground = !bFlyMetafile && !bBack && IsFlyFrm();
[ + + ]
6084 [ + + ]: 53865 : if ( bNoFlyBackground )
6085 : : {
6086 : : // OD 05.09.2002 #102912# - Fly frame has no background.
6087 : : // Try to find background brush at parents, if previous call of
6088 : : // <GetBackgroundBrush> disabled this option with the parameter <bLowerMode>
6089 [ - + ]: 271 : if ( bLowerMode )
6090 : : {
6091 [ # # ]: 0 : bBack = GetBackgroundBrush( pItem, pCol, aOrigBackRect, false );
6092 : : }
6093 : : // If still no background found for the fly frame, initialize the
6094 : : // background brush <pItem> with global retouche color and set <bBack>
6095 : : // to sal_True, that fly frame will paint its background using this color.
6096 [ + - ]: 271 : if ( !bBack )
6097 : : {
6098 : : // OD 10.01.2003 #i6467# - on print output, pdf output and
6099 : : // in embedded mode not editing color COL_WHITE is used instead of
6100 : : // the global retouche color.
6101 [ + - + - : 813 : if ( pSh->GetOut()->GetOutDevType() == OUTDEV_PRINTER ||
- + ][ # # ]
[ - + ]
6102 : 271 : pSh->GetViewOptions()->IsPDFExport() ||
6103 : 271 : ( pSh->GetDoc()->GetDocShell()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED &&
6104 [ # # ]: 0 : !pSh->GetDoc()->GetDocShell()->IsInPlaceActive()
6105 : : )
6106 : : )
6107 : : {
6108 [ # # ][ # # ]: 0 : pTmpBackBrush = new SvxBrushItem( Color( COL_WHITE ), RES_BACKGROUND );
6109 : : }
6110 : : else
6111 : : {
6112 [ + - ][ + - ]: 271 : pTmpBackBrush = new SvxBrushItem( aGlobalRetoucheColor, RES_BACKGROUND);
6113 : : }
6114 : 271 : pItem = pTmpBackBrush;
6115 : 271 : bBack = true;
6116 : : }
6117 : : }
6118 : :
6119 : 53865 : SwRect aPaintRect( Frm() );
6120 [ + + ][ + + ]: 53865 : if( IsTxtFrm() || IsSctFrm() )
[ + + ]
6121 [ + - ]: 20428 : aPaintRect = UnionFrm( sal_True );
6122 : :
6123 [ + - ][ + + ]: 53865 : if ( aPaintRect.IsOver( rRect ) )
6124 : : {
6125 [ + + ][ + + ]: 52166 : if ( bBack || bPageFrm || !bLowerMode )
[ + + ]
6126 : : {
6127 : 12698 : const sal_Bool bBrowse = pSh->GetViewOptions()->getBrowseMode();
6128 : 12698 : SwRect aRect;
6129 [ + + + + : 25330 : if ( (bPageFrm && bBrowse) ||
+ + ][ + + ]
[ + + ]
6130 : 12632 : (IsTxtFrm() && Prt().SSize() == Frm().SSize()) )
6131 : : {
6132 : 75 : aRect = Frm();
6133 [ + - ]: 75 : ::SwAlignRect( aRect, pGlobalShell );
6134 : : }
6135 : : else
6136 : : {
6137 [ + - ]: 12623 : ::lcl_CalcBorderRect( aRect, this, rAttrs, sal_False );
6138 [ + + ][ + + ]: 12623 : if ( (IsTxtFrm() || IsTabFrm()) && GetPrev() )
[ + + ][ + + ]
6139 : : {
6140 [ + - ][ + - ]: 6 : if ( GetPrev()->GetAttrSet()->GetBackground() ==
[ + - ]
6141 [ + - ][ + - ]: 3 : GetAttrSet()->GetBackground() )
[ + - ]
6142 : : {
6143 : 3 : aRect.Top( Frm().Top() );
6144 : : }
6145 : : }
6146 : : }
6147 [ + - ]: 12698 : aRect.Intersection( rRect );
6148 : :
6149 : 12698 : OutputDevice *pOut = pSh->GetOut();
6150 : :
6151 [ + + ][ + - ]: 12698 : if ( aRect.HasArea() )
6152 : : {
6153 : 12669 : SvxBrushItem* pNewItem = 0;
6154 [ + - ]: 12669 : SwRegionRects aRegion( aRect );
6155 [ + + ]: 12669 : if( pCol )
6156 : : {
6157 [ + - ][ + - ]: 27 : pNewItem = new SvxBrushItem( *pCol, RES_BACKGROUND );
6158 : 27 : pItem = pNewItem;
6159 : : }
6160 [ + + ]: 12669 : if ( pPage->GetSortedObjs() )
6161 [ + - ]: 531 : ::lcl_SubtractFlys( this, pPage, aRect, aRegion );
6162 : :
6163 : : {
6164 : : /// OD 06.08.2002 #99657# - determine, if background transparency
6165 : : /// have to be considered for drawing.
6166 : : /// --> Status Quo: background transparency have to be
6167 : : /// considered for fly frames
6168 : 12669 : const sal_Bool bConsiderBackgroundTransparency = IsFlyFrm();
6169 [ + + ]: 25867 : for ( sal_uInt16 i = 0; i < aRegion.size(); ++i )
6170 : : {
6171 [ + + ]: 13198 : if ( 1 < aRegion.size() )
6172 : : {
6173 [ + - ]: 728 : ::SwAlignRect( aRegion[i], pGlobalShell );
6174 [ + - ][ + + ]: 728 : if( !aRegion[i].HasArea() )
6175 : 4 : continue;
6176 : : }
6177 : : /// OD 06.08.2002 #99657# - add 6th parameter to indicate, if
6178 : : /// background transparency have to be considered
6179 : : /// Set missing 5th parameter to the default value GRFNUM_NO
6180 : : /// - see declaration in /core/inc/frmtool.hxx.
6181 : 13194 : ::DrawGraphic( pItem, pOut, aOrigBackRect, aRegion[i], GRFNUM_NO,
6182 [ + - ]: 13194 : bConsiderBackgroundTransparency );
6183 : : }
6184 : : }
6185 [ + + ]: 12669 : if( pCol )
6186 [ + - ][ + - ]: 12669 : delete pNewItem;
6187 : 12698 : }
6188 : : }
6189 : : else
6190 [ + - ]: 52166 : bLowMode = bLowerMode ? sal_True : sal_False;
6191 : : }
6192 : :
6193 : : /// OD 05.09.2002 #102912#
6194 : : /// delete temporary background brush.
6195 [ + + ][ + - ]: 53865 : delete pTmpBackBrush;
6196 : :
6197 : : //Now process lower and his neighbour.
6198 : : //We end this as soon as a Frm leaves the chain and therefore is not a lower
6199 : : //of me anymore
6200 [ + - ]: 53865 : const SwFrm *pFrm = GetLower();
6201 [ + + ]: 53865 : if ( pFrm )
6202 : : {
6203 : 33667 : SwRect aFrmRect;
6204 [ + - ]: 33667 : SwRect aRect( PaintArea() );
6205 [ + - ]: 33667 : aRect._Intersection( rRect );
6206 : 33667 : SwRect aBorderRect( aRect );
6207 [ + - ]: 33667 : SwShortCut aShortCut( *pFrm, aBorderRect );
6208 [ + + ][ + + ]: 84839 : do
[ + + + - ]
6209 [ - + ]: 50615 : { if ( pProgress )
6210 [ # # ]: 0 : pProgress->Reschedule();
6211 : :
6212 [ + - ]: 50615 : aFrmRect = pFrm->PaintArea();
6213 [ + + ][ + - ]: 50615 : if ( aFrmRect.IsOver( aBorderRect ) )
6214 : : {
6215 [ + - ]: 41216 : SwBorderAttrAccess aAccess( SwFrm::GetCache(), (SwFrm*)pFrm );
6216 [ + - ]: 41216 : const SwBorderAttrs &rTmpAttrs = *aAccess.Get();
6217 [ + + ][ - + ]: 61395 : if ( ( pFrm->IsLayoutFrm() && bLowerBorder ) ||
[ + - ][ + - ]
6218 [ + - ]: 20179 : aFrmRect.IsOver( aRect ) )
6219 : : pFrm->PaintBackground( aRect, pPage, rTmpAttrs, bLowMode,
6220 [ + - ]: 41216 : bLowerBorder );
6221 [ + - ]: 41216 : if ( bLowerBorder )
6222 [ + - ][ + - ]: 41216 : pFrm->PaintBorder( aBorderRect, pPage, rTmpAttrs );
6223 : : }
6224 : 50615 : pFrm = pFrm->GetNext();
6225 : 17112 : } while ( pFrm && pFrm->GetUpper() == this &&
6226 [ + - ]: 17112 : !aShortCut.Stop( aFrmRect ) );
6227 [ + - ]: 53865 : }
6228 : : }
6229 : :
6230 : : /*************************************************************************
6231 : : |*
6232 : : |* SwPageFrm::RefreshSubsidiary()
6233 : : |*
6234 : : |* Description Refreshes all subsidiary lines of a page.
6235 : : |*
6236 : : |*************************************************************************/
6237 : :
6238 : 12359 : void SwPageFrm::RefreshSubsidiary( const SwRect &rRect ) const
6239 : : {
6240 [ + - ][ + + ]: 12359 : if ( IS_SUBS || IS_SUBS_TABLE || IS_SUBS_SECTION || IS_SUBS_FLYS )
[ + - ][ + + ]
[ + + ][ + - ]
[ + + ][ + - ]
[ + + ][ + - ]
[ + + ][ + - ]
[ - + ][ + - ]
[ - + ][ # # ]
[ # # ][ + + ]
6241 : : {
6242 : 12351 : SwRect aRect( rRect );
6243 : : // OD 18.02.2003 #104989# - Not necessary and incorrect alignment of
6244 : : // the output rectangle.
6245 : : //::SwAlignRect( aRect, pGlobalShell );
6246 [ + - ][ + - ]: 12351 : if ( aRect.HasArea() )
6247 : : {
6248 : : //During paint using the root, the array is controlled from there.
6249 : : //Otherwise we'll handle it for our self.
6250 : 12351 : sal_Bool bDelSubs = sal_False;
6251 [ - + ]: 12351 : if ( !pSubsLines )
6252 : : {
6253 [ # # ][ # # ]: 0 : pSubsLines = new SwSubsRects;
6254 : : // OD 20.12.2002 #106318# - create container for special subsidiary lines
6255 [ # # ][ # # ]: 0 : pSpecSubsLines = new SwSubsRects;
6256 : 0 : bDelSubs = sal_True;
6257 : : }
6258 : :
6259 [ + - ]: 12351 : RefreshLaySubsidiary( this, aRect );
6260 : :
6261 [ - + ]: 12351 : if ( bDelSubs )
6262 : : {
6263 : : // OD 20.12.2002 #106318# - paint special subsidiary lines
6264 : : // and delete its container
6265 [ # # ]: 0 : pSpecSubsLines->PaintSubsidiary( pGlobalShell->GetOut(), NULL );
6266 [ # # ]: 0 : DELETEZ( pSpecSubsLines );
6267 : :
6268 [ # # ]: 0 : pSubsLines->PaintSubsidiary( pGlobalShell->GetOut(), pLines );
6269 [ # # ]: 12351 : DELETEZ( pSubsLines );
6270 : : }
6271 : : }
6272 : : }
6273 : 12359 : }
6274 : :
6275 : : /*************************************************************************
6276 : : |*
6277 : : |* SwLayoutFrm::RefreshLaySubsidiary()
6278 : : |*
6279 : : |*************************************************************************/
6280 : 33177 : void SwLayoutFrm::RefreshLaySubsidiary( const SwPageFrm *pPage,
6281 : : const SwRect &rRect ) const
6282 : : {
6283 [ + - ][ + - ]: 33177 : const sal_Bool bSubsOpt = IS_SUBS;
[ + - ][ + - ]
[ + + ]
6284 [ + + ]: 33177 : if ( bSubsOpt )
6285 [ + - ]: 33029 : PaintSubsidiaryLines( pPage, rRect );
6286 : :
6287 : 33177 : const SwFrm *pLow = Lower();
6288 [ + - ]: 33177 : if( !pLow )
6289 : 33177 : return;
6290 [ + - ]: 33177 : SwShortCut aShortCut( *pLow, rRect );
6291 [ + + ][ + - ]: 79890 : while( pLow && !aShortCut.Stop( pLow->Frm() ) )
[ + + ][ + + ]
6292 : : {
6293 [ + - ][ + + ]: 46713 : if ( pLow->Frm().IsOver( rRect ) && pLow->Frm().HasArea() )
[ + - ][ + + ]
[ + + ]
6294 : : {
6295 [ + + ]: 40221 : if ( pLow->IsLayoutFrm() )
6296 [ + - ]: 20088 : ((const SwLayoutFrm*)pLow)->RefreshLaySubsidiary( pPage, rRect);
6297 [ + + ]: 20133 : else if ( pLow->GetDrawObjs() )
6298 : : {
6299 : 4125 : const SwSortedObjs& rObjs = *(pLow->GetDrawObjs());
6300 [ + - ][ + + ]: 11571 : for ( sal_uInt32 i = 0; i < rObjs.Count(); ++i )
6301 : : {
6302 [ + - ]: 7446 : const SwAnchoredObject* pAnchoredObj = rObjs[i];
6303 [ + - ][ + - ]: 29784 : if ( pPage->GetFmt()->GetDoc()->IsVisibleLayerId(
[ + + ][ + + ]
6304 [ + - ][ + - ]: 14892 : pAnchoredObj->GetDrawObj()->GetLayer() ) &&
[ + - ][ # # ]
[ + - ]
6305 [ + - ][ + - ]: 7446 : pAnchoredObj->ISA(SwFlyFrm) )
6306 : : {
6307 : : const SwFlyFrm *pFly =
6308 [ + - ]: 419 : static_cast<const SwFlyFrm*>(pAnchoredObj);
6309 [ + + ][ + - ]: 419 : if ( pFly->IsFlyInCntFrm() && pFly->Frm().IsOver( rRect ) )
[ + + ][ + + ]
6310 : : {
6311 [ + - ][ + + ]: 410 : if ( !pFly->Lower() || !pFly->Lower()->IsNoTxtFrm() ||
[ + - ][ + - ]
6312 [ + - ]: 177 : !((SwNoTxtFrm*)pFly->Lower())->HasAnimation())
6313 [ + - ]: 233 : pFly->RefreshLaySubsidiary( pPage, rRect );
6314 : : }
6315 : : }
6316 : : }
6317 : : }
6318 : : }
6319 : 46713 : pLow = pLow->GetNext();
6320 : : }
6321 : : }
6322 : :
6323 : : /*************************************************************************
6324 : : |*
6325 : : |* SwLayoutFrm::PaintSubsidiaryLines()
6326 : : |*
6327 : : |* Description Subsidiary lines to paint the PrtAreas
6328 : : |* Only the LayoutFrms which directly contain Cntnt.
6329 : : |*
6330 : : |*************************************************************************/
6331 : :
6332 : : //Paints the desired line and pays attention to not overpaint any flys.
6333 : :
6334 : : typedef long Size::* SizePtr;
6335 : : typedef long Point::* PointPtr;
6336 : :
6337 : : PointPtr pX = &Point::nA;
6338 : : PointPtr pY = &Point::nB;
6339 : : SizePtr pWidth = &Size::nA;
6340 : : SizePtr pHeight = &Size::nB;
6341 : :
6342 : : // OD 18.11.2002 #99672# - new parameter <_pSubsLines>
6343 : 1415 : void lcl_RefreshLine( const SwLayoutFrm *pLay,
6344 : : const SwPageFrm *pPage,
6345 : : const Point &rP1,
6346 : : const Point &rP2,
6347 : : const sal_uInt8 nSubColor,
6348 : : SwLineRects* _pSubsLines )
6349 : : {
6350 : : //In which direction do we loop? Can only be horizontal or vertical.
6351 : : OSL_ENSURE( ((rP1.X() == rP2.X()) || (rP1.Y() == rP2.Y())),
6352 : : "Sloped subsidiary lines are not allowed." );
6353 [ + + ]: 1415 : const PointPtr pDirPt = rP1.X() == rP2.X() ? pY : pX;
6354 [ + + ]: 1415 : const PointPtr pOthPt = pDirPt == pX ? pY : pX;
6355 [ + + ]: 1415 : const SizePtr pDirSz = pDirPt == pX ? pWidth : pHeight;
6356 [ + + ]: 1415 : const SizePtr pOthSz = pDirSz == pWidth ? pHeight : pWidth;
6357 : 1415 : Point aP1( rP1 ),
6358 : 1415 : aP2( rP2 );
6359 : :
6360 [ + + ]: 2861 : while ( aP1.*pDirPt < aP2.*pDirPt )
6361 : : {
6362 : : //If the starting point lies in a fly, it is directly set behind the
6363 : : //fly.
6364 : : //The end point moves to the start if the end point lies in a fly or we
6365 : : //have a fly between starting point and end point.
6366 : : // In this way, every position is output one by one.
6367 : :
6368 : : //If I'm a fly I'll only avoid those flys which are places 'above' me;
6369 : : //this means those who are behind me in the array.
6370 : : //Even if I'm inside a fly or inside a fly inside a fly a.s.o I won't
6371 : : //avoid any of those flys.
6372 [ + - ]: 1446 : SwOrderIter aIter( pPage );
6373 [ + - ]: 1446 : const SwFlyFrm *pMyFly = pLay->FindFlyFrm();
6374 [ + + ]: 1446 : if ( pMyFly )
6375 : : {
6376 [ + - ]: 1322 : aIter.Current( pMyFly->GetVirtDrawObj() );
6377 [ + - ][ + - ]: 1322 : while ( 0 != (pMyFly = pMyFly->GetAnchorFrm()->FindFlyFrm()) )
[ - + ]
6378 : : {
6379 [ # # ][ # # ]: 0 : if ( aIter()->GetOrdNum() > pMyFly->GetVirtDrawObj()->GetOrdNum() )
[ # # ][ # # ]
6380 [ # # ]: 0 : aIter.Current( pMyFly->GetVirtDrawObj() );
6381 : : }
6382 : : }
6383 : : else
6384 [ + - ]: 124 : aIter.Bottom();
6385 : :
6386 [ + + ]: 3584 : while ( aIter() )
6387 : : {
6388 : 2138 : const SwVirtFlyDrawObj *pObj = (SwVirtFlyDrawObj*)aIter();
6389 [ + - ]: 2138 : const SwFlyFrm *pFly = pObj ? pObj->GetFlyFrm() : 0;
6390 : :
6391 : : //I certainly won't avoid myself, even if I'm placed _inside_ the
6392 : : //fly I won't avoid it.
6393 [ + - ][ + + ]: 2138 : if ( !pFly || (pFly == pLay || pFly->IsAnLower( pLay )) )
[ + - ][ - + ]
[ + + ]
6394 : : {
6395 [ + - ]: 1322 : aIter.Next();
6396 : 1322 : continue;
6397 : : }
6398 : :
6399 : : // OD 19.12.2002 #106318# - do *not* consider fly frames with
6400 : : // a transparent background.
6401 : : // OD 2004-02-12 #110582#-2 - do *not* consider fly frame, which
6402 : : // belongs to a invisible layer
6403 [ + - ][ + - ]: 2448 : if ( pFly->IsBackgroundTransparent() ||
[ - + ][ - + ]
6404 [ + - ][ + - ]: 1632 : !pFly->GetFmt()->GetDoc()->IsVisibleLayerId( pObj->GetLayer() ) )
[ + - ][ + - ]
[ # # ]
6405 : : {
6406 [ # # ]: 0 : aIter.Next();
6407 : 0 : continue;
6408 : : }
6409 : :
6410 : : //Is the Obj placed on the line
6411 [ + - ]: 816 : const Rectangle &rBound = pObj->GetCurrentBoundRect();
6412 : 816 : const Point aDrPt( rBound.TopLeft() );
6413 [ + - ]: 816 : const Size aDrSz( rBound.GetSize() );
6414 [ + + ][ + + ]: 816 : if ( rP1.*pOthPt >= aDrPt.*pOthPt &&
6415 : : rP1.*pOthPt <= (aDrPt.*pOthPt + aDrSz.*pOthSz) )
6416 : : {
6417 [ + + ][ + + ]: 422 : if ( aP1.*pDirPt >= aDrPt.*pDirPt &&
6418 : : aP1.*pDirPt <= (aDrPt.*pDirPt + aDrSz.*pDirSz) )
6419 : 279 : aP1.*pDirPt = aDrPt.*pDirPt + aDrSz.*pDirSz;
6420 : :
6421 [ + + ][ + + ]: 422 : if ( aP2.*pDirPt >= aDrPt.*pDirPt &&
6422 : : aP1.*pDirPt < (aDrPt.*pDirPt - 1) )
6423 : 31 : aP2.*pDirPt = aDrPt.*pDirPt - 1;
6424 : : }
6425 [ + - ]: 2138 : aIter.Next();
6426 : : }
6427 : :
6428 [ + + ]: 1446 : if ( aP1.*pDirPt < aP2.*pDirPt )
6429 : : {
6430 : 1238 : SwRect aRect( aP1, aP2 );
6431 : : // OD 18.11.2002 #99672# - use parameter <_pSubsLines> instead of
6432 : : // global variable <pSubsLines>.
6433 : : _pSubsLines->AddLineRect( aRect, 0, table::BorderLineStyle::SOLID,
6434 [ + - ]: 1238 : 0, nSubColor );
6435 : : }
6436 : 1446 : aP1 = aP2;
6437 : 1446 : aP1.*pDirPt += 1;
6438 : 1446 : aP2 = rP2;
6439 : : }
6440 : 1415 : }
6441 : :
6442 : 12259 : drawinglayer::primitive2d::Primitive2DSequence lcl_CreatePageAreaDelimiterPrimitives(
6443 : : const SwRect& rRect )
6444 : : {
6445 [ + - ]: 12259 : drawinglayer::primitive2d::Primitive2DSequence aSeq( 4 );
6446 : :
6447 [ + - ]: 12259 : basegfx::BColor aLineColor = SwViewOption::GetDocBoundariesColor().getBColor();
6448 : 12259 : double nLineLength = 200.0; // in Twips
6449 : :
6450 [ + - ][ + - ]: 12259 : Point aPoints[] = { rRect.TopLeft(), rRect.TopRight(), rRect.BottomRight(), rRect.BottomLeft() };
[ + - ][ + - ]
6451 : 12259 : double aXOffDirs[] = { -1.0, 1.0, 1.0, -1.0 };
6452 : 12259 : double aYOffDirs[] = { -1.0, -1.0, 1.0, 1.0 };
6453 : :
6454 : : // Actually loop over the corners to create the two lines
6455 [ + + ]: 61295 : for ( int i = 0; i < 4; i++ )
6456 : : {
6457 : 49036 : basegfx::B2DVector aHorizVector( aXOffDirs[i], 0.0 );
6458 : 49036 : basegfx::B2DVector aVertVector( 0.0, aYOffDirs[i] );
6459 : :
6460 : 49036 : basegfx::B2DPoint aBPoint( aPoints[i].X(), aPoints[i].Y() );
6461 : :
6462 [ + - ]: 49036 : basegfx::B2DPolygon aPolygon;
6463 [ + - ]: 49036 : aPolygon.append( aBPoint + aHorizVector * nLineLength );
6464 [ + - ]: 49036 : aPolygon.append( aBPoint );
6465 [ + - ]: 49036 : aPolygon.append( aBPoint + aVertVector * nLineLength );
6466 : :
6467 : : drawinglayer::primitive2d::PolygonHairlinePrimitive2D* pLine =
6468 : : new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
6469 [ + - ]: 49036 : aPolygon, aLineColor );
6470 [ + - ][ + - ]: 49036 : aSeq[i] = drawinglayer::primitive2d::Primitive2DReference( pLine );
[ + - ][ + - ]
6471 [ + - ]: 49036 : }
6472 : :
6473 : 12259 : return aSeq;
6474 : : }
6475 : :
6476 : 18 : drawinglayer::primitive2d::Primitive2DSequence lcl_CreateRectangleDelimiterPrimitives (
6477 : : const SwRect& rRect )
6478 : : {
6479 [ + - ]: 18 : drawinglayer::primitive2d::Primitive2DSequence aSeq( 1 );
6480 [ + - ]: 18 : basegfx::BColor aLineColor = SwViewOption::GetDocBoundariesColor().getBColor();
6481 : :
6482 [ + - ]: 18 : basegfx::B2DPolygon aPolygon;
6483 [ + - ]: 18 : aPolygon.append( basegfx::B2DPoint( rRect.Left(), rRect.Top() ) );
6484 [ + - ]: 18 : aPolygon.append( basegfx::B2DPoint( rRect.Right(), rRect.Top() ) );
6485 [ + - ]: 18 : aPolygon.append( basegfx::B2DPoint( rRect.Right(), rRect.Bottom() ) );
6486 [ + - ]: 18 : aPolygon.append( basegfx::B2DPoint( rRect.Left(), rRect.Bottom() ) );
6487 [ + - ]: 18 : aPolygon.setClosed( true );
6488 : :
6489 : : drawinglayer::primitive2d::PolygonHairlinePrimitive2D* pLine =
6490 : : new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
6491 [ + - ]: 18 : aPolygon, aLineColor );
6492 [ + - ][ + - ]: 18 : aSeq[0] = drawinglayer::primitive2d::Primitive2DReference( pLine );
[ + - ][ + - ]
6493 : :
6494 [ + - ]: 18 : return aSeq;
6495 : : }
6496 : :
6497 : 63 : drawinglayer::primitive2d::Primitive2DSequence lcl_CreateColumnAreaDelimiterPrimitives(
6498 : : const SwRect& rRect )
6499 : : {
6500 [ + - ]: 63 : drawinglayer::primitive2d::Primitive2DSequence aSeq( 4 );
6501 : :
6502 [ + - ]: 63 : basegfx::BColor aLineColor = SwViewOption::GetDocBoundariesColor().getBColor();
6503 : 63 : double nLineLength = 100.0; // in Twips
6504 : :
6505 [ + - ][ + - ]: 63 : Point aPoints[] = { rRect.TopLeft(), rRect.TopRight(), rRect.BottomRight(), rRect.BottomLeft() };
[ + - ][ + - ]
6506 : 63 : double aXOffDirs[] = { 1.0, -1.0, -1.0, 1.0 };
6507 : 63 : double aYOffDirs[] = { 1.0, 1.0, -1.0, -1.0 };
6508 : :
6509 : : // Actually loop over the corners to create the two lines
6510 [ + + ]: 315 : for ( int i = 0; i < 4; i++ )
6511 : : {
6512 : 252 : basegfx::B2DVector aHorizVector( aXOffDirs[i], 0.0 );
6513 : 252 : basegfx::B2DVector aVertVector( 0.0, aYOffDirs[i] );
6514 : :
6515 : 252 : basegfx::B2DPoint aBPoint( aPoints[i].X(), aPoints[i].Y() );
6516 : :
6517 [ + - ]: 252 : basegfx::B2DPolygon aPolygon;
6518 [ + - ]: 252 : aPolygon.append( aBPoint + aHorizVector * nLineLength );
6519 [ + - ]: 252 : aPolygon.append( aBPoint );
6520 [ + - ]: 252 : aPolygon.append( aBPoint + aVertVector * nLineLength );
6521 : :
6522 : : drawinglayer::primitive2d::PolygonHairlinePrimitive2D* pLine =
6523 : : new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
6524 [ + - ]: 252 : aPolygon, aLineColor );
6525 [ + - ][ + - ]: 252 : aSeq[i] = drawinglayer::primitive2d::Primitive2DReference( pLine );
[ + - ][ + - ]
6526 [ + - ]: 252 : }
6527 : :
6528 : 63 : return aSeq;
6529 : : }
6530 : :
6531 : 12277 : void SwPageFrm::PaintSubsidiaryLines( const SwPageFrm *,
6532 : : const SwRect & ) const
6533 : : {
6534 [ + - ]: 12277 : if ( !pGlobalShell->IsHeaderFooterEdit() )
6535 : : {
6536 : 12277 : const SwFrm* pLay = Lower();
6537 : 12277 : const SwFrm* pFtnCont = NULL;
6538 : 12277 : const SwFrm* pPageBody = NULL;
6539 [ + + ][ - + ]: 24767 : while ( pLay && !( pFtnCont && pPageBody ) )
[ # # ][ + + ]
6540 : : {
6541 [ + + ]: 12490 : if ( pLay->IsFtnContFrm( ) )
6542 : 107 : pFtnCont = pLay;
6543 [ + + ]: 12490 : if ( pLay->IsBodyFrm() )
6544 : 12277 : pPageBody = pLay;
6545 : 12490 : pLay = pLay->GetNext();
6546 : : }
6547 : :
6548 : 12277 : SwRect aArea( pPageBody->Frm() );
6549 [ + + ]: 12277 : if ( pFtnCont )
6550 [ + - ]: 107 : aArea.AddBottom( pFtnCont->Frm().Bottom() - aArea.Bottom() );
6551 : :
6552 [ + + ]: 12277 : if ( !pGlobalShell->GetViewOptions()->IsViewMetaChars( ) )
6553 [ + - ][ + - ]: 12259 : ProcessPrimitives( lcl_CreatePageAreaDelimiterPrimitives( aArea ) );
[ + - ]
6554 : : else
6555 [ + - ][ + - ]: 12277 : ProcessPrimitives( lcl_CreateRectangleDelimiterPrimitives( aArea ) );
[ + - ]
6556 : : }
6557 : 12277 : }
6558 : :
6559 : 63 : void SwColumnFrm::PaintSubsidiaryLines( const SwPageFrm *,
6560 : : const SwRect & ) const
6561 : : {
6562 : 63 : const SwFrm* pLay = Lower();
6563 : 63 : const SwFrm* pFtnCont = NULL;
6564 : 63 : const SwFrm* pColBody = NULL;
6565 [ + + ][ - + ]: 126 : while ( pLay && !( pFtnCont && pColBody ) )
[ # # ][ + + ]
6566 : : {
6567 [ - + ]: 63 : if ( pLay->IsFtnContFrm( ) )
6568 : 0 : pFtnCont = pLay;
6569 [ + - ]: 63 : if ( pLay->IsBodyFrm() )
6570 : 63 : pColBody = pLay;
6571 : 63 : pLay = pLay->GetNext();
6572 : : }
6573 : :
6574 : 63 : SwRect aArea( pColBody->Frm() );
6575 : :
6576 : : // #i3662# - enlarge top of column body frame's printing area
6577 : : // in sections to top of section frame.
6578 : 63 : const bool bColInSection = GetUpper()->IsSctFrm();
6579 [ + - ]: 63 : if ( bColInSection )
6580 : : {
6581 [ + - ][ - + ]: 63 : if ( IsVertical() )
6582 : 0 : aArea.Right( GetUpper()->Frm().Right() );
6583 : : else
6584 : 63 : aArea.Top( GetUpper()->Frm().Top() );
6585 : : }
6586 : :
6587 [ - + ]: 63 : if ( pFtnCont )
6588 [ # # ]: 0 : aArea.AddBottom( pFtnCont->Frm().Bottom() - aArea.Bottom() );
6589 : :
6590 [ + - ]: 63 : ::SwAlignRect( aArea, pGlobalShell );
6591 : :
6592 [ + - ]: 63 : if ( !pGlobalShell->GetViewOptions()->IsViewMetaChars( ) )
6593 [ + - ][ + - ]: 63 : ProcessPrimitives( lcl_CreateColumnAreaDelimiterPrimitives( aArea ) );
[ + - ]
6594 : : else
6595 [ # # ][ # # ]: 0 : ProcessPrimitives( lcl_CreateRectangleDelimiterPrimitives( aArea ) );
[ # # ]
6596 : 63 : }
6597 : :
6598 : 231 : void SwSectionFrm::PaintSubsidiaryLines( const SwPageFrm * pPage,
6599 : : const SwRect & rRect ) const
6600 : : {
6601 [ + - ][ + + ]: 231 : const sal_Bool bNoLowerColumn = !Lower() || !Lower()->IsColumnFrm();
6602 [ + + ]: 231 : if ( bNoLowerColumn )
6603 : : {
6604 : 168 : SwLayoutFrm::PaintSubsidiaryLines( pPage, rRect );
6605 : : }
6606 : 231 : }
6607 : :
6608 : : /** The SwBodyFrm doesn't print any subsidiary line: it's bounds are painted
6609 : : either by the parent page or the parent column frame.
6610 : : */
6611 : 12254 : void SwBodyFrm::PaintSubsidiaryLines( const SwPageFrm *,
6612 : : const SwRect & ) const
6613 : : {
6614 : 12254 : }
6615 : :
6616 : 48 : void SwHeadFootFrm::PaintSubsidiaryLines( const SwPageFrm *, const SwRect & ) const
6617 : : {
6618 [ - + ]: 48 : if ( pGlobalShell->IsHeaderFooterEdit() )
6619 : : {
6620 : 0 : SwRect aArea( Prt() );
6621 : 0 : aArea.Pos() += Frm().Pos();
6622 [ # # ]: 0 : if ( !pGlobalShell->GetViewOptions()->IsViewMetaChars( ) )
6623 [ # # ][ # # ]: 0 : ProcessPrimitives( lcl_CreatePageAreaDelimiterPrimitives( aArea ) );
[ # # ]
6624 : : else
6625 [ # # ][ # # ]: 0 : ProcessPrimitives( lcl_CreateRectangleDelimiterPrimitives( aArea ) );
[ # # ]
6626 : : }
6627 : 48 : }
6628 : :
6629 : : /** This method is overridden in order to have no subsidiary lines
6630 : : around the footnotes.
6631 : : */
6632 : 11 : void SwFtnFrm::PaintSubsidiaryLines( const SwPageFrm *,
6633 : : const SwRect & ) const
6634 : : {
6635 : 11 : }
6636 : :
6637 : : /** This method is overridden in order to have no subsidiary lines
6638 : : around the footnotes containers.
6639 : : */
6640 : 11 : void SwFtnContFrm::PaintSubsidiaryLines( const SwPageFrm *,
6641 : : const SwRect & ) const
6642 : : {
6643 : 11 : }
6644 : :
6645 : 8302 : void SwLayoutFrm::PaintSubsidiaryLines( const SwPageFrm *pPage,
6646 : : const SwRect &rRect ) const
6647 : : {
6648 : 8302 : bool bNewTableModel = false;
6649 : :
6650 : : // #i29550#
6651 [ + + ][ + + ]: 8302 : if ( IsTabFrm() || IsCellFrm() || IsRowFrm() )
[ + + ][ + + ]
6652 : : {
6653 [ + - ]: 7396 : const SwTabFrm* pTabFrm = FindTabFrm();
6654 [ + - ][ - + ]: 7396 : if ( pTabFrm->IsCollapsingBorders() )
6655 : : return;
6656 : :
6657 : 0 : bNewTableModel = pTabFrm->GetTable()->IsNewModel();
6658 : : // in the new table model, we have an early return for all cell-related
6659 : : // frames, except from non-covered table cells
6660 [ # # ]: 0 : if ( bNewTableModel )
6661 [ # # # # : 0 : if ( IsTabFrm() ||
# # ][ # # ]
[ # # ]
6662 : 0 : IsRowFrm() ||
6663 [ # # ]: 0 : ( IsCellFrm() && IsCoveredCell() ) )
6664 : : return;
6665 : : }
6666 : : // <-- collapsing
6667 : :
6668 : 906 : const bool bFlys = pPage->GetSortedObjs() ? true : false;
6669 : :
6670 : 906 : const bool bCell = IsCellFrm() ? true : false;
6671 : : // use frame area for cells
6672 : : // OD 13.02.2003 #i3662# - for section use also frame area
6673 [ + + ][ + - ]: 906 : const bool bUseFrmArea = bCell || IsSctFrm();
6674 [ + + ]: 906 : SwRect aOriginal( bUseFrmArea ? Frm() : Prt() );
6675 [ + + ]: 906 : if ( !bUseFrmArea )
6676 : 738 : aOriginal.Pos() += Frm().Pos();
6677 : :
6678 [ + - ]: 906 : ::SwAlignRect( aOriginal, pGlobalShell );
6679 : :
6680 [ + - ][ + + ]: 906 : if ( !aOriginal.IsOver( rRect ) )
6681 : : return;
6682 : :
6683 : 887 : SwRect aOut( aOriginal );
6684 [ + - ]: 887 : aOut._Intersection( rRect );
6685 : :
6686 : 887 : const SwTwips nRight = aOut.Right();
6687 : 887 : const SwTwips nBottom= aOut.Bottom();
6688 : :
6689 : 887 : const Point aRT( nRight, aOut.Top() );
6690 : 887 : const Point aRB( nRight, nBottom );
6691 : 887 : const Point aLB( aOut.Left(), nBottom );
6692 : :
6693 : 887 : sal_uInt8 nSubColor = ( bCell || IsRowFrm() ) ? SUBCOL_TAB :
6694 [ + - ]: 887 : ( IsInSct() ? SUBCOL_SECT :
6695 [ + + ][ + - ]: 2661 : ( IsInFly() ? SUBCOL_FLY : SUBCOL_PAGE ) );
[ + - ]
[ + - + - ]
6696 : :
6697 : : // OD 18.11.2002 #99672# - collect body, header, footer, footnote and section
6698 : : // sub-lines in <pSpecSubsLine> array.
6699 : 2661 : const bool bSpecialSublines = IsBodyFrm() || IsHeaderFrm() || IsFooterFrm() ||
6700 [ + - ][ + + ]: 2661 : IsFtnFrm() || IsSctFrm();
[ + - + -
+ - ]
6701 [ + + ]: 887 : SwLineRects* pUsedSubsLines = bSpecialSublines ? pSpecSubsLines : pSubsLines;
6702 : :
6703 : : // NOTE: for cell frames only left and right (horizontal layout) respectively
6704 : : // top and bottom (vertical layout) lines painted.
6705 : : // NOTE2: this does not hold for the new table model!!! We paint the top border
6706 : : // of each non-covered table cell.
6707 [ + - ]: 887 : const bool bVert = IsVertical() ? true : false;
6708 [ + + ]: 887 : if ( bFlys )
6709 : : {
6710 : : // OD 14.11.2002 #104822# - add control for drawing left and right lines
6711 [ - + ][ # # ]: 359 : if ( !bCell || bNewTableModel || !bVert )
[ # # ]
6712 : : {
6713 [ + - ]: 359 : if ( aOriginal.Left() == aOut.Left() )
6714 [ + - ]: 359 : ::lcl_RefreshLine( this, pPage, aOut.Pos(), aLB, nSubColor, pUsedSubsLines );
6715 : : // OD 14.11.2002 #104821# - in vertical layout set page/column break at right
6716 [ + - ]: 359 : if ( aOriginal.Right() == nRight )
6717 [ + - ]: 359 : ::lcl_RefreshLine( this, pPage, aRT, aRB, nSubColor, pUsedSubsLines );
6718 : : }
6719 : : // OD 14.11.2002 #104822# - adjust control for drawing top and bottom lines
6720 [ - + ][ # # ]: 359 : if ( !bCell || bNewTableModel || bVert )
[ # # ]
6721 : : {
6722 [ + + ]: 359 : if ( aOriginal.Top() == aOut.Top() )
6723 : : // OD 14.11.2002 #104821# - in horizontal layout set page/column break at top
6724 [ + - ]: 348 : ::lcl_RefreshLine( this, pPage, aOut.Pos(), aRT, nSubColor, pUsedSubsLines );
6725 [ + + ]: 359 : if ( aOriginal.Bottom() == nBottom )
6726 : : ::lcl_RefreshLine( this, pPage, aLB, aRB, nSubColor,
6727 [ + - ]: 349 : pUsedSubsLines );
6728 : : }
6729 : : }
6730 : : else
6731 : : {
6732 : : // OD 14.11.2002 #104822# - add control for drawing left and right lines
6733 [ - + ][ # # ]: 528 : if ( !bCell || bNewTableModel || !bVert )
[ # # ]
6734 : : {
6735 [ + - ]: 528 : if ( aOriginal.Left() == aOut.Left() )
6736 : : {
6737 : 528 : const SwRect aRect( aOut.Pos(), aLB );
6738 : : pUsedSubsLines->AddLineRect( aRect, 0,
6739 [ + - ]: 528 : table::BorderLineStyle::SOLID, 0, nSubColor );
6740 : : }
6741 : : // OD 14.11.2002 #104821# - in vertical layout set page/column break at right
6742 [ + - ]: 528 : if ( aOriginal.Right() == nRight )
6743 : : {
6744 : 528 : const SwRect aRect( aRT, aRB );
6745 : : pUsedSubsLines->AddLineRect( aRect, 0,
6746 [ + - ]: 528 : table::BorderLineStyle::SOLID, 0, nSubColor );
6747 : : }
6748 : : }
6749 : : // OD 14.11.2002 #104822# - adjust control for drawing top and bottom lines
6750 [ - + ][ # # ]: 528 : if ( !bCell || bNewTableModel || bVert )
[ # # ]
6751 : : {
6752 [ + + ]: 528 : if ( aOriginal.Top() == aOut.Top() )
6753 : : {
6754 : : // OD 14.11.2002 #104821# - in horizontal layout set page/column break at top
6755 : 526 : const SwRect aRect( aOut.Pos(), aRT );
6756 : : pUsedSubsLines->AddLineRect( aRect, 0,
6757 [ + - ]: 526 : table::BorderLineStyle::SOLID, 0, nSubColor );
6758 : : }
6759 [ + + ]: 528 : if ( aOriginal.Bottom() == nBottom )
6760 : : {
6761 : 523 : const SwRect aRect( aLB, aRB );
6762 : : pUsedSubsLines->AddLineRect( aRect, 0,
6763 [ + - ]: 8302 : table::BorderLineStyle::SOLID, 0, nSubColor );
6764 : : }
6765 : : }
6766 : : }
6767 : : }
6768 : :
6769 : : /*************************************************************************
6770 : : |*
6771 : : |* SwPageFrm::RefreshExtraData(), SwLayoutFrm::RefreshExtraData()
6772 : : |*
6773 : : |* Description Refreshes all extra data (line breaks a.s.o) of the
6774 : : |* page. Basically only those objects are considered which
6775 : : |* horizontally overlap the Rect.
6776 : : |*
6777 : : |*************************************************************************/
6778 : :
6779 : 6 : void SwPageFrm::RefreshExtraData( const SwRect &rRect ) const
6780 : : {
6781 [ + - ][ + - ]: 6 : const SwLineNumberInfo &rInfo = GetFmt()->GetDoc()->GetLineNumberInfo();
6782 : 12 : sal_Bool bLineInFly = (rInfo.IsPaintLineNumbers() && rInfo.IsCountInFlys())
6783 [ + - ][ + - ]: 12 : || (sal_Int16)SW_MOD()->GetRedlineMarkPos() != text::HoriOrientation::NONE;
[ + - ]
[ + - + - ]
6784 : :
6785 : 6 : SwRect aRect( rRect );
6786 [ + - ]: 6 : ::SwAlignRect( aRect, pGlobalShell );
6787 [ + - ][ + - ]: 6 : if ( aRect.HasArea() )
6788 : : {
6789 [ + - ]: 6 : SwLayoutFrm::RefreshExtraData( aRect );
6790 : :
6791 [ + - ][ - + ]: 6 : if ( bLineInFly && GetSortedObjs() )
[ - + ]
6792 [ # # ][ # # ]: 0 : for ( sal_uInt16 i = 0; i < GetSortedObjs()->Count(); ++i )
6793 : : {
6794 [ # # ]: 0 : const SwAnchoredObject* pAnchoredObj = (*GetSortedObjs())[i];
6795 [ # # ][ # # ]: 0 : if ( pAnchoredObj->ISA(SwFlyFrm) )
[ # # ]
6796 : : {
6797 [ # # ]: 0 : const SwFlyFrm *pFly = static_cast<const SwFlyFrm*>(pAnchoredObj);
6798 [ # # # # ]: 0 : if ( pFly->Frm().Top() <= aRect.Bottom() &&
[ # # ]
6799 : 0 : pFly->Frm().Bottom() >= aRect.Top() )
6800 [ # # ]: 0 : pFly->RefreshExtraData( aRect );
6801 : : }
6802 : : }
6803 : : }
6804 : 6 : }
6805 : :
6806 : 6 : void SwLayoutFrm::RefreshExtraData( const SwRect &rRect ) const
6807 : : {
6808 : :
6809 : 6 : const SwLineNumberInfo &rInfo = GetFmt()->GetDoc()->GetLineNumberInfo();
6810 : 6 : sal_Bool bLineInBody = rInfo.IsPaintLineNumbers(),
6811 [ - + ][ + - ]: 6 : bLineInFly = bLineInBody && rInfo.IsCountInFlys(),
6812 : 6 : bRedLine = (sal_Int16)SW_MOD()->GetRedlineMarkPos()!=text::HoriOrientation::NONE;
6813 : :
6814 : 6 : const SwCntntFrm *pCnt = ContainsCntnt();
6815 [ + + ][ + - ]: 42 : while ( pCnt && IsAnLower( pCnt ) )
[ + + ]
6816 : : {
6817 [ + - ]: 108 : if ( pCnt->IsTxtFrm() && ( bRedLine ||
[ - + # # ]
[ # # # # ]
[ # # # #
+ - + + ]
[ + + ]
6818 : 0 : ( !pCnt->IsInTab() &&
6819 : 0 : ((bLineInBody && pCnt->IsInDocBody()) ||
6820 : 0 : (bLineInFly && pCnt->IsInFly())) ) ) &&
6821 : 36 : pCnt->Frm().Top() <= rRect.Bottom() &&
6822 : 36 : pCnt->Frm().Bottom() >= rRect.Top() )
6823 : : {
6824 : 32 : ((SwTxtFrm*)pCnt)->PaintExtraData( rRect );
6825 : : }
6826 [ - + ][ # # ]: 36 : if ( bLineInFly && pCnt->GetDrawObjs() )
[ - + ]
6827 [ # # ]: 0 : for ( sal_uInt32 i = 0; i < pCnt->GetDrawObjs()->Count(); ++i )
6828 : : {
6829 : 0 : const SwAnchoredObject* pAnchoredObj = (*pCnt->GetDrawObjs())[i];
6830 [ # # ]: 0 : if ( pAnchoredObj->ISA(SwFlyFrm) )
6831 : : {
6832 [ # # ]: 0 : const SwFlyFrm *pFly = static_cast<const SwFlyFrm*>(pAnchoredObj);
6833 [ # # # # : 0 : if ( pFly->IsFlyInCntFrm() &&
# # ][ # # ]
6834 : 0 : pFly->Frm().Top() <= rRect.Bottom() &&
6835 : 0 : pFly->Frm().Bottom() >= rRect.Top() )
6836 : 0 : pFly->RefreshExtraData( rRect );
6837 : : }
6838 : : }
6839 : 36 : pCnt = pCnt->GetNextCntntFrm();
6840 : : }
6841 : 6 : }
6842 : :
6843 : : /** SwPageFrm::GetDrawBackgrdColor - for #102450#
6844 : :
6845 : : determine the color, that is respectively will be drawn as background
6846 : : for the page frame.
6847 : : Using existing method SwFrm::GetBackgroundBrush to determine the color
6848 : : that is set at the page frame respectively is parent. If none is found
6849 : : return the global retouche color
6850 : :
6851 : : @author OD
6852 : :
6853 : : @return Color
6854 : : */
6855 : 12378 : const Color& SwPageFrm::GetDrawBackgrdColor() const
6856 : : {
6857 : : const SvxBrushItem* pBrushItem;
6858 : : const Color* pDummyColor;
6859 : 12378 : SwRect aDummyRect;
6860 [ - + ][ + - ]: 12378 : if ( GetBackgroundBrush( pBrushItem, pDummyColor, aDummyRect, true) )
6861 : 0 : return pBrushItem->GetColor();
6862 : : else
6863 : 12378 : return aGlobalRetoucheColor;
6864 : : }
6865 : :
6866 : : /*************************************************************************
6867 : : |*
6868 : : |* SwPageFrm::GetEmptyPageFont()
6869 : : |*
6870 : : |* create/return font used to paint the "empty page" string
6871 : : |*
6872 : : |*************************************************************************/
6873 : :
6874 : 0 : const Font& SwPageFrm::GetEmptyPageFont()
6875 : : {
6876 : : static Font* pEmptyPgFont = 0;
6877 [ # # ]: 0 : if ( 0 == pEmptyPgFont )
6878 : : {
6879 [ # # ]: 0 : pEmptyPgFont = new Font;
6880 [ # # ]: 0 : pEmptyPgFont->SetSize( Size( 0, 80 * 20 )); // == 80 pt
6881 : 0 : pEmptyPgFont->SetWeight( WEIGHT_BOLD );
6882 : 0 : pEmptyPgFont->SetStyleName( aEmptyStr );
6883 [ # # ]: 0 : pEmptyPgFont->SetName(rtl::OUString("Helvetica"));
6884 : 0 : pEmptyPgFont->SetFamily( FAMILY_SWISS );
6885 : 0 : pEmptyPgFont->SetTransparent( sal_True );
6886 [ # # ]: 0 : pEmptyPgFont->SetColor( COL_GRAY );
6887 : : }
6888 : :
6889 : 0 : return *pEmptyPgFont;
6890 : : }
6891 : :
6892 : : /*************************************************************************
6893 : : |*
6894 : : |* SwFrm::Retouche
6895 : : |*
6896 : : |* Description Retouch for a section.
6897 : : |* Retouch will only be done, if the Frm is the last one in his chain.
6898 : : |* The whole area of the upper which is located below the Frm will be
6899 : : |* cleared using PaintBackground.
6900 : : |*************************************************************************/
6901 : :
6902 : 2888 : void SwFrm::Retouche( const SwPageFrm * pPage, const SwRect &rRect ) const
6903 : : {
6904 [ + - ]: 2888 : if ( bFlyMetafile )
6905 : 2888 : return;
6906 : :
6907 : : OSL_ENSURE( GetUpper(), "Retouche try without Upper." );
6908 : : OSL_ENSURE( getRootFrm()->GetCurrShell() && pGlobalShell->GetWin(), "Retouche on a printer?" );
6909 : :
6910 [ + - ]: 2888 : SwRect aRetouche( GetUpper()->PaintArea() );
6911 : 2888 : aRetouche.Top( Frm().Top() + Frm().Height() );
6912 [ + - ]: 2888 : aRetouche.Intersection( pGlobalShell->VisArea() );
6913 : :
6914 [ + - ][ + + ]: 2888 : if ( aRetouche.HasArea() )
6915 : : {
6916 : : //Omit the passed Rect. To do this, we unfortunately need a region to
6917 : : //cut out.
6918 [ + - ]: 2762 : SwRegionRects aRegion( aRetouche );
6919 [ + - ]: 2762 : aRegion -= rRect;
6920 : 2762 : ViewShell *pSh = getRootFrm()->GetCurrShell();
6921 : :
6922 : : // #i16816# tagged pdf support
6923 [ + - ]: 2762 : SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, *pSh->GetOut() );
6924 : :
6925 [ + + ]: 2881 : for ( sal_uInt16 i = 0; i < aRegion.size(); ++i )
6926 : : {
6927 : 119 : SwRect &rRetouche = aRegion[i];
6928 : :
6929 [ + - ]: 119 : GetUpper()->PaintBaBo( rRetouche, pPage, sal_True );
6930 : :
6931 : : //Hell and Heaven need to be refreshed too.
6932 : : //To avoid recursion my retouch flag needs to be reset first!
6933 : 119 : ResetRetouche();
6934 : 119 : SwRect aRetouchePart( rRetouche );
6935 [ + - ][ + - ]: 119 : if ( aRetouchePart.HasArea() )
6936 : : {
6937 [ + - ]: 119 : const Color aPageBackgrdColor = pPage->GetDrawBackgrdColor();
6938 [ + - ]: 119 : const IDocumentDrawModelAccess* pIDDMA = pSh->getIDocumentDrawModelAccess();
6939 : : // --> OD #i76669#
6940 [ + - ]: 119 : SwViewObjectContactRedirector aSwRedirector( *pSh );
6941 : : // <--
6942 : :
6943 [ + - ]: 119 : pSh->Imp()->PaintLayer( pIDDMA->GetHellId(), 0,
6944 : : aRetouchePart, &aPageBackgrdColor,
6945 [ + - ]: 119 : (pPage->IsRightToLeft() ? true : false),
6946 [ + - ]: 119 : &aSwRedirector );
6947 [ + - ]: 119 : pSh->Imp()->PaintLayer( pIDDMA->GetHeavenId(), 0,
6948 : : aRetouchePart, &aPageBackgrdColor,
6949 [ + - ]: 119 : (pPage->IsRightToLeft() ? true : false),
6950 [ + - ][ + - ]: 119 : &aSwRedirector );
6951 : : }
6952 : :
6953 : 119 : SetRetouche();
6954 : :
6955 : : //Because we leave all paint areas, we need to refresh the
6956 : : //subsidiary lines.
6957 [ + - ]: 119 : pPage->RefreshSubsidiary( aRetouchePart );
6958 [ + - ]: 2762 : }
6959 : : }
6960 [ + - ]: 2888 : if ( ViewShell::IsLstEndAction() )
6961 : 2888 : ResetRetouche();
6962 : : }
6963 : :
6964 : : /** SwFrm::GetBackgroundBrush
6965 : :
6966 : : @descr
6967 : : determine the background brush for the frame:
6968 : : the background brush is taken from it-self or from its parent (anchor/upper).
6969 : : Normally, the background brush is taken, which has no transparent color or
6970 : : which has a background graphic. But there are some special cases:
6971 : : (1) No background brush is taken from a page frame, if view option "IsPageBack"
6972 : : isn't set.
6973 : : (2) Background brush from a index section is taken under special conditions.
6974 : : In this case parameter <rpCol> is set to the index shading color.
6975 : : (3) New (OD 20.08.2002) - Background brush is taken, if on background drawing
6976 : : of the frame transparency is considered and its color is not "no fill"/"auto fill"
6977 : : ---- old description in german:
6978 : : Description Returns the Backgroundbrush for the area of the Frm.
6979 : : The Brush is defined by the Frm or by an upper, the first Brush is
6980 : : used. If no Brush is defined for a Frm, sal_False is returned.
6981 : :
6982 : : @param rpBrush
6983 : : output parameter - constant reference pointer the found background brush
6984 : :
6985 : : @param rpCol
6986 : : output parameter - constant reference pointer to the color of the index shading
6987 : : set under special conditions, if background brush is taken from an index section.
6988 : :
6989 : : @param rOrigRect
6990 : : in-/output parameter - reference to the retangle the background brush is
6991 : : considered for - adjusted to the frame, from which the background brush is
6992 : : taken.
6993 : :
6994 : : @parem bLowerMode
6995 : : input parameter - boolean indicating, if background brush should *not* be
6996 : : taken from parent.
6997 : :
6998 : : @return true, if a background brush for the frame is found
6999 : : */
7000 : 96327 : sal_Bool SwFrm::GetBackgroundBrush( const SvxBrushItem* & rpBrush,
7001 : : const Color*& rpCol,
7002 : : SwRect &rOrigRect,
7003 : : sal_Bool bLowerMode ) const
7004 : : {
7005 : 96327 : const SwFrm *pFrm = this;
7006 : 96327 : ViewShell *pSh = getRootFrm()->GetCurrShell();
7007 : 96327 : const SwViewOption *pOpt = pSh->GetViewOptions();
7008 : 96327 : rpBrush = 0;
7009 : 96327 : rpCol = NULL;
7010 [ + + ]: 148191 : do
7011 [ + + ][ - + ]: 201823 : { if ( pFrm->IsPageFrm() && !pOpt->IsPageBack() )
[ - + ]
7012 : 0 : return sal_False;
7013 : :
7014 : 201823 : const SvxBrushItem &rBack = pFrm->GetAttrSet()->GetBackground();
7015 [ + + ]: 201823 : if( pFrm->IsSctFrm() )
7016 : : {
7017 : 322 : const SwSection* pSection = ((SwSectionFrm*)pFrm)->GetSection();
7018 : : /// OD 20.08.2002 #99657# #GetTransChg#
7019 : : /// Note: If frame <pFrm> is a section of the index and
7020 : : /// it its background color is "no fill"/"auto fill" and
7021 : : /// it has no background graphic and
7022 : : /// we are not in the page preview and
7023 : : /// we are not in read-only mode and
7024 : : /// option "index shadings" is set and
7025 : : /// the output is not the printer
7026 : : /// then set <rpCol> to the color of the index shading
7027 [ + + + + : 1287 : if( pSection && ( TOX_HEADER_SECTION == pSection->GetType() ||
+ + + - +
- + - +
- ][ + - +
- + - ]
[ + + ][ + - ]
7028 : 286 : TOX_CONTENT_SECTION == pSection->GetType() ) &&
7029 [ + + ][ # # ]: 392 : (rBack.GetColor() == COL_TRANSPARENT) &&
7030 : : ///rBack.GetColor().GetTransparency() &&
7031 : 41 : rBack.GetGraphicPos() == GPOS_NONE &&
7032 : 41 : !pOpt->IsPagePreview() &&
7033 : 41 : !pOpt->IsReadonly() &&
7034 : : // #114856# Formular view
7035 : 41 : !pOpt->IsFormView() &&
7036 [ + - ]: 41 : SwViewOption::IsIndexShadings() &&
7037 : 41 : !pOpt->IsPDFExport() &&
7038 : 41 : pSh->GetOut()->GetOutDevType() != OUTDEV_PRINTER )
7039 : : {
7040 : 41 : rpCol = &SwViewOption::GetIndexShadingsColor();
7041 : : }
7042 : : }
7043 : :
7044 : : /// OD 20.08.2002 #99657#
7045 : : /// determine, if background draw of frame <pFrm> considers transparency
7046 : : /// --> Status Quo: background transparency have to be
7047 : : /// considered for fly frames
7048 : 201823 : const sal_Bool bConsiderBackgroundTransparency = pFrm->IsFlyFrm();
7049 : : /// OD 20.08.2002 #99657#
7050 : : /// add condition:
7051 : : /// If <bConsiderBackgroundTransparency> is set - see above -,
7052 : : /// return brush of frame <pFrm>, if its color is *not* "no fill"/"auto fill"
7053 [ + + ]: 608427 : if ( !rBack.GetColor().GetTransparency() ||
[ + + - + ]
[ + + ]
[ + + + + ]
7054 : 201801 : rBack.GetGraphicPos() != GPOS_NONE ||
7055 : : rpCol ||
7056 [ + + ]: 204803 : (bConsiderBackgroundTransparency && (rBack.GetColor() != COL_TRANSPARENT))
7057 : : )
7058 : : {
7059 : 135 : rpBrush = &rBack;
7060 [ - + # # ]: 135 : if ( pFrm->IsPageFrm() &&
[ - + ]
7061 : 0 : pSh->GetViewOptions()->getBrowseMode() )
7062 : 0 : rOrigRect = pFrm->Frm();
7063 : : else
7064 : : {
7065 [ + + ]: 135 : if ( pFrm->Frm().SSize() != pFrm->Prt().SSize() )
7066 : : {
7067 [ + - ]: 69 : SwBorderAttrAccess aAccess( SwFrm::GetCache(), pFrm );
7068 [ + - ]: 69 : const SwBorderAttrs &rAttrs = *aAccess.Get();
7069 [ + - ][ + - ]: 69 : ::lcl_CalcBorderRect( rOrigRect, pFrm, rAttrs, sal_False );
7070 : : }
7071 : : else
7072 : : {
7073 : 66 : rOrigRect = pFrm->Prt();
7074 : 66 : rOrigRect += pFrm->Frm().Pos();
7075 : : }
7076 : : }
7077 : 135 : return sal_True;
7078 : : }
7079 : :
7080 [ + + ]: 201688 : if ( bLowerMode )
7081 : : /// Do not try to get background brush from parent (anchor/upper)
7082 : 53497 : return sal_False;
7083 : :
7084 : : /// get parent frame - anchor or upper - for next loop
7085 [ + + ]: 148191 : if ( pFrm->IsFlyFrm() )
7086 : : /// OD 20.08.2002 - use "static_cast" instead of "old C-cast"
7087 : 2980 : pFrm = (static_cast<const SwFlyFrm*>(pFrm))->GetAnchorFrm();
7088 : : ///pFrm = ((SwFlyFrm*)pFrm)->GetAnchor();
7089 : : else
7090 : 145211 : pFrm = pFrm->GetUpper();
7091 : :
7092 : : } while ( pFrm );
7093 : :
7094 : 96327 : return sal_False;
7095 : : }
7096 : :
7097 : : /*************************************************************************
7098 : : |*
7099 : : |* SwFrmFmt::GetGraphic()
7100 : : |*
7101 : : |*************************************************************************/
7102 : :
7103 : 0 : void SetOutDevAndWin( ViewShell *pSh, OutputDevice *pO,
7104 : : Window *pW, sal_uInt16 nZoom )
7105 : : {
7106 : 0 : pSh->pOut = pO;
7107 : 0 : pSh->pWin = pW;
7108 : 0 : pSh->pOpt->SetZoom( nZoom );
7109 : 0 : }
7110 : :
7111 : 0 : Graphic SwFrmFmt::MakeGraphic( ImageMap* )
7112 : : {
7113 : 0 : return Graphic();
7114 : : }
7115 : :
7116 : 0 : Graphic SwFlyFrmFmt::MakeGraphic( ImageMap* pMap )
7117 : : {
7118 [ # # ]: 0 : Graphic aRet;
7119 : : //search any Fly!
7120 [ # # ]: 0 : SwIterator<SwFrm,SwFmt> aIter( *this );
7121 [ # # ]: 0 : SwFrm *pFirst = aIter.First();
7122 : : ViewShell *pSh;
7123 [ # # ][ # # ]: 0 : if ( pFirst && 0 != ( pSh = pFirst->getRootFrm()->GetCurrShell()) )
[ # # ]
7124 : : {
7125 : 0 : ViewShell *pOldGlobal = pGlobalShell;
7126 : 0 : pGlobalShell = pSh;
7127 : :
7128 : : sal_Bool bNoteURL = pMap &&
7129 [ # # ][ # # ]: 0 : SFX_ITEM_SET != GetAttrSet().GetItemState( RES_URL, sal_True );
[ # # ]
7130 [ # # ]: 0 : if( bNoteURL )
7131 : : {
7132 : : OSL_ENSURE( !pNoteURL, "MakeGraphic: pNoteURL already used? " );
7133 [ # # ][ # # ]: 0 : pNoteURL = new SwNoteURL;
7134 : : }
7135 : 0 : SwFlyFrm *pFly = (SwFlyFrm*)pFirst;
7136 : :
7137 : 0 : OutputDevice *pOld = pSh->GetOut();
7138 [ # # ]: 0 : VirtualDevice aDev( *pOld );
7139 [ # # ]: 0 : aDev.EnableOutput( sal_False );
7140 : :
7141 [ # # ]: 0 : GDIMetaFile aMet;
7142 [ # # ]: 0 : MapMode aMap( pOld->GetMapMode().GetMapUnit() );
7143 [ # # ]: 0 : aDev.SetMapMode( aMap );
7144 [ # # ]: 0 : aMet.SetPrefMapMode( aMap );
7145 : :
7146 [ # # ]: 0 : ::SwCalcPixStatics( pSh->GetOut() );
7147 : 0 : aMet.SetPrefSize( pFly->Frm().SSize() );
7148 : :
7149 [ # # ]: 0 : aMet.Record( &aDev );
7150 [ # # ]: 0 : aDev.SetLineColor();
7151 [ # # ]: 0 : aDev.SetFillColor();
7152 [ # # ]: 0 : aDev.SetFont( pOld->GetFont() );
7153 : :
7154 : : //Enlarge the rectangle if needed, so the border is painted too.
7155 : 0 : SwRect aOut( pFly->Frm() );
7156 [ # # ]: 0 : SwBorderAttrAccess aAccess( SwFrm::GetCache(), pFly );
7157 [ # # ]: 0 : const SwBorderAttrs &rAttrs = *aAccess.Get();
7158 [ # # ][ # # ]: 0 : if ( rAttrs.CalcRightLine() )
7159 : 0 : aOut.SSize().Width() += 2*nPixelSzW;
7160 [ # # ][ # # ]: 0 : if ( rAttrs.CalcBottomLine() )
7161 : 0 : aOut.SSize().Height()+= 2*nPixelSzH;
7162 : :
7163 : : // #i92711# start Pre/PostPaint encapsulation before pOut is changed to the buffering VDev
7164 [ # # ][ # # ]: 0 : const Region aRepaintRegion(aOut.SVRect());
7165 [ # # ]: 0 : pSh->DLPrePaint2(aRepaintRegion);
7166 : :
7167 : 0 : Window *pWin = pSh->GetWin();
7168 : 0 : sal_uInt16 nZoom = pSh->GetViewOptions()->GetZoom();
7169 : 0 : ::SetOutDevAndWin( pSh, &aDev, 0, 100 );
7170 : 0 : bFlyMetafile = sal_True;
7171 : 0 : pFlyMetafileOut = pWin;
7172 : :
7173 : 0 : SwViewImp *pImp = pSh->Imp();
7174 : 0 : pFlyOnlyDraw = pFly;
7175 [ # # ][ # # ]: 0 : pLines = new SwLineRects;
7176 : :
7177 : : // OD 09.12.2002 #103045# - determine page, fly frame is on
7178 [ # # ]: 0 : const SwPageFrm* pFlyPage = pFly->FindPageFrm();
7179 [ # # ]: 0 : const Color aPageBackgrdColor = pFlyPage->GetDrawBackgrdColor();
7180 [ # # ]: 0 : const IDocumentDrawModelAccess* pIDDMA = pSh->getIDocumentDrawModelAccess();
7181 : : // --> OD #i76669#
7182 [ # # ]: 0 : SwViewObjectContactRedirector aSwRedirector( *pSh );
7183 : : // <--
7184 [ # # ]: 0 : pImp->PaintLayer( pIDDMA->GetHellId(), 0, aOut, &aPageBackgrdColor,
7185 [ # # ]: 0 : (pFlyPage->IsRightToLeft() ? true : false),
7186 [ # # ]: 0 : &aSwRedirector );
7187 [ # # ]: 0 : pLines->PaintLines( &aDev );
7188 [ # # ]: 0 : if ( pFly->IsFlyInCntFrm() )
7189 [ # # ]: 0 : pFly->Paint( aOut );
7190 [ # # ]: 0 : pLines->PaintLines( &aDev );
7191 : : /// OD 30.08.2002 #102450# - add 3rd parameter
7192 [ # # ]: 0 : pImp->PaintLayer( pIDDMA->GetHeavenId(), 0, aOut, &aPageBackgrdColor,
7193 [ # # ]: 0 : (pFlyPage->IsRightToLeft() ? true : false),
7194 [ # # ]: 0 : &aSwRedirector );
7195 [ # # ]: 0 : pLines->PaintLines( &aDev );
7196 [ # # ]: 0 : DELETEZ( pLines );
7197 : 0 : pFlyOnlyDraw = 0;
7198 : :
7199 : 0 : pFlyMetafileOut = 0;
7200 : 0 : bFlyMetafile = sal_False;
7201 : 0 : ::SetOutDevAndWin( pSh, pOld, pWin, nZoom );
7202 : :
7203 : : // #i92711# end Pre/PostPaint encapsulation when pOut is back and content is painted
7204 [ # # ]: 0 : pSh->DLPostPaint2(true);
7205 : :
7206 [ # # ]: 0 : aMet.Stop();
7207 [ # # ]: 0 : aMet.Move( -pFly->Frm().Left(), -pFly->Frm().Top() );
7208 [ # # ][ # # ]: 0 : aRet = Graphic( aMet );
[ # # ]
7209 : :
7210 [ # # ]: 0 : if( bNoteURL )
7211 : : {
7212 : : OSL_ENSURE( pNoteURL, "MakeGraphic: Good Bye, NoteURL." );
7213 [ # # ]: 0 : pNoteURL->FillImageMap( pMap, pFly->Frm().Pos(), aMap );
7214 [ # # ][ # # ]: 0 : delete pNoteURL;
7215 : 0 : pNoteURL = NULL;
7216 : : }
7217 [ # # ][ # # ]: 0 : pGlobalShell = pOldGlobal;
[ # # ][ # # ]
[ # # ][ # # ]
7218 : : }
7219 [ # # ]: 0 : return aRet;
7220 : : }
7221 : :
7222 : 0 : Graphic SwDrawFrmFmt::MakeGraphic( ImageMap* )
7223 : : {
7224 : 0 : Graphic aRet;
7225 [ # # ][ # # ]: 0 : SdrModel *pMod = getIDocumentDrawModelAccess()->GetDrawModel();
7226 [ # # ]: 0 : if ( pMod )
7227 : : {
7228 [ # # ]: 0 : SdrObject *pObj = FindSdrObject();
7229 [ # # ][ # # ]: 0 : SdrView *pView = new SdrView( pMod );
7230 [ # # ][ # # ]: 0 : SdrPageView *pPgView = pView->ShowSdrPage(pView->GetModel()->GetPage(0));
7231 [ # # ]: 0 : pView->MarkObj( pObj, pPgView );
7232 [ # # ][ # # ]: 0 : aRet = pView->GetMarkedObjBitmap();
[ # # ][ # # ]
[ # # ]
7233 [ # # ]: 0 : pView->HideSdrPage();
7234 [ # # ][ # # ]: 0 : delete pView;
7235 : : }
7236 : 0 : return aRet;
7237 [ + - ][ + - ]: 219 : }
7238 : :
7239 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|